Closed realazthat closed 2 years ago
I don't know what the problem is yet, but I do have a workaround for you to try:
Replace this line:
ctx.set_language(/*language=*/boost::wave::language_support::support_cpp11);
with these two:
ctx.set_language(boost::wave::enable_long_long(ctx.get_language()));
ctx.set_language(boost::wave::enable_variadics(ctx.get_language()));
C++11 support consists of three things: long long
, variadics, and a removal of a warning when the input does not end in a newline. It seems like the third feature is interacting with the found_unknown_directive
hook.
I think I have a fix, and a tentative root cause... the "ignore lack of newline before EOF" feature is checked in one place unconditionally, regardless of whether we are actually looking at EOF. Can you try changing this line to:
return need_no_newline_at_end_of_file(ctx.get_language()) &&
((it == end) || (T_EOF == token_id(*it)));
and let me know if it works for you?
and let me know if it works for you?
Nope, I don't think it is working :(
OK! did the behavior change in any way? For me, this causes the found_unknown_directive
callback to start firing. New output:
generated_token()
token.is_valid(): true
token_id: 402915724
boost::wave::get_token_name(token_id): POUND
token.get_value(): #
generated_token()
token.is_valid(): true
token_id: 134480252
boost::wave::get_token_name(token_id): IDENTIFIER
token.get_value(): version
generated_token()
token.is_valid(): true
token_id: 1476395402
boost::wave::get_token_name(token_id): NEWLINE
token.get_value():
found_unknown_directive, line: #,version,
,
terminate called after throwing an instance of 'boost::wrapexcept<boost::wave::preprocess_exception>'
what(): boost::wave::preprocess_exception
Aborted
OK my bad, it was still using the system boost, which I uninstalled and now it worked.
$ LD_LIBRARY_PATH=$HOME/boost/stage/lib/ ./a.out
found_unknown_directive, line: #,version,
,
terminate called after throwing an instance of 'boost::wrapexcept<boost::wave::preprocess_exception>'
what(): boost::wave::preprocess_exception
Aborted
Note, I commented out the generated_token() logging, so this is consistent with your output.
Great! OK, what else is left? Any other behavior that seems wrong?
Great! OK, what else is left? Any other behavior that seems wrong?
I think that does it.
#version
.#
symbol.My minimal reproducible example and output:
Output:
Expected output: