-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty ifdef block does not emit line directive for missing whitespace. #138
Comments
Encouragingly the standalone
|
OK, I think I've got it. For emitting The template <typename Token>
struct ContextPolicy
: boost::wave::context_policies::eat_whitespace<Token> {
typedef boost::wave::context_policies::eat_whitespace<Token> base_type;
template <typename ContextT, typename TokenT>
bool may_skip_whitespace(ContextT const& ctx, TokenT& token,
bool& skipped_newline) {
this->base_type::may_skip_whitespace(ctx, token, skipped_newline);
return false;
}
}; Using this I was able to duplicate your desired output. |
@hkaiser should the default preprocessing hooks set |
Two questions need to be answered for this:
In the end the answer should be yes if the answer to 1. is 'likely' and to 2. 'unlikely'. |
Upon further reflection this is a bad idea, nevermind. It is a little funny that the correct production of line directives depends on the choice of preprocessor hooks. My intuition would have been that the default would do it. Hm. |
Indeed. I think we should make the change. If it breaks somebody's code, we'll deal with it later... |
Well, I thought about it a little bit and given that the default returns |
Yep, it looks like the paths for handling |
I think we should move handling for |
Sure, fine with me. Thanks! |
@realazthat develop branch contains another line directive-related bug fix that may be of interest to you (to be released in 1.80) |
#if 0 ... #endif
it properly writes out a#line
directive that accounts for the whitespace.#ifdef NOT_DEFINED ... #endif
, no#line
directive is emitted, leading to incorrect line numbering by subsequent compiler's accounting (compiler's reconstruct line numbers via properly emitted#line
directives).Example code that is preprocessed:
Above preprocessed (with line numbering for your convenience).
Full code to reproduce (you can pretty much ignore everything outside of
main()
, is just for the nice debug output):The text was updated successfully, but these errors were encountered: