cc std=c11 breakage in Fedora 21

Eric Blake eblake at redhat.com
Fri Oct 10 20:57:55 UTC 2014


On 10/10/2014 02:37 PM, Chuck Forsberg WA7KGX wrote:
> 
> On 10/10/2014 07:45 AM, Jakub Jelinek wrote:
>> On Fri, Oct 10, 2014 at 07:23:02AM -0700, Chuck Forsberg WA7KGX wrote:
>>> Why does this program fragment fail to compile if a C standard
>>> is specified?  I compiles without complaint with a simple cc -c qq.c
>> You chose a strict conformance mode, in which sys/stat.h doesn't provide
>> those.  You need either -D_XOPEN_SOURCE, -D_GNU_SOURCE, -D_DEFALT_SOURCE
>> etc. feature test macros (see info libc on it), or -std=gnu11 (or
>> -std=gnu99, -std=gnu89 etc.).
>>
>>     Jakub
> Where is S_IFMT et al. defined in strict conformance mode?

No where.  C does not define S_IFMT, so strict conformance means
limiting yourself to the symbols defined by C, therefore attempting to
use something the standard does not call out should be an error, as you
found out.

> Why not in sys/stat.h?

Because in strict conformance mode, sys/stat.h must not pollute the
environment.  You usually DON'T want to compile in strict conformance
mode, if you have any likelihood of using extensions.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 539 bytes
Desc: OpenPGP digital signature
URL: <http://lists.fedoraproject.org/pipermail/test/attachments/20141010/99b5fac4/attachment.sig>


More information about the test mailing list