Commit Graph

32 Commits

Author SHA1 Message Date
Olly Betts 02b4bd8eca Fix spaceship operator bugs, document, add tests
Remove some erroneously added brackets_increment() calls.

Reject <=> in preprocessor expressions with a clear error message (it
seems it isn't supported here - clang and gcc don't at least).

The type returned by `<=>` is not `bool`.  We pretend it's
`int` for now, which should work for how it's likely to be used
in constant expressions.

Fixes #1622
2022-07-27 09:12:40 +12:00
Olly Betts 36310c04e5 Add comments to clarify how #define gets wrapped
It took me a while to fully get my head around this, and I'd like to
help out future developers.
2022-07-27 09:10:51 +12:00
Olly Betts 8c5c14b9ad Merge branch 'cpp-testing'
Closes #2329
2022-07-27 07:55:24 +12:00
Olly Betts 1bfe88eeda Support binary integer literals in the preprocessor 2022-07-26 15:28:51 +12:00
Olly Betts de5ce08a7d Fix operator precedence in preprocessor expressions 2022-07-26 14:18:38 +12: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 735732d721 Eliminate calls to abort()
Call Exit(EXIT_FAILURE) instead so that output files get removed.
2022-03-06 14:21:06 +13:00
Olly Betts 4986b8793d Emit preprocessor expr error for unary + on string
Previously other unary operators on a string all gave an error, but
unary + was handled as a no-op and so didn't.
2022-02-24 09:50:22 +13:00
Olly Betts 81caed4f1d Clean up preprocessor expression evaluation code
Remove redundant code and add/improve comments.
2022-02-24 08:15:07 +13:00
Olly Betts 204a5f7bf3 Fix a preprocessor expression evaluation bug
A subexpression in parentheses lost its string/int type flag and
instead used whatever type was left in the stack entry from
previous use.  In practice we mostly got away with this because
most preprocessor expressions are integer, but it could have
resulted in a preprocessor expression incorrectly evaluating as
zero.  If -Wextra was in use you got a warning:

Warning 202: Error: 'Can't mix strings and integers in expression'

Fixes #1384
2022-02-23 18:53:59 +13:00
William S Fulton 532999f4f2 Improve error message when preprocessor expressions result in a floating point constant
Instead of a syntax error, the error is now:
  Warning 202: Error: 'Floating point constant in preprocessor expression'
2018-01-15 08:09:14 +00:00
William S Fulton ea5b55ecf4 Fix floating point division by zero in preprocessor expressions.
Closes #1183
2018-01-15 07:51:18 +00:00
William S Fulton 7841a0d097 Remove cvs/svn Id strings 2013-01-12 01:21:16 +00:00
William S Fulton dac89e16d4 const char * correctness fixes (in C code)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13939 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-11-26 20:30:37 +00:00
William S Fulton 8bf1347354 Warning fixes using clang
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13024 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-04-29 21:51:18 +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
Olly Betts f881f98daf Fix memory leak in SWIG's parser (based on patch from Russell
Bryant in SF#1914023).`


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10310 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-03-17 00:36:35 +00:00
Dave Beazley 6ffd26cc1e API cleanup. Scanner interface
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9635 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-01-12 01:44:16 +00:00
Dave Beazley 54ec9df2ca Changed Header to Id
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9611 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-12-05 22:17:26 +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
William S Fulton 7f74b8e7a3 Common template for head of each file detailing licence, distribution and authors information
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8972 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-03-06 22:51:01 +00:00
Marcelo Matus 645f95d633 fix many/many memory leaks
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7904 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-11-30 21:32:27 +00:00
William S Fulton fea836f808 Bill Clarke preprocessor fix for dynamic_cast.cpptest failure on Solaris
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6243 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-09-14 20:31:12 +00:00
Dave Beazley acee037c44 Fixed bug in preprocessor expression evaluator. (backslash).
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5632 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-15 00:58:13 +00:00
William S Fulton c00aaf0f5b Moved non static function declarations from source files into header files
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5602 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-28 21:48:39 +00:00
Dave Beazley 12a43edc2d The great merge
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2002-11-30 22:01:28 +00:00
Thien-Thi Nguyen 5b0dee81ee (Preprocessor_expr_init): Use `void' arg instead of empty list.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@437 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2000-05-11 07:52:57 +00:00
Dave Beazley d72c7beb9d Major cleanup of comments
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@128 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2000-01-20 05:45:58 +00:00
Dave Beazley cc85906a83 Renamining
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@102 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2000-01-18 21:53:32 +00:00
Dave Beazley c91f356ee0 Corrected the version
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@67 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2000-01-12 18:22:34 +00:00
Dave Beazley 8bd2ea80fe Added cvstags
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@54 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2000-01-12 04:09:03 +00:00
Dave Beazley b558974525 First checkin
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@34 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2000-01-11 20:08:25 +00:00