#1766 closed Bugs (fixed)
Wrong evaluation of conditional preprocessor directives with predefined macros __FILE__, __LINE__ and __INCLUDE_LEVEL__
Reported by: | Owned by: | Hartmut Kaiser | |
---|---|---|---|
Milestone: | Boost 1.36.0 | Component: | wave |
Version: | Boost 1.35.0 | Severity: | Problem |
Keywords: | wave, predefined makros | Cc: |
Description
Checking whether one of the predefined macros __LINE__, __FILE__ and __INCLUDE_LEVEL__
exists is not possible, wave always returns false when one of these macros is checked with the defined() operator or the #ifdef directive for example.
For example this code will trigger the error even though __LINE__
is defined.
#ifndef __LINE__ #error "no __LINE__" #endif
I had a look at the source and think it can be fixed in cpp_macromap.hpp: There are three overloads for macromap<>::is_defined(), but only one checks for the special case of those three predefined macros. If the other overloads call the working one, the problem seems gone.
However, i have no experience with the wave source and just started having a look at it today, thats why i have no idea if there aren't any side-effects with this 'fix' and I'm looking for an official fix or a reply on this case. I have attached my .patch though.
Attachments (1)
Change History (3)
by , 15 years ago
Attachment: | wave_predefined.patch added |
---|
follow-up: 2 comment:1 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Thanks for the patch! I applied it to the trunk.
Regards Hartmut
comment:2 by , 15 years ago
Replying to hkaiser:
Thanks for the patch! I applied it to the trunk.
Additionally I added a new test checking for this regression.
Regards Hartmut
patch that maybe solves the problem