[Bug libfortran/46267] strerror() is not necessarily thread-safe

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 2 13:41:00 GMT 2010


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46267

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-11-02 13:41:10 UTC ---
Testing _GNU_SOURCE macro is not the right way to differentiate GNU vs. POSIX
2008 strerror_r, GNU version is used unless POSIX 2008 is requested without
_GNU_SOURCE.  I guess much easier would be to check the return type of
strerror_r instead.
#ifdef HAVE_STRERROR_R
if (__builtin_classify_type (strerror_r (0, NULL, 0)) == 5)
  /* GNU strerror_r */;
else
  /* POSIX strerror_r */;
#endif



More information about the Gcc-bugs mailing list