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

closed-accepted
2008-03-19
2008-02-28
Joseph Myers
No

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

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.

Discussion

  • Joseph Myers
    Joseph Myers
    2008-02-28

     
    Attachments
  • Danny Smith
    Danny Smith
    2008-03-03

    Logged In: YES
    user_id=11494
    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.

    Danny

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

    Applied to CVS, thank you for the patch!

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