[GCC-XML] Forward declarations

Fraser Hanson hansf10 at telus.net
Wed Jun 16 21:00:57 EDT 2004


gccxml by default doesn't seem to work when the C source includes 
forward declarations.  After some googling and playing with the command 
line options, I can't seem to find a solution to this.  How can I make 
this work?

[fraser at albus:~/work]$ cat test.c
/* static forward declaration */
static char* a;
static char* a = 0;

[fraser at albus:~/work]$ gcc-2.95 -c test.c

[fraser at albus:~/work]$ gcc-3.3 -c test.c

[fraser at albus:~/work]$ gccxml test.c
test.c:3: error: redefinition of `char*a'
test.c:2: error: `char*a' previously declared here

[fraser at albus:~/work]$ gccxml test.c --print
GCC-XML version 0.6.0
Configuration settings:
   GCCXML_CONFIG="/usr/local/share/gccxml-0.6/gccxml_config"
   GCCXML_COMPILER="g++"
   GCCXML_CXXFLAGS=""
   GCCXML_EXECUTABLE="/usr/local/bin/gccxml_cc1plus"
   GCCXML_CPP="/usr/local/bin/gccxml_cc1plus"
   GCCXML_FLAGS="-D__HAVE_BUILTIN_SETJMP__=1 -D__unix__=1 -Dunix=1 
-D__i386__=1 -D__SIZE_TYPE__=unsigned int -D__ELF__=1 
-D__GNUC_PATCHLEVEL__=3 -D__linux=1 -D__unix=1 -D__linux__=1 
-D__USER_LABEL_PREFIX__= -Dlinux=1 -D__STDC_HOSTED__=1 -D__EXCEPTIONS=1 
-D__GXX_WEAK__=1 -D__WCHAR_TYPE__=long int -D__gnu_linux__=1 
-D__WINT_TYPE__=unsigned int -D__GNUC__=3 -D__cplusplus=1 
-D__DEPRECATED=1 -D__GNUG__=3 -D__GXX_ABI_VERSION=102 -Di386=1 
-D__GNUC_MINOR__=2 -D__STDC__=1 -D__PTRDIFF_TYPE__=int -D__tune_i386__=1 
-D__REGISTER_PREFIX__= -D__NO_INLINE__=1 -D_GNU_SOURCE=1 -D__i386=1 
-D__VERSION__="3.2.3 (Debian)" -D__declspec(x)= -D__attribute__(x)= 
-I/usr/include/c++/3.2 -I/usr/include/c++/3.2/i386-linux 
-I/usr/include/c++/3.2/backward -I/usr/local/include 
-I/usr/lib/gcc-lib/i386-linux/3.2.3/include -I/usr/include "
   GCCXML_USER_FLAGS=""
   GCCXML_ROOT="/usr/local/share/gccxml-0.6"

--Fraser



More information about the gccxml mailing list