public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/29132] New: If <stdc-predef.h> is not preincluded, then #define __STDC_xxx violate C11 6.10.8
@ 2022-05-09 10:58 pavel.morozkin at gmail dot com
  2022-05-09 11:31 ` [Bug libc/29132] " fweimer at redhat dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: pavel.morozkin at gmail dot com @ 2022-05-09 10:58 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29132

            Bug ID: 29132
           Summary: If <stdc-predef.h> is not preincluded, then #define
                    __STDC_xxx violate C11 6.10.8
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: pavel.morozkin at gmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

If <stdc-predef.h> is not preincluded, then #define __STDC_xxx violate C11
6.10.8.

In GCC the <stdc-predef.h> is preincluded => OK.
In Clang the <stdc-predef.h> is not preincluded => not OK (see
https://github.com/llvm/llvm-project/issues/53132).

Relevant quotes:
C11, 6.10.8 Predefined macro names:
> None of these macro names, nor the identifier defined, shall be the subject of a
> #define or a #undef preprocessing directive.
> The values of the predefined macros listed in the following subclauses176) (except for
> _ _FILE_ _ and _ _LINE_ _) remain constant throughout the translation unit.

Consider fixing.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libc/29132] If <stdc-predef.h> is not preincluded, then #define __STDC_xxx violate C11 6.10.8
  2022-05-09 10:58 [Bug libc/29132] New: If <stdc-predef.h> is not preincluded, then #define __STDC_xxx violate C11 6.10.8 pavel.morozkin at gmail dot com
@ 2022-05-09 11:31 ` fweimer at redhat dot com
  2022-05-09 11:49 ` schwab@linux-m68k.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: fweimer at redhat dot com @ 2022-05-09 11:31 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29132

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |WAITING
                 CC|                            |fweimer at redhat dot com
   Last reconfirmed|                            |2022-05-09

--- Comment #1 from Florian Weimer <fweimer at redhat dot com> ---
I'm not sure what you expect glibc to do here. I think these constants must
become available without including anything, so this needs compiler support.
GCC provides this with the pre-include mechanism.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libc/29132] If <stdc-predef.h> is not preincluded, then #define __STDC_xxx violate C11 6.10.8
  2022-05-09 10:58 [Bug libc/29132] New: If <stdc-predef.h> is not preincluded, then #define __STDC_xxx violate C11 6.10.8 pavel.morozkin at gmail dot com
  2022-05-09 11:31 ` [Bug libc/29132] " fweimer at redhat dot com
@ 2022-05-09 11:49 ` schwab@linux-m68k.org
  2022-05-09 16:43 ` pavel.morozkin at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: schwab@linux-m68k.org @ 2022-05-09 11:49 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29132

--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> ---
<stdc-predef.h> is part of the implementation, so it is not subject to 6.10.8.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libc/29132] If <stdc-predef.h> is not preincluded, then #define __STDC_xxx violate C11 6.10.8
  2022-05-09 10:58 [Bug libc/29132] New: If <stdc-predef.h> is not preincluded, then #define __STDC_xxx violate C11 6.10.8 pavel.morozkin at gmail dot com
  2022-05-09 11:31 ` [Bug libc/29132] " fweimer at redhat dot com
  2022-05-09 11:49 ` schwab@linux-m68k.org
@ 2022-05-09 16:43 ` pavel.morozkin at gmail dot com
  2022-05-09 18:54 ` joseph at codesourcery dot com
  2022-05-10 19:28 ` pavel.morozkin at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: pavel.morozkin at gmail dot com @ 2022-05-09 16:43 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29132

--- Comment #3 from Pavel M <pavel.morozkin at gmail dot com> ---
>From glibc-2.31 (the latest one probably is the same):
stdio.h:
#include <libio/stdio.h>

libio/stdio.h:
#include <bits/libc-header-start.h>

bits/libc-header-start.h:
#include <features.h>

features.h:
#include <stdc-predef.h>

stdc-predef.h:
#define __STDC_IEC_559__                1
#define __STDC_IEC_559_COMPLEX__        1
#define __STDC_ISO_10646__              201706L

Here we see that an implementation, which does not preinclude <stdc-predef.h>,
defines __STDC_xxx, which violates C11 6.10.8.

Example:
//__STDC_xxx is not defined
#include <stdio.h>
//__STDC_xxx is defined

Here we see that the values of the predefined macros do not remain constant
throughout the translation unit.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libc/29132] If <stdc-predef.h> is not preincluded, then #define __STDC_xxx violate C11 6.10.8
  2022-05-09 10:58 [Bug libc/29132] New: If <stdc-predef.h> is not preincluded, then #define __STDC_xxx violate C11 6.10.8 pavel.morozkin at gmail dot com
                   ` (2 preceding siblings ...)
  2022-05-09 16:43 ` pavel.morozkin at gmail dot com
@ 2022-05-09 18:54 ` joseph at codesourcery dot com
  2022-05-10 19:28 ` pavel.morozkin at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: joseph at codesourcery dot com @ 2022-05-09 18:54 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29132

--- Comment #4 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
The purpose of the <stdc-predef.h> feature, added in coordination between 
GCC and glibc, is to support that standard requirement in the combined 
implementation.  If you use a compiler without support for that feature, 
you're getting exactly what should be expected.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libc/29132] If <stdc-predef.h> is not preincluded, then #define __STDC_xxx violate C11 6.10.8
  2022-05-09 10:58 [Bug libc/29132] New: If <stdc-predef.h> is not preincluded, then #define __STDC_xxx violate C11 6.10.8 pavel.morozkin at gmail dot com
                   ` (3 preceding siblings ...)
  2022-05-09 18:54 ` joseph at codesourcery dot com
@ 2022-05-10 19:28 ` pavel.morozkin at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: pavel.morozkin at gmail dot com @ 2022-05-10 19:28 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=29132

--- Comment #5 from Pavel M <pavel.morozkin at gmail dot com> ---
The users expect the absence of C standard violations. The "non-GCC with glibc"
developers very probably don't know that <stdc-predef.h> needs to be
preincluded. Consider at least documenting it in "using glibc with non-GCC" (or
other similar) guide.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-05-10 19:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09 10:58 [Bug libc/29132] New: If <stdc-predef.h> is not preincluded, then #define __STDC_xxx violate C11 6.10.8 pavel.morozkin at gmail dot com
2022-05-09 11:31 ` [Bug libc/29132] " fweimer at redhat dot com
2022-05-09 11:49 ` schwab@linux-m68k.org
2022-05-09 16:43 ` pavel.morozkin at gmail dot com
2022-05-09 18:54 ` joseph at codesourcery dot com
2022-05-10 19:28 ` pavel.morozkin at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).