Commit graph

21 commits

Author SHA1 Message Date
Olly Betts
631b41ae7b Use https for swig.org links 2022-10-06 13:16:39 +13:00
Olly Betts
6c4010e442 Resolve -Wstrict-prototypes warnings with clang-15
warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
2022-06-30 12:52:00 +12:00
Olly Betts
747a51f095 Try to prevent direct use of exit(), malloc(), etc
Use `#pragma GCC poison` (supported since GCC 3, maybe earlier) when
compiling with GCC to help prevent direct uses being introduced for
functions which DOH provides a wrapper for.
2022-03-06 15:36:42 +13:00
Olly Betts
55377bdc08 Add DOH Exit() and SetExitHandler()
Exit() is a wrapper for exit() by default, but SetExitHandler() allows
specifying a function to call instead.

This means that failures within DOH (e.g. Malloc() failing due to lack
of memory) will now perform cleanup such as removing output files.

This commit also cleans up exit statuses so SWIG should now reliably
exit with status 0 if the run was successful and status 1 if there was
an error (or a warning and -Werror was in effect).

Previously in some situations SWIG would try to exit with the status set
to the number of errors encountered, but that's problematic - for
example if there were 256 errors this would result in exit status 0 on
most platforms.  Also some error statuses have special meanings e.g.
those defined by <sysexits.h>.

Also SWIG/Javascript tried to exit with status -1 in a few places (which
typically results in exit status 255).
2022-03-06 12:33:54 +13:00
Olly Betts
e38847f7e1 Fail cleanly on allocation failures
Previously code in the SWIG tool didn't handle allocation failures
well.  Most places didn't check for NULL return from
malloc()/realloc()/calloc() at all, typically resulting in undefined
behaviour, and some places used assert() to check for a NULL return
(which is a misuse of assert() and such checks disappear if built with
NDEBUG defined leaving us back with undefined behaviour).

All C allocations are now done via wrapper functions (Malloc(),
Realloc() and Calloc()) which emit and error and exit with non-zero
status on failure, so a non-NULL return can be relied upon.

Fixes #1901.
2022-03-04 11:47:49 +13:00
Zackery Spytz
3b0db10aa4 Increase DOH_POOL_SIZE
Increase DOH_POOL_SIZE to 2^22.

Addresses GH-1775.
2020-04-18 09:57:20 -06:00
William S Fulton
e7d626d1b4 Remove use of 'register' in C source
No noticable performance change using gcc x86-64 in Java and Python
test-suites.
2018-05-04 20:02:13 +01:00
William S Fulton
7841a0d097 Remove cvs/svn Id strings 2013-01-12 01:21:16 +00:00
William S Fulton
45a259d274 Correct accidental turning on of DOH_DEBUG_MEMORY_POOLS
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13525 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-08-05 22:18:39 +00:00
William S Fulton
766128065f Error checking for stale DOH object use - also with documentation.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13521 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-08-05 16:16:23 +00:00
William S Fulton
cdfa81e572 Add some error checking for stale DOH object use
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13520 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-08-05 15:53:56 +00:00
William S Fulton
cb64f65bae SWIG license change - Source moves to GPLv3
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11876 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-02-27 23:53:33 +00:00
Dave Beazley
fc10a97b23 Changed Header keyword to Id
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9607 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-12-05 22:11:40 +00:00
William S Fulton
aa04c4c057 beautify/format source code with gnu indent
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9505 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-11-01 23:54:54 +00:00
Marcelo Matus
3955965739 more memory leaks fixes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7921 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-12-04 01:16:57 +00:00
Marcelo Matus
15a5e3976f CHANGES.current
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6269 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-09-26 01:14:49 +00:00
William S Fulton
b0df32dd1a Various warning fixes for .NET 2003 cl /W4 to work barring one warning and for gcc -ansi -Wall -pedantic to be warning free:
const fixes and function prototype declarations matching the definition etc


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5639 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-15 22:46:07 +00:00
William S Fulton
c13a3081b3 warning fix
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4925 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-06-25 09:36:59 +00:00
Dave Beazley
404b92eb46 Fixed meta-leak.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4674 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-04-10 19:20:09 +00:00
Dave Beazley
1aefd191bf Memory diagnostics. Huge memory leak cleanup related to templates
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4639 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-03-27 23:17:27 +00:00
Dave Beazley
4e2070ef43 Major cleanup
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4155 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2002-12-03 20:56:45 +00:00
Renamed from Source/DOH/Doh/memory.c (Browse further)