Updates the non-strict lexer to support e and E, both with value 27
(ASCII ESC). Also adds tests for lexing these literals, and checks
that they are usable in conditional preprocessor expressions.
* 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.
* 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.
Under Visual Studio 2019 (and possibly 2017), building with /permissive- causes three samples to fail to compile. Adding the /Zc:twoPhase- option makes them compile successfully again. See bug #160 for more details.
It's unclear what the source of this issue is, but using constexpr variables instead of a macro is better practice anyway, and fixes the errors.
* Check hooks after expected errors, not just when there are none
Some unit tests had intentional errors, and code to verify that the
appropriate hooks were called, but we never checked.
* Update unit tests to match hooks, now that we are checking
* Fix bug revealed by checking the hooks
Or in other words, bug #161 (thanks abakhirkin for the fix)
* Fix link in documentation
* Use capacity() == 0 as the definitive mark of an empty string storage.
Comparing the pointer with the static emptyString_ member of the
SimpleStringStorage class will likely break if the comparison happens
across shared library boundary. So use capacity() == 0 consistently
to detect whether the storage refers to the emptyString_ member.
When capacity is non-zero the data is always dynamically allocated.
* Suppress gcc 11.2 -Wfree-nonheap-object warnings.
The warnings are bogus because the pData_ pointer never points to
emptyString_ if capacity() == 0, and always points otherwise. The
compiler simply fails to deduce this invariant.
Unfortunately, suppressing the warning with a #pragma doesn't work,
so we have to invent a compile-time assert that will make the invariant
detectable by the compiler.
Closes https://github.com/boostorg/wave/issues/159.
* Removed unused AllocatorStringStorage::Realloc function.
This function was not used and potentially incorrect, as it unconditionally
calls Free, which would be wrong if the original buffer was emptyString_.
- Add C++11 feature requirements to test and samples subprojects
- Add constexpr to the features tested for in the deprecation check
- Add the C++11 requirement to the documentation metadata
- Add one C++03 build to the Appveyor list. It should pass without running (serves as a test on the above).
Co-authored-by: Alexander Grund <Flamefire@users.noreply.github.com>
* The comma operator is deprecated inside of square brackets
solution: add parentheses
* Bitwise operations are deprecated between different enum types
solution: add user-defined operators for the combinations we use
* std::tmpnam usage gets a linker warning identifying security issues, recommends mkstemp()
solution: use Boost.Filesystem temporary filename functions
* Extend __has_include grammar for complex conditional expressions
The logic handling __has_include erroneously assumed it would always
be the last expression on a line. This code fixes that by extending
the grammar to only consume the __has_include() itself, and count
parentheses as necessary to find the correct input range.
Also add some unit tests to cover the error in the future.
* While I'm at it, a couple of small cleanups
1) Remove unneeded header
2) The wrong BOOST_SPIRIT_DEBUG_TRACE_RULE was commented out
It currently says Wave "will now" report an error for input which is not terminated by a newline. In fact it "will not" do that.
I made some additional descriptive edits that made sense to me personally.
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.
At some point in the past the handling for #if and #ifdef diverged. The code that handles emitting a line directive when a conditional section is skipped worked for #if but not ifdef/ifndef.
This problem was not observable when the eat_whitespace hooks were used instead of the default_preprocessing hooks, because the former
signals skipped newlines through the may_skip_whitespace hook, hiding the problem. Furthermore, the majority of Wave tests use the eat_whitespace hooks, so it wasn't visible there.
This change restores ifdef/ifndef to the same section as #if, so any changes to conditional handling will happen uniformly. Also, a test case is added to cover the default hooks and this particular case.
Removing C++03 from Wave's CI config isn't enough - the top-level Boost
build will try to build Wave under unsupported standards/compiler versions
without an explicit requirement.
Remove some ugly excess whitespace from the ChangeLog while I'm here.