On Thu, Aug 14, 2025, 10:08 Jan Beulich <jbeul...@suse.com> wrote:

> On 13.08.2025 21:12, nicola.vetr...@gmail.com wrote:
> > From: Nicola Vetrini <nicola.vetr...@gmail.com>
> >
> > The toolchain baseline for GCC is 5.1, which supports _Static_assert
> > in c99 mode
>
> Hmm, interesting. I can confirm the behavior, but isn't this a bug?
> There's no
> _Static_assert() in plain C99. Respective notes in the "Changes, New
> Features,
> and Fixes" are also saying otherwise:
> https://gcc.gnu.org/gcc-4.6/changes.html
> has "This support may be selected with -std=c1x, or -std=gnu1x for C1X with
> GNU extensions." Nothing new is said in any of the respective documents up
> to
> the release of gcc5. (In fact, the compiler accepts the construct even with
> -std=c89.)
>

 Some features that are part of the C99 standard are accepted as extensions
in C90 mode, and some features that are part of the C11 standard are
accepted as extensions in C90 and C99 modes. Use of the -std options listed
above disables these extensions where they conflict with the C standard
version selected

If my reading is correct then this paragraph gives them the leeway needed
to use it even in c89, except maybe with -pedantic


> Our misra/C-language-toolchain.rst refers to a section in gcc12's doc which
> doesn't mention _Static_assert() at all, afaics.
>
> Jan
>

I can check with my colleagues, but I suspect this is not documented as an
extension by GCC because it's not one in C11, and gcc12 supports all(?) of
C11, therefore it is an extension only with respect to certain conditions,
which GCC does not use as a category in their docs, but we keep track of
what is an extension and what is not, given the CU standard selected.

>

Reply via email to