boostorg / wave

Boost.org wave module
http://boost.org/libs/wave
21 stars 49 forks source link

Fix line directives for ifdef and ifndef when default hooks are used #140

Closed jefftrull closed 2 years ago

jefftrull commented 2 years ago

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 in testing.

This change restores #ifdef/#ifndef to the same section as #if, so any future changes to conditional handling will happen uniformly. Also, a test case is added to cover the default hooks and this particular case.

If merged, this will resolve #138