Compile error: function name collisions between port.h and math.h?

mpb mpb.mail at gmail.com
Wed Apr 4 19:54:43 PDT 2007


Hi,

I get a compile error when I try to compile GDC 0.23 against GCC
4.0.1, 4.0.4, 4.1.1 or 4.1.2.

./gcc/d/dmd/port.h:37: error: expected unqualified-id before 'sizeof'
./gcc/d/dmd/port.h:37: error: expected `)' before 'sizeof'
./gcc/d/dmd/port.h:38: error: expected unqualified-id before 'sizeof'
./gcc/d/dmd/port.h:38: error: expected `)' before 'sizeof'
./gcc/d/dmd/port.h:40: error: expected unqualified-id before 'sizeof'
./gcc/d/dmd/port.h:40: error: expected `)' before 'sizeof'

GCC (without D) compiles fine.  I'm running on Linux 2.6.12 with glibc
2.4 and compiling with GCC 4.1.1.

port.h lines 37 through 40 are part of the declaration of struct Port:

    static int isnan(double);
    static int isfinite(double);
    static int isinfinity(double);
    static int signbit(double);

It is interesting that line 39, while very similar, does not generate
an error.

The command that causes the error is:

c++   -O2 -march=i686 -fomit-frame-pointer -pipe -DIN_GCC   -W -Wall
-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes     -DHAVE_CONFIG_H
-I. -Id -I/home/zu20070220/Files/Compile/Sources/gcc-4.0.4/./gcc
-I/home/zu20070220/Files/Compile/Sources/gcc-4.0.4/./gcc/d
-I/home/zu20070220/Files/Compile/Sources/gcc-4.0.4/./gcc/../include
-I/home/zu20070220/Files/Compile/Sources/gcc-4.0.4/./gcc/../libcpp/include
 -Id -I/home/zu20070220/Files/Compile/Sources/gcc-4.0.4/./gcc/d/dmd
-I/home/zu20070220/Files/Compile/Sources/gcc-4.0.4/./gcc/d -D_GNU_SOURCE=1
-D_DH=1 -DD_NO_TRAMPOLINES=1 -DELFOBJ=1 -DD_GCC_VER=40 -Wno-missing-braces
-fmessage-length=0 -include
/home/zu20070220/Files/Compile/Sources/gcc-4.0.4/./gcc/d/dmd/total.h -o
d/expression.dmd.o -c
/home/zu20070220/Files/Compile/Sources/gcc-4.0.4/./gcc/d/dmd/expression.c

The command also generates approximately 180 warnings.

The errors might be due to collisions with similarly named functions
in math.h.

Any help resolving the problem would be appreciated.

Thanks!

-mpb


More information about the D.gnu mailing list