__STDC_NO_THREADS__ and late model gcc/glibc

Chris Hall gcc@gmch.uk
Thu Jun 20 11:28:00 GMT 2019

I find that gcc 4.9.0 onwards defines __STDC_NO_THREADS__ to be '1', 
denying support for <threads.h>.  Nevertheless, it does support 

As of glibc 2.28, <threads.h> appears in the library.  I guess that 
means some version of gcc will no longer set __STDC_NO_THREADS__ ?

On gcc.godbolt.org, I find that __STDC_NO_THREADS__ is defined for all 
versions up to and including the "trunk".

But on my machine, __STDC_NO_THREADS__ is no longer set by gcc v9.1.1, 
and no longer set by gcc v7.2.0 (which I just built on my machine).

I note that gcc.godbolt.org has glibc 2.27, while my machine has glibc 
2.28.  I'm guessing that something, somewhere is taking that into account.

I have looked everywhere I can think of to find where 
__STDC_NO_THREADS__ is configured... but to no avail :-(

Does anyone know what I should expect, or where I should look to find 
out, please ?



More information about the Gcc-help mailing list