#355 Don't condition complex.h contents (fixes libstdc++ tests)

Joseph Myers

MinGW <complex.h> has all its contents conditional on (defined
(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined

Since <complex.h> is a C99 header, C90 has nothing to say about what
happens if you include <complex.h> in a strict C90 compilation, so
there is no need for such a conditional. There is also a pragmatic
reason not to have such a conditional. GCC enables use of various C99
features in libstdc++ only if several different pieces of C99 support
are detected in the C headers, and this conditional means that
<complex.h> support is detected as missing (the tests deliberately use
-std=c++98 to ensure __STRICT_ANSI__ is defined) while all the other
pieces are present. The missing complex support means libstdc++ does
not use snprintf, which means it tries to use Windows printf support
directly to print long doubles. Thus a patch such as this fixes
several libstdc++ test failures involving long doubles by allowing
libstdc++ to use C99 support from libc (and so to use MinGW's fixed
snprintf). This is of course a lot simpler than making libstdc++
support using more partial subsets of C99 support on targets where
only part of the support is present.


  • Joseph Myers
    Joseph Myers

  • Danny Smith
    Danny Smith

    Logged In: YES
    Originator: NO

    I cannot approve this patch, but I can confirm that it does fix the libstdc++ test failures as advertised and recommend that it is applied.


    • assigned_to: nobody --> ir0nh34d
    • status: open --> open-accepted
  • Logged In: YES
    Originator: NO

    Applied to CVS, thank you for the patch!

    • status: open-accepted --> closed-accepted