[Issue 1098] New: symbol collision in d/dmd/expression.c between math.h and port.h

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 5 14:09:52 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1098

           Summary: symbol collision in d/dmd/expression.c between math.h
                    and port.h
           Product: DGCC aka GDC
           Version: 0.23
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: glue layer
        AssignedTo: dvdfrdmn at users.sf.net
        ReportedBy: mpb.mail at gmail.com


d/dmd/expression.c includes math.h and port.h in that order.

math.h defines macros for:

isnan
isfinite
signbit

port.h then declares a struct with:

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

The macros collide with the names in the struct declaration, causing a fatal
compile time error.

A kludge (that seems to work) is to change expression.c to include port.h
*before* math.h.

A clean long term solution is either:

a) make sure no file ever includes both math.h and port.h (this is probably
impractical) or...

b) rename the offending names in port.h (and everywhere that refers to them)

I am not sure if this bug should be fixed in DGCC or upstream in the DMD
compiler sources.

Thanks!

-mpb


-- 



More information about the D.gnu mailing list