Re: Do the options -pedantic and -pedantic-errors mean anything to -std=iso9899:2011

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 14 Aug 2023 at 19:44, Dennis Clarke via Gcc-help
<gcc-help@xxxxxxxxxxx> wrote:
>
>
>
> I think the subject line says it all.
>
> Looking at :
>
>   https://gcc.gnu.org/onlinedocs/gcc-13.2.0/gcc/Standards.html#C-Language
>
> I see :
>
>    The original ANSI C standard (X3.159-1989) was ratified in 1989 and
>    published in 1990. This standard was ratified as an ISO standard
>    (ISO/IEC 9899:1990) later in 1990. There were no technical differences
>    between these publications, although the sections of the ANSI standard
>    were renumbered and became clauses in the ISO standard. The ANSI
>    standard, but not the ISO standard, also came with a Rationale
>    document. This standard, in both its forms, is commonly known as C89,
>    or occasionally as C90, from the dates of ratification. To select this
>    standard in GCC, use one of the options -ansi, -std=c90 or
>    -std=iso9899:1990; to obtain all the diagnostics required by the
>    standard, you should also specify -pedantic (or -pedantic-errors if
>    you want them to be errors rather than warnings). See Options
>    Controlling C Dialect.
>
>    Errors in the 1990 ISO C standard were corrected in two Technical
>    Corrigenda published in 1994 and 1996. GCC does not support the
>    uncorrected version.
>
>    An amendment to the 1990 standard was published in 1995. This
>    amendment added digraphs and __STDC_VERSION__ to the language, but
>    otherwise concerned the library. This amendment is commonly known
>    as AMD1; the amended standard is sometimes known as C94 or C95. To
>    select this standard in GCC, use the option -std=iso9899:199409 (with,
>    as for other standard versions, -pedantic to receive all required
>    diagnostics).
>
>    A new edition of the ISO C standard was published in 1999 as
>    ISO/IEC 9899:1999, and is commonly known as C99. (While in
>    development, drafts of this standard version were referred to as C9X.)
>    GCC has substantially complete support for this standard version; see
>    https://gcc.gnu.org/c99status.html for details. To select this
>    standard, use -std=c99 or -std=iso9899:1999.
>
>    Errors in the 1999 ISO C standard were corrected in three Technical
>    Corrigenda published in 2001, 2004 and 2007. GCC does not support the
>    uncorrected version.
>
>    A fourth version of the C standard, known as C11, was published
>    in 2011 as ISO/IEC 9899:2011. (While in development, drafts of this
>    standard version were referred to as C1X.) GCC has substantially
>    complete support for this standard, enabled with -std=c11 or
>    -std=iso9899:2011. A version with corrections integrated was prepared
>    in 2017 and published in 2018 as ISO/IEC 9899:2018; it is known as C17
>    and is supported with -std=c17 or -std=iso9899:2017; the corrections
>    are also applied with -std=c11, and the only difference between the
>    options is the value of __STDC_VERSION__.
>
> Looking also at :
>
>    https://gcc.gnu.org/onlinedocs/gcc-13.2.0/gcc/C-Dialect-Options.html
>
> There I see :
>
>    -std=
>
>       Determine the language standard. See Language Standards Supported
>       by GCC, for details of these standard versions. This option is
>       currently only supported when compiling C or C++.
>
> With some adjustments or tuning flags such as "-Wpedantic" for some nice
> warnings about GNU extensions.

As it says at the link below, -pedantic is the same as -Wpedantic.

>
> HOWEVER I DO NOT see the flags "-pedantic" nor "-pedantic-errors" there.
> I see some goodness documented at :
>
>    https://gcc.gnu.org/onlinedocs/gcc-13.2.0/gcc/Warning-Options.html
>
> However that page talks about ANSI C but no mention of something like
> the C11 std or others.
>
>
> So the question here is :
>
>      Do the options -pedantic and -pedantic-errors mean anything to
>      the -std=iso9899:2011 C Language spec?

Yes.

There are loads of diagnostics which are not issued for C11 without
pedantic, e.g.

enum E { e = -1u };

This will not warn for C11 unless you use -pedantic

e.c:1:14: warning: ISO C restricts enumerator values to range of ‘int’
[-Wpedantic]

-pedantic-errors will make that an error.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux