www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Bug 130] New: Preprocessor madness with MinGW

Date: Wed, 11 Jun 2014 10:32:34 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"


            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 gdcproject.org
          Reporter: johannespfau 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':
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
to dfrontend/port.h. What do you think Iain?

You are receiving this mail because:
You are watching all bug changes.
Jun 11 2014