diff --git a/gcc/ginclude/float.h b/gcc/ginclude/float.h index bc5439d664faa5f0f6783ebd37c65fb9243e673d..172b9de477f2066499ca8fce427d63859396f8ea 100644 --- a/gcc/ginclude/float.h +++ b/gcc/ginclude/float.h @@ -624,4 +624,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #endif /* __DEC32_MANT_DIG__ */ +#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L +#define __STDC_VERSION_FLOAT_H__ 202311L +#endif + #endif /* _FLOAT_H___ */ diff --git a/gcc/ginclude/stdarg.h b/gcc/ginclude/stdarg.h index c704c9ffcf212a83ca2f6765cf88440620649080..5149f7b3f4f65e39679780ecaf87054d69168c08 100644 --- a/gcc/ginclude/stdarg.h +++ b/gcc/ginclude/stdarg.h @@ -125,6 +125,10 @@ typedef __gnuc_va_list va_list; #endif /* not __svr4__ */ +#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L +#define __STDC_VERSION_STDARG_H__ 202311L +#endif + #endif /* _STDARG_H */ #endif /* not _ANSI_STDARG_H_ */ diff --git a/gcc/ginclude/stdatomic.h b/gcc/ginclude/stdatomic.h index a56ba5d963997de59085f8a4e6803ca7a88e7c1a..e16b072ccdef0d05fdc10a0f3454b6567305c2a3 100644 --- a/gcc/ginclude/stdatomic.h +++ b/gcc/ginclude/stdatomic.h @@ -248,4 +248,8 @@ extern void atomic_flag_clear (volatile atomic_flag *); extern void atomic_flag_clear_explicit (volatile atomic_flag *, memory_order); #define atomic_flag_clear_explicit(PTR, MO) __atomic_clear ((PTR), (MO)) +#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L +#define __STDC_VERSION_STDATOMIC_H__ 202311L +#endif + #endif /* _STDATOMIC_H */ diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h index 2767edf51def4a6121a3c162aac1208b9afbaec1..7980045e712d8bb2af9fbaf0d3883bc034f21ba5 100644 --- a/gcc/ginclude/stddef.h +++ b/gcc/ginclude/stddef.h @@ -454,6 +454,7 @@ typedef struct { #if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L #define unreachable() (__builtin_unreachable ()) +#define __STDC_VERSION_STDDEF_H__ 202311L #endif #endif /* _STDDEF_H was defined this time */ diff --git a/gcc/ginclude/stdint-gcc.h b/gcc/ginclude/stdint-gcc.h index 6be01ae28b8eb77d3fd545ad31c6575fe0049c48..eab651d968a36994a0c2bd6b4da975e852d937fb 100644 --- a/gcc/ginclude/stdint-gcc.h +++ b/gcc/ginclude/stdint-gcc.h @@ -362,4 +362,8 @@ typedef __UINTMAX_TYPE__ uintmax_t; #endif +#if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L +#define __STDC_VERSION_STDINT_H__ 202311L +#endif + #endif /* _GCC_STDINT_H */ diff --git a/gcc/glimits.h b/gcc/glimits.h index 8d74c8b88d6ba191a4a5dc377642bc6a7a0de0ee..994f7e33bbea8bb8b00068335f49d0979dc0e771 100644 --- a/gcc/glimits.h +++ b/gcc/glimits.h @@ -156,6 +156,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # define BOOL_MAX 1 # undef BOOL_WIDTH # define BOOL_WIDTH 1 + +# define __STDC_VERSION_LIMITS_H__ 202311L #endif #endif /* _LIMITS_H___ */ diff --git a/gcc/testsuite/gcc.dg/c11-float-8.c b/gcc/testsuite/gcc.dg/c11-float-8.c new file mode 100644 index 0000000000000000000000000000000000000000..7fb1e0a56833a4612771de3214c9ae06b719f1e2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-float-8.c @@ -0,0 +1,9 @@ +/* Test __STDC_VERSION_FLOAT_H__ not in C11. */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +#include <float.h> + +#ifdef __STDC_VERSION_FLOAT_H__ +#error "__STDC_VERSION_FLOAT_H__ defined" +#endif diff --git a/gcc/testsuite/gcc.dg/c11-limits-1.c b/gcc/testsuite/gcc.dg/c11-limits-1.c new file mode 100644 index 0000000000000000000000000000000000000000..6dc5737024d00f15e68c4017625a04f784db4fc7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-limits-1.c @@ -0,0 +1,9 @@ +/* Test __STDC_VERSION_LIMITS_H__ not in C11. */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +#include <limits.h> + +#ifdef __STDC_VERSION_LIMITS_H__ +#error "__STDC_VERSION_LIMITS_H__ defined" +#endif diff --git a/gcc/testsuite/gcc.dg/c11-stdarg-4.c b/gcc/testsuite/gcc.dg/c11-stdarg-4.c new file mode 100644 index 0000000000000000000000000000000000000000..06bff1f044593a4029c5ff553c9b68c69e5ec876 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-stdarg-4.c @@ -0,0 +1,9 @@ +/* Test __STDC_VERSION_STDARG_H__ not in C11. */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +#include <stdarg.h> + +#ifdef __STDC_VERSION_STDARG_H__ +#error "__STDC_VERSION_STDARG_H__ defined" +#endif diff --git a/gcc/testsuite/gcc.dg/c11-stdatomic-3.c b/gcc/testsuite/gcc.dg/c11-stdatomic-3.c new file mode 100644 index 0000000000000000000000000000000000000000..1f5a71b6219fc36e05189554dfc9338515efc666 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-stdatomic-3.c @@ -0,0 +1,9 @@ +/* Test __STDC_VERSION_STDATOMIC_H__ not in C11. */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +#include <stdatomic.h> + +#ifdef __STDC_VERSION_STDATOMIC_H__ +#error "__STDC_VERSION_STDATOMIC_H__ defined" +#endif diff --git a/gcc/testsuite/gcc.dg/c11-stddef-1.c b/gcc/testsuite/gcc.dg/c11-stddef-1.c new file mode 100644 index 0000000000000000000000000000000000000000..9918d9478c4e9a22c98189a29b550bd1930bd964 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-stddef-1.c @@ -0,0 +1,9 @@ +/* Test __STDC_VERSION_STDDEF_H__ not in C11. */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +#include <stddef.h> + +#ifdef __STDC_VERSION_STDDEF_H__ +#error "__STDC_VERSION_STDDEF_H__ defined" +#endif diff --git a/gcc/testsuite/gcc.dg/c11-stdint-1.c b/gcc/testsuite/gcc.dg/c11-stdint-1.c new file mode 100644 index 0000000000000000000000000000000000000000..43fe681c7a58815f44c24aa29877c70126b00aec --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-stdint-1.c @@ -0,0 +1,9 @@ +/* Test __STDC_VERSION_STDINT_H__ not in C11. */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c11 -pedantic-errors -ffreestanding" } */ + +#include <stdint.h> + +#ifdef __STDC_VERSION_STDINT_H__ +#error "__STDC_VERSION_STDINT_H__ defined" +#endif diff --git a/gcc/testsuite/gcc.dg/c2x-float-13.c b/gcc/testsuite/gcc.dg/c2x-float-13.c new file mode 100644 index 0000000000000000000000000000000000000000..dc54bc734b3705df829ce8a6c5a26ce3c2d68372 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-float-13.c @@ -0,0 +1,13 @@ +/* Test __STDC_VERSION_FLOAT_H__ in C2x. */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +#include <float.h> + +#ifndef __STDC_VERSION_FLOAT_H__ +#error "__STDC_VERSION_FLOAT_H__ not defined" +#endif + +#if __STDC_VERSION_FLOAT_H__ != 202311L +#error "bad value of __STDC_VERSION_FLOAT_H__" +#endif diff --git a/gcc/testsuite/gcc.dg/c2x-limits-1.c b/gcc/testsuite/gcc.dg/c2x-limits-1.c new file mode 100644 index 0000000000000000000000000000000000000000..4977faf47b467d5f21458ee16afadffddaaa4f9d --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-limits-1.c @@ -0,0 +1,13 @@ +/* Test __STDC_VERSION_LIMITS_H__ in C2x. */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +#include <limits.h> + +#ifndef __STDC_VERSION_LIMITS_H__ +#error "__STDC_VERSION_LIMITS_H__ not defined" +#endif + +#if __STDC_VERSION_LIMITS_H__ != 202311L +#error "bad value of __STDC_VERSION_LIMITS_H__" +#endif diff --git a/gcc/testsuite/gcc.dg/c2x-stdarg-5.c b/gcc/testsuite/gcc.dg/c2x-stdarg-5.c new file mode 100644 index 0000000000000000000000000000000000000000..134244357bbc5139ee0b2025bae160c4b81383c3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-stdarg-5.c @@ -0,0 +1,13 @@ +/* Test __STDC_VERSION_STDARG_H__ in C2x. */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +#include <stdarg.h> + +#ifndef __STDC_VERSION_STDARG_H__ +#error "__STDC_VERSION_STDARG_H__ not defined" +#endif + +#if __STDC_VERSION_STDARG_H__ != 202311L +#error "bad value of __STDC_VERSION_STDARG_H__" +#endif diff --git a/gcc/testsuite/gcc.dg/c2x-stdatomic-1.c b/gcc/testsuite/gcc.dg/c2x-stdatomic-1.c new file mode 100644 index 0000000000000000000000000000000000000000..3a9ceb0ea398fed77cb745169dd243f807fbfa62 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-stdatomic-1.c @@ -0,0 +1,13 @@ +/* Test __STDC_VERSION_STDATOMIC_H__ in C2x. */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +#include <stdatomic.h> + +#ifndef __STDC_VERSION_STDATOMIC_H__ +#error "__STDC_VERSION_STDATOMIC_H__ not defined" +#endif + +#if __STDC_VERSION_STDATOMIC_H__ != 202311L +#error "bad value of __STDC_VERSION_STDATOMIC_H__" +#endif diff --git a/gcc/testsuite/gcc.dg/c2x-stddef-1.c b/gcc/testsuite/gcc.dg/c2x-stddef-1.c new file mode 100644 index 0000000000000000000000000000000000000000..1ebdf2037ee7d66ec8311afbe9e2d3bab870ff31 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-stddef-1.c @@ -0,0 +1,13 @@ +/* Test __STDC_VERSION_STDDEF_H__ in C2x. */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +#include <stddef.h> + +#ifndef __STDC_VERSION_STDDEF_H__ +#error "__STDC_VERSION_STDDEF_H__ not defined" +#endif + +#if __STDC_VERSION_STDDEF_H__ != 202311L +#error "bad value of __STDC_VERSION_STDDEF_H__" +#endif diff --git a/gcc/testsuite/gcc.dg/c2x-stdint-1.c b/gcc/testsuite/gcc.dg/c2x-stdint-1.c new file mode 100644 index 0000000000000000000000000000000000000000..3ba6ce56a7aba511d1f161b124ec5a622c474760 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c2x-stdint-1.c @@ -0,0 +1,13 @@ +/* Test __STDC_VERSION_STDINT_H__ in C2x. */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c2x -pedantic-errors -ffreestanding" } */ + +#include <stdint.h> + +#ifndef __STDC_VERSION_STDINT_H__ +#error "__STDC_VERSION_STDINT_H__ not defined" +#endif + +#if __STDC_VERSION_STDINT_H__ != 202311L +#error "bad value of __STDC_VERSION_STDINT_H__" +#endif