Discussion:
[GCC-XML] Force simulated gcc version
Michaël BROUTIN
2013-01-15 16:02:39 UTC
Permalink
Hi,

I'm currently trying to run gccxml against a code which has the following
defines (pseudo-code)

# if COMPILER IS GCC AND GCC VERSION > 4.3.0# define HashMap
::std::tr1::unordered_map# define HashSet
::std::tr1::unordered_set# else# define HashMap
::__gnu_cxx::hash_map# define HashSet ::__gnu_cxx::hash_set#
endif


I've read that GCCXML doesn't support ::std::tr1::unordered_map, but
in this case it's not a problem, since there's a fallback to
::__gnu_cxx::hash_map

The issue is that GCCXML fails to parse this header, because the gcc
version defined is too high, so it tries to use std::tr1.

Of course, I can hack this code to force it to use
::__gnu_cxx::hash_map, but I'd rather find a cleaner way to do this.


Is there a command line switch to force __GNUC__ and __GNUC_MINOR__ ?


Thanks,


Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gccxml.org/pipermail/gccxml/attachments/20130115/1e79b17c/attachment.htm>
Brad King
2013-01-15 16:14:40 UTC
Permalink
Post by Michaël BROUTIN
The issue is that GCCXML fails to parse this header, because the
gcc version defined is too high, so it tries to use std::tr1.
The problem is to distinguish the version of GCC being simulated
and whose interface is being preprocessed from the version of GCC
inside gccxml that is actually used to do the parsing.

Code should treat gccxml just like any other compiler and can use
the __GCCXML__ symbol to identify it. Boost does this for example:

http://svn.boost.org/svn/boost/tags/release/Boost_1_52_0/boost/config/select_compiler_config.hpp

#if defined(__GCCXML__)
// GCC-XML emulates other compilers, it has to appear first here!
# define BOOST_COMPILER_CONFIG "boost/config/compiler/gcc_xml.hpp"

-Brad

Loading...