Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#1766 closed Bugs (fixed)

Wrong evaluation of conditional preprocessor directives with predefined macros __FILE__, __LINE__ and __INCLUDE_LEVEL__

Reported by: daniel.wadehn@… 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)

wave_predefined.patch (1.1 KB ) - added by anonymous 15 years ago.
patch that maybe solves the problem

Download all attachments as: .zip

Change History (3)

by anonymous, 15 years ago

Attachment: wave_predefined.patch added

patch that maybe solves the problem

comment:1 by Hartmut Kaiser, 15 years ago

Resolution: fixed
Status: newclosed

Thanks for the patch! I applied it to the trunk.

Regards Hartmut

in reply to:  1 comment:2 by Hartmut Kaiser, 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

Note: See TracTickets for help on using tickets.