[Bug 130] New: Preprocessor madness with MinGW

via D.gnu d.gnu at puremagic.com
Wed Jun 11 02:32:34 PDT 2014


http://bugzilla.gdcproject.org/show_bug.cgi?id=130

            Bug ID: 130
           Summary: Preprocessor madness with MinGW
           Product: GDC
           Version: 4.9.x
          Hardware: All
                OS: MinGW
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: gdc
          Assignee: ibuclaw at gdcproject.org
          Reporter: johannespfau at gmail.com

I'm updating the binary builds to GCC 4.9 right now and found a weird new bug:
I had to update the mingw64 headers and they now
#define strtod __strtod
in stdlib.h (or maybe they always did and the problem didn't show for some
reason, I don't know).

As a result, our 'Port::strtod' is hijacked into 'Port::__strtod'. So far, no
real problem. But it seems d-port.cc does not include the stdlib.h header so
the define is not effective there. As a result I get this link error when
linking cc1d:

------------------
d/lexer.dmd.o: In function `ZN5Lexer6inrealEP5Token':
/home/build/tmp/i686-w64-mingw32/.build/src/gcc-4.9.0/gcc/d/dfrontend/lexer.c:2360:
undefined reference to `Port::__strtod(char const*, char**)'
collect2: error: ld returned 1 exit status

i686-gdcproject-mingw32-nm d/lexer.dmd.o | grep strto
         U __ZN4Port6strtofEPKcPPc
         U __ZN4Port7strtoldEPKcPPc
         U __ZN4Port8__strtodEPKcPPc

i686-gdcproject-mingw32-nm d/d-port.glue.o | grep strto
00000404 T __ZN4Port6strtodEPKcPPc
0000038a T __ZN4Port6strtofEPKcPPc
0000047e T __ZN4Port7strtoldEPKcPPc

------------------

I propose adding
------------------
// MinGWs stdlib.h defines strtod to __strtod.
// Depending on whether this header is included our function name changes...
#ifdef strtod
    #undef strtod
#endif
------------------
to dfrontend/port.h. What do you think Iain?

-- 
You are receiving this mail because:
You are watching all bug changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/d.gnu/attachments/20140611/05164722/attachment.html>


More information about the D.gnu mailing list