Subject: [Boost-bugs] [Boost C++ Libraries] #1766: Wrong evaluation of conditional preprocessor directives with predefined macros __FILE__, __LINE__ and __INCLUDE_LEVEL__
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-04-03 23:05:20
#1766: Wrong evaluation of conditional preprocessor directives with predefined
macros __FILE__, __LINE__ and __INCLUDE_LEVEL__
-------------------------------------+--------------------------------------
Reporter: daniel.wadehn_at_[hidden] | Owner: hkaiser
Type: Bugs | Status: new
Milestone: Boost 1.36.0 | Component: wave
Version: Boost 1.35.0 | Severity: Problem
Keywords: wave, predefined makros |
-------------------------------------+--------------------------------------
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.
--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1766>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC