* fix segment fault of empty stringify under C++20
* Add tests for optional comma in variadic macro call
---------
Co-authored-by: Jeff Trull <edaskel@att.net>
* Make the library modular usable.
* Switch to library requirements instead of source. As source puts extra source in install targets.
* Add wave tool build to all target.
* Add missing NO_LIB usage requirements.
* Add requires-b2 check to top-level build file.
* Bump B2 require to 5.2
* Change all <source> references to <library>.
* Move inter-lib dependencies to a project variable and into the build targets.
* Update build deps.
To test against different compiler versions we use older Docker
images, which in turn have different glibc versions. Github recently
deprecated Node version 16, which had been built with an older glibc
version, and the newer Node version requires a glibc version that is
not available on the old images, causing builds to fail.
This is a hack permitting the continued use of Node 16, until Github
decides to make it impossible.
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.
* Update marker before and after fill() operation in cpplexer
* A basic test case for trigraph "pound" (octothorpe) on fill boundary (detects the marker issue)
This change resolves#202
---------
Co-authored-by: Chris Chisolm <chris_chisolm@intuit.com>
Co-authored-by: Jeff Trull <edaskel@att.net>
* Check for backslash characters before the start of the new data
With BOOST_WAVE_BSIZE set to 40, test t_5_002 fails because a newline appears exactly at the beginning of a newly
fetched buffer, and a backslash is at the end of the previous one. In that case the escaped newline
was not detected. This change will also consider three unprocessed bytes of input data, if available,
prior to the new data, which is enough to detect a trigraph backslash.
* Improve data range check for backslash newline
The existing check considered the space required for a trigraph backslash, but not for the following LF (or CRLF) before testing for them. With BOOST_WAVE_BSIZE set to 98 this caused a segfault in t_5_001.
There is no guarantee (indeed, it is unlikely) that data within the
scanner buffer will be null terminated, and so the constructor that
accepts a pointer and a count is appropriate.
This will be for Boost 1.84 forward. The new replacements were
available previously, so for some versions before 1.84 we'll still see
deprecation warnings if users mix versions of Boost and Wave.
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_.