njnobles
ffdc3419a3
Emit line directives for includes with directive on first line ( #223 )
...
* Emit line directives for includes with directive on first line
* Add nested include tests
Thanks to Nick Nobles for this bug report and fix
2024-10-03 12:49:37 -07:00
Jeff Trull
df2125a1bd
Repair Overflow Checks
...
The previous code checked for signed overflow on +, -, and * by doing
the operation and checking the result, which can invoke undefined
behavior. This replaces that code with initial tests on the operands.
In addition, a test for the sole integer division overflow case (that
is not division by zero) was missing: INT_MIN / -1
It has now been added, along with a test case.
2024-06-25 15:00:02 -07:00
Jeff Trull
68b8e26625
Fix line directives after endif following else ( #170 )
...
* Fix line directives after endif when else clause is present
The initial part of a conditional block (the if/ifdef/ifndef) takes
the "slow" path through the code in cpp_iterator.hpp using the C++
expression grammar, while else and endif directives take the "fast"
path. The slow path sets must_emit_line_directive, and it will be
cleared after either else or endif is processed. Unfortunately when
an else precedes the endif, must_emit_line_directive is cleared and is
never set, as only the slow path sets it. The result is proper line
directives are issued for the else clause, but not for the subsequent
endif.
This changes adds setting of must_emit_line_directive in the "fast"
path for endif so line directives are considered after an intervening else.
2022-06-25 07:09:56 -07:00
Jeff Trull
44e3f30ff9
Let long integer literals participate in conditional expressions ( #165 )
...
Also add a test case for this situation
2022-06-22 11:23:06 -07:00
Jeff Trull
467afcc46e
Qualify "newline at EOF not required" with actually being there ( #141 )
...
In C++11 and later modes Wave by default does not require newline prior to EOF. This works
fine but there is one place where the test for this feature was used but Wave is not necessarily
looking at the end of the file: pp_is_last_on_line. One observable (and surprising)
result is that unknown directives are not getting flagged - there may be others. The unit tests
did not discover this problem because they generally do not set c++11 mode.
The necessary qualification is added, along with unit test to cover this issue.
2022-01-02 14:24:39 -08:00
Jeff Trull
9d68ca319a
Track the location tokens were expanded from, for __LINE__ and __FILE__
...
An (optional) extra position field is added to token_data and set for
any identifier token created from a macro expansion. This information
is used to correctly calculate the filename and line number.
2020-07-20 20:51:14 -07:00
Jeff Trull
ee0a7c14c5
Implement __has_include() ( #102 )
...
Resolve #96 by introducing C++17 feature (and frequent vendor extension) __has_include(), along with appropriate unit tests and documentation updates
2020-06-27 07:22:52 -07:00
Jeff Trull
ec0c8c8603
Implement C++20 features ( #75 )
...
* Introduce support for C++20 preprocessor features
- add __VA_OPT__ feature to variadic macros
- allow supplying 0 variadic arguments in more cases
- add related unit tests
2020-03-06 11:48:50 -08:00
Robert Lenhardt
e3680846ce
fix utf8 testcases on non-windows systems
2018-10-06 12:41:23 +02:00
Robert Lenhardt
231aad085f
add tests for utf-8 paths
2018-10-04 17:40:21 +02:00
Abel Sinkovics
358a0e9668
Fix including header file without newline at the end
2017-09-18 22:25:52 +02:00
Abel Sinkovics
972461234d
Fix reporting missing #endif when there is no new line after #if or #else
2017-09-18 22:02:57 +02:00
Abel Sinkovics
a53b51e440
Fix #line directive without new line at the end of a file
2017-09-17 15:35:37 +02:00
Abel Sinkovics
3c8b90bf60
Accept files with preprocessor directive in last line and no new line in C++11 mode.
2017-09-17 13:49:36 +02:00
Hartmut Kaiser
7dcb53aa80
Wave: fixed #8848 : Wave driver improperly processes 0xFFFFui64 token
...
[SVN r85077]
2013-07-19 01:49:48 +00:00
Hartmut Kaiser
f83599b75b
Wave: Fixed an obscure problem when preprocessing directives wouldn't be recognized if the previous line contained nothing but an empty macro invocation (see new test case t_9_023.cpp)
...
[SVN r79783]
2012-07-28 14:08:09 +00:00
Hartmut Kaiser
56f4a8e7d2
Fixed #7159 : Text-lines are processed as if they were preprocessing directives
...
[SVN r79684]
2012-07-22 23:08:25 +00:00
Hartmut Kaiser
ed79490930
Wave: Fixed #6838 : Adding include file with force_include makes Wave fail to emit #line directive
...
Added support for test of --forceinclude option to testwave executable, added test case verifying #6838 is fixed.
[SVN r78554]
2012-05-23 14:38:10 +00:00
Hartmut Kaiser
5cd2912a6f
Wave: Fixed whitespace handling, added a corresponding set of test cases
...
[SVN r69196]
2011-02-23 01:31:14 +00:00
Hartmut Kaiser
12c91c34c1
Wave: updated copyrights, worked on whitespace skipping
...
[SVN r67893]
2011-01-09 21:54:54 +00:00
Hartmut Kaiser
0a02b4bc4c
Wave: fixed lexing errors introduced with the last commit, added new use case
...
[SVN r67118]
2010-12-09 03:01:33 +00:00
Hartmut Kaiser
55752997a3
Wave: more work on C++0x support, fixed a macro expansion problem
...
[SVN r67117]
2010-12-09 01:44:51 +00:00
Hartmut Kaiser
eb2d0881aa
Wave: improved consistency in reporting skipped tokens to the hooks function when processing conditional preprocessing directives. Added a new test case verifying the skipped_token hook gets called reproducibly (t_2_020.cpp). Started to work on C++0x features for Wave.
...
[SVN r65314]
2010-09-05 22:33:20 +00:00
Hartmut Kaiser
5146cbbe2a
Wave: more work on pragma once pp hooks, added test case
...
[SVN r56312]
2009-09-19 19:57:09 +00:00
Hartmut Kaiser
4cc8bb6365
Wave: now compiles even with BOOST_FILESYSTEM_NO_DEPRECATED defined
...
[SVN r51679]
2009-03-10 01:35:54 +00:00
Hartmut Kaiser
4b50d02f7a
Wave: Changing properties for test.cfg to fix test failures non Windows systems
...
[SVN r44977]
2008-05-01 16:20:38 +00:00
Hartmut Kaiser
e3302210d7
Wave: Added new test to check for regression as reported by ticket #1766 .
...
[SVN r44026]
2008-04-04 02:00:35 +00:00
Hartmut Kaiser
687c0a8a87
Wave: Fixed #1673 .
...
[SVN r43524]
2008-03-06 03:28:47 +00:00
Hartmut Kaiser
d93f701095
Wave: Added new testcase.
...
[SVN r42977]
2008-01-26 01:36:20 +00:00
Hartmut Kaiser
2536de0389
Wave: improved error handling and some diagnostics, added corresponding tests.
...
[SVN r35186]
2006-09-18 23:24:30 +00:00
Hartmut Kaiser
61758d08ec
Wave: Fixed a bug resulting in a crash if a macro was redefined with a shorter expansion list as it was defined initially. Added a corresponding test case.
...
[SVN r34926]
2006-08-23 01:40:23 +00:00
Hartmut Kaiser
ff02969b74
Fixed usability of true/false as macro names.
...
[SVN r34075]
2006-05-24 01:34:24 +00:00
Hartmut Kaiser
20d9781876
Fixed a subtle preprocessing bug.
...
[SVN r34045]
2006-05-20 18:49:51 +00:00
Hartmut Kaiser
251bc128ba
Wave: enabled one new testcase.
...
[SVN r33221]
2006-03-03 22:46:05 +00:00
Hartmut Kaiser
f859c951db
Added a new testcase.
...
[SVN r33167]
2006-02-28 04:07:24 +00:00
Hartmut Kaiser
e84efe1220
Wave now correctly recognizes pp-number tokens.
...
[SVN r32374]
2006-01-23 03:45:35 +00:00
Hartmut Kaiser
5115faf51e
Updated the Wave copyright notice to include the year 2006.
...
[SVN r32154]
2005-12-24 19:50:47 +00:00
Hartmut Kaiser
e027416fb0
Fixed error handling for passive #if/#elif branches.
...
[SVN r31184]
2005-10-03 15:15:30 +00:00
Hartmut Kaiser
4b75ea2f6c
Change to debug a CW9.5 problem.
...
[SVN r29893]
2005-07-05 03:25:42 +00:00
Hartmut Kaiser
a48ad509f3
Fixed the overflow problem for long character literals, fixed the 'LL' issue.
...
[SVN r28711]
2005-05-07 11:18:19 +00:00
Hartmut Kaiser
436eee322a
Checked in missing change.
...
[SVN r28656]
2005-05-04 18:21:26 +00:00
Hartmut Kaiser
a2df95b74c
Improved error handling for out of range character literals, added several new test cases.
...
[SVN r28557]
2005-05-01 21:01:23 +00:00
Hartmut Kaiser
a4d0ea235e
Fixed error reporting for a specific use case, added corresponding testcase.
...
[SVN r28536]
2005-04-29 20:08:34 +00:00
Hartmut Kaiser
ac3962bd50
Added additional testcases.
...
[SVN r28506]
2005-04-27 20:28:17 +00:00
Hartmut Kaiser
1ef3c6b46e
updated Wave to reflect the recent changes in the program_options library.
...
[SVN r28490]
2005-04-26 18:44:37 +00:00
Hartmut Kaiser
ef93298acb
Enforced that #if/#endif are balanced file wise.
...
[SVN r28084]
2005-04-10 18:26:34 +00:00
Hartmut Kaiser
96aef5d5cc
Added workaround for gcc3.3.x bug.
...
[SVN r28082]
2005-04-10 13:45:18 +00:00
Hartmut Kaiser
ddf3523acf
Added the first part of the MCPP validation suite to the Wave unit tests.
...
[SVN r28005]
2005-04-06 07:28:34 +00:00
Hartmut Kaiser
d449562045
Added more unit tests.
...
[SVN r27959]
2005-04-04 19:40:32 +00:00
Hartmut Kaiser
1c2ca265ea
Added lot of unit tests, fixed a couple of minor bugs.
...
[SVN r27950]
2005-04-04 11:03:51 +00:00