Opened 15 years ago
Closed 15 years ago
#1130 closed Bugs (fixed)
GCC -wundef warnings
Reported by: | anonymous | Owned by: | John Maddock |
---|---|---|---|
Milestone: | Boost 1.35.0 | Component: | config |
Version: | Boost 1.34.1 | Severity: | Problem |
Keywords: | Cc: |
Description
Compiling code that includes Boost headers with gcc -wundef
produces a lot of warnings about undefined preprocessor symbols, mainly in BOOST_WORKAROUND(XXX, ...)
where XXX
is not defined.
Example:
boost/filesystem/fstream.hpp line 103:
# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this
should probably be
# if defined( BOOST_MSVC ) && !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 )
Change History (4)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
Component: | None → config |
---|---|
Owner: | set to |
comment:3 by , 15 years ago
Status: | new → assigned |
---|
I'm working on this now, hopefully we'll work something out!
comment:4 by , 15 years ago
Milestone: | To Be Determined → Boost 1.35.0 |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
This is hopefully now fixed with this changeset: http://svn.boost.org/trac/boost/changeset/39473/trunk/boost/detail/workaround.hpp
Note that the logic we've used is the reverse of yours: the danger with your suggested fix is that if you use BOOST_WORKAROUND with a macro about which it knows nothing, then it will always evaluate to false :-(
Regards, John Maddock.
I notice that this problem has been discussed previously on <http://lists.boost.org/Archives/boost/2005/10/95850.php> and there's a proposal to do with BoostConfig referenced there: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?BoostConfig>.
I also notice that that's proposing using constructs such as:
I wonder if you could use this instead:
and you could then define
for each macro used in a BOOST_WORKAROUND expansion rather than all those #ifndefs. Just a thought. (I also did wonder whether there was some preprocessor magic to save having to define all those by hand but I couldn't come up with any).
Until this problem is resolved in an official boost release, that's what we're intending to do so that we can compile with -Wundef.
-- Andy, BlueArc Engineering