From 7faffbc4be05ee2e161f78d830b143236e99f2ca Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Tue, 22 Oct 2013 16:56:06 +0000 Subject: Rename c1x-*.c to c11-*.c. From-SVN: r203929 --- gcc/testsuite/gcc.dg/c11-align-1.c | 41 +++++++ gcc/testsuite/gcc.dg/c11-align-2.c | 92 ++++++++++++++++ gcc/testsuite/gcc.dg/c11-align-3.c | 43 ++++++++ gcc/testsuite/gcc.dg/c11-align-4.c | 9 ++ gcc/testsuite/gcc.dg/c11-align-5.c | 20 ++++ gcc/testsuite/gcc.dg/c11-anon-struct-1.c | 72 ++++++++++++ gcc/testsuite/gcc.dg/c11-anon-struct-2.c | 57 ++++++++++ gcc/testsuite/gcc.dg/c11-anon-struct-3.c | 34 ++++++ gcc/testsuite/gcc.dg/c11-float-1.c | 169 +++++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/c11-noreturn-1.c | 59 ++++++++++ gcc/testsuite/gcc.dg/c11-noreturn-2.c | 77 +++++++++++++ gcc/testsuite/gcc.dg/c11-noreturn-3.c | 11 ++ gcc/testsuite/gcc.dg/c11-noreturn-4.c | 11 ++ gcc/testsuite/gcc.dg/c11-noreturn-5.c | 17 +++ gcc/testsuite/gcc.dg/c11-pointer-float-1.c | 28 +++++ gcc/testsuite/gcc.dg/c11-static-assert-1.c | 41 +++++++ gcc/testsuite/gcc.dg/c11-static-assert-2.c | 41 +++++++ gcc/testsuite/gcc.dg/c11-static-assert-3.c | 28 +++++ gcc/testsuite/gcc.dg/c11-static-assert-4.c | 13 +++ gcc/testsuite/gcc.dg/c11-static-assert-5.c | 5 + gcc/testsuite/gcc.dg/c11-static-assert-6.c | 5 + gcc/testsuite/gcc.dg/c11-typedef-1.c | 70 ++++++++++++ gcc/testsuite/gcc.dg/c11-uni-string-1.c | 112 +++++++++++++++++++ gcc/testsuite/gcc.dg/c11-uni-string-2.c | 8 ++ gcc/testsuite/gcc.dg/c1x-align-1.c | 41 ------- gcc/testsuite/gcc.dg/c1x-align-2.c | 92 ---------------- gcc/testsuite/gcc.dg/c1x-align-3.c | 43 -------- gcc/testsuite/gcc.dg/c1x-align-4.c | 9 -- gcc/testsuite/gcc.dg/c1x-align-5.c | 20 ---- gcc/testsuite/gcc.dg/c1x-anon-struct-1.c | 72 ------------ gcc/testsuite/gcc.dg/c1x-anon-struct-2.c | 57 ---------- gcc/testsuite/gcc.dg/c1x-anon-struct-3.c | 34 ------ gcc/testsuite/gcc.dg/c1x-float-1.c | 169 ----------------------------- gcc/testsuite/gcc.dg/c1x-noreturn-1.c | 59 ---------- gcc/testsuite/gcc.dg/c1x-noreturn-2.c | 77 ------------- gcc/testsuite/gcc.dg/c1x-noreturn-3.c | 11 -- gcc/testsuite/gcc.dg/c1x-noreturn-4.c | 11 -- gcc/testsuite/gcc.dg/c1x-noreturn-5.c | 17 --- gcc/testsuite/gcc.dg/c1x-pointer-float-1.c | 28 ----- gcc/testsuite/gcc.dg/c1x-static-assert-1.c | 41 ------- gcc/testsuite/gcc.dg/c1x-static-assert-2.c | 41 ------- gcc/testsuite/gcc.dg/c1x-static-assert-3.c | 28 ----- gcc/testsuite/gcc.dg/c1x-static-assert-4.c | 13 --- gcc/testsuite/gcc.dg/c1x-static-assert-5.c | 5 - gcc/testsuite/gcc.dg/c1x-static-assert-6.c | 5 - gcc/testsuite/gcc.dg/c1x-typedef-1.c | 70 ------------ gcc/testsuite/gcc.dg/c1x-uni-string-1.c | 112 ------------------- gcc/testsuite/gcc.dg/c1x-uni-string-2.c | 8 -- 48 files changed, 1063 insertions(+), 1063 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/c11-align-1.c create mode 100644 gcc/testsuite/gcc.dg/c11-align-2.c create mode 100644 gcc/testsuite/gcc.dg/c11-align-3.c create mode 100644 gcc/testsuite/gcc.dg/c11-align-4.c create mode 100644 gcc/testsuite/gcc.dg/c11-align-5.c create mode 100644 gcc/testsuite/gcc.dg/c11-anon-struct-1.c create mode 100644 gcc/testsuite/gcc.dg/c11-anon-struct-2.c create mode 100644 gcc/testsuite/gcc.dg/c11-anon-struct-3.c create mode 100644 gcc/testsuite/gcc.dg/c11-float-1.c create mode 100644 gcc/testsuite/gcc.dg/c11-noreturn-1.c create mode 100644 gcc/testsuite/gcc.dg/c11-noreturn-2.c create mode 100644 gcc/testsuite/gcc.dg/c11-noreturn-3.c create mode 100644 gcc/testsuite/gcc.dg/c11-noreturn-4.c create mode 100644 gcc/testsuite/gcc.dg/c11-noreturn-5.c create mode 100644 gcc/testsuite/gcc.dg/c11-pointer-float-1.c create mode 100644 gcc/testsuite/gcc.dg/c11-static-assert-1.c create mode 100644 gcc/testsuite/gcc.dg/c11-static-assert-2.c create mode 100644 gcc/testsuite/gcc.dg/c11-static-assert-3.c create mode 100644 gcc/testsuite/gcc.dg/c11-static-assert-4.c create mode 100644 gcc/testsuite/gcc.dg/c11-static-assert-5.c create mode 100644 gcc/testsuite/gcc.dg/c11-static-assert-6.c create mode 100644 gcc/testsuite/gcc.dg/c11-typedef-1.c create mode 100644 gcc/testsuite/gcc.dg/c11-uni-string-1.c create mode 100644 gcc/testsuite/gcc.dg/c11-uni-string-2.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-align-1.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-align-2.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-align-3.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-align-4.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-align-5.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-anon-struct-1.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-anon-struct-2.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-anon-struct-3.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-float-1.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-noreturn-1.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-noreturn-2.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-noreturn-3.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-noreturn-4.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-noreturn-5.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-pointer-float-1.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-static-assert-1.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-static-assert-2.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-static-assert-3.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-static-assert-4.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-static-assert-5.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-static-assert-6.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-typedef-1.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-uni-string-1.c delete mode 100644 gcc/testsuite/gcc.dg/c1x-uni-string-2.c (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/c11-align-1.c b/gcc/testsuite/gcc.dg/c11-align-1.c new file mode 100644 index 0000000..e0058c3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-align-1.c @@ -0,0 +1,41 @@ +/* Test C11 alignment support. Test valid code. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +#include + +_Alignas (_Alignof (max_align_t)) char c; +extern _Alignas (max_align_t) char c; +extern char c; + +extern _Alignas (max_align_t) short s; +_Alignas (max_align_t) short s; + +_Alignas (int) int i; +extern int i; + +_Alignas (max_align_t) long l; + +_Alignas (max_align_t) long long ll; + +_Alignas (max_align_t) float f; + +_Alignas (max_align_t) double d; + +_Alignas (max_align_t) _Complex long double cld; + +_Alignas (0) _Alignas (int) _Alignas (char) char ca[10]; + +_Alignas ((int) _Alignof (max_align_t) + 0) int x; + +enum e { E = _Alignof (max_align_t) }; +_Alignas (E) int y; + +void +func (void) +{ + _Alignas (max_align_t) long long auto_ll; +} + +/* Valid, but useless. */ +_Alignas (0) struct s; /* { dg-warning "useless" } */ diff --git a/gcc/testsuite/gcc.dg/c11-align-2.c b/gcc/testsuite/gcc.dg/c11-align-2.c new file mode 100644 index 0000000..a1750ac --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-align-2.c @@ -0,0 +1,92 @@ +/* Test C11 alignment support. Test valid code using stdalign.h. */ +/* { dg-do run } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +#include +#include + +extern int strcmp (const char *, const char *); + +extern void exit (int); +extern void abort (void); + +alignas (alignof (max_align_t)) char c; +extern alignas (max_align_t) char c; +extern char c; + +extern alignas (max_align_t) short s; +alignas (max_align_t) short s; + +alignas (int) int i; +extern int i; + +alignas (max_align_t) long l; + +alignas (max_align_t) long long ll; + +alignas (max_align_t) float f; + +alignas (max_align_t) double d; + +alignas (max_align_t) _Complex long double cld; + +alignas (0) alignas (int) alignas (char) char ca[10]; + +alignas ((int) alignof (max_align_t) + 0) int x; + +enum e { E = alignof (max_align_t) }; +alignas (E) int y; + +void +func (void) +{ + alignas (max_align_t) long long auto_ll; +} + +/* Valid, but useless. */ +alignas (0) struct s; /* { dg-warning "useless" } */ + +#ifndef alignas +#error "alignas not defined" +#endif + +#ifndef alignof +#error "alignof not defined" +#endif + +#ifndef __alignas_is_defined +#error "__alignas_is_defined not defined" +#endif + +#if __alignas_is_defined != 1 +#error "__alignas_is_defined not 1" +#endif + +#ifndef __alignof_is_defined +#error "__alignof_is_defined not defined" +#endif + +#if __alignof_is_defined != 1 +#error "__alignof_is_defined not 1" +#endif + +#define str(x) #x +#define xstr(x) str(x) + +const char *s1 = xstr(alignas); +const char *s2 = xstr(alignof); +const char *s3 = xstr(__alignas_is_defined); +const char *s4 = xstr(__alignof_is_defined); + +int +main (void) +{ + if (strcmp (s1, "_Alignas") != 0) + abort (); + if (strcmp (s2, "_Alignof") != 0) + abort (); + if (strcmp (s3, "1") != 0) + abort (); + if (strcmp (s4, "1") != 0) + abort (); +} diff --git a/gcc/testsuite/gcc.dg/c11-align-3.c b/gcc/testsuite/gcc.dg/c11-align-3.c new file mode 100644 index 0000000..39b81ef --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-align-3.c @@ -0,0 +1,43 @@ +/* Test C11 alignment support. Test invalid code. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +int a = _Alignof (void (void)); /* { dg-error "function" } */ +struct s; +int b = _Alignof (struct s); /* { dg-error "incomplete" } */ +int c = _Alignof (void); /* { dg-error "void" } */ +int d = _Alignof (a); /* { dg-error "expression" } */ + +_Alignas (void (void)) char e; /* { dg-error "function" } */ +_Alignas (struct s) char f; /* { dg-error "incomplete" } */ +_Alignas (void) char g; /* { dg-error "void" } */ + +_Alignas (-__INT_MAX__-1) char h; /* { dg-error "too large|power of 2" } */ +_Alignas (-__INT_MAX__) char h2; /* { dg-error "too large|power of 2" } */ +_Alignas ((-__INT_MAX__-1)/2) char h3; /* { dg-error "too large|power of 2" } */ +_Alignas ((-__INT_MAX__-1)/4) char h4; /* { dg-error "too large|power of 2" } */ +_Alignas ((-__INT_MAX__-1)/8) char h5; /* { dg-error "too large|power of 2" } */ +_Alignas (-__LONG_LONG_MAX__-1) char i; /* { dg-error "too large|power of 2" } */ +_Alignas (-(__LONG_LONG_MAX__-1)/2) char i2; /* { dg-error "too large|power of 2" } */ +_Alignas (-(__LONG_LONG_MAX__-1)/4) char i3; /* { dg-error "too large|power of 2" } */ +_Alignas (-(__LONG_LONG_MAX__-1)/8) char i4; /* { dg-error "too large|power of 2" } */ +_Alignas (-(__LONG_LONG_MAX__-1)/16) char i5; /* { dg-error "too large|power of 2" } */ +_Alignas (-1) char j; /* { dg-error "power of 2" } */ +_Alignas (-2) char j; /* { dg-error "positive power of 2" } */ +_Alignas (3) char k; /* { dg-error "power of 2" } */ + +_Alignas ((void *) 1) char k; /* { dg-error "integer constant" } */ +int x; +_Alignas (x) char l; /* { dg-error "integer constant" } */ + +_Alignas (0) struct s; /* { dg-error "does not redeclare tag" } */ + +_Alignas (0) typedef int T; /* { dg-error "alignment specified for typedef" } */ +void func (_Alignas (0) int); /* { dg-error "alignment specified for unnamed parameter" } */ +void f2 (_Alignas (0) int parm2) {} /* { dg-error "alignment specified for parameter" } */ +void +f3 (void) +{ + register _Alignas (0) int reg; /* { dg-error "register" } */ +} +_Alignas (0) void f4 (void); /* { dg-error "alignment specified for function" } */ diff --git a/gcc/testsuite/gcc.dg/c11-align-4.c b/gcc/testsuite/gcc.dg/c11-align-4.c new file mode 100644 index 0000000..6377db6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-align-4.c @@ -0,0 +1,9 @@ +/* Test C11 alignment support. Test reducing alignment (assumes there + are at least some alignment constraints). */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ +/* { dg-skip-if "no alignment constraints" { "avr-*-*" } { "*" } { "" } } */ + +#include + +_Alignas (_Alignof (char)) max_align_t x; /* { dg-error "reduce alignment" } */ diff --git a/gcc/testsuite/gcc.dg/c11-align-5.c b/gcc/testsuite/gcc.dg/c11-align-5.c new file mode 100644 index 0000000..c8e4751 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-align-5.c @@ -0,0 +1,20 @@ +/* Test C11 alignment support. Test invalid code. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +void foo (int []); +void bar1 (int [_Alignas (double) 10]); /* { dg-error "expected expression before" } */ +void bar2 (int [static _Alignas (double) 10]); /* { dg-error "expected expression before" } */ +void bar3 (int [static const _Alignas (double) 10]); /* { dg-error "expected expression before" } */ +void bar4 (int [const _Alignas (double) 10]); /* { dg-error "expected expression before" } */ +void bar5 (int [_Alignas (0) *]); /* { dg-error "expected expression before" } */ + +void foo (int a[_Alignas (0) 10]) { } /* { dg-error "expected expression before" } */ + +void +test (void) +{ + int a[_Alignas (int) 10]; /* { dg-error "expected expression before" } */ + int b[10]; + foo (b); +} diff --git a/gcc/testsuite/gcc.dg/c11-anon-struct-1.c b/gcc/testsuite/gcc.dg/c11-anon-struct-1.c new file mode 100644 index 0000000..779ae66 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-anon-struct-1.c @@ -0,0 +1,72 @@ +/* Test for anonymous structures and unions in C11. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +#include + +struct s1 +{ + int a; + union + { + int i; + }; + struct + { + int b; + }; +}; + +union u1 +{ + int b; + struct + { + int i; + }; + union + { + int c; + }; +}; + +struct s2 +{ + struct + { + int a; + }; +}; + +struct s3 +{ + union + { + int i; + }; +}; + +struct s4 +{ + struct + { + int i; + }; + int a[]; +}; + +struct s1 x = + { + .b = 1, + .i = 2, + .a = 3 + }; + +int o = offsetof (struct s1, i); + +void +f (void) +{ + x.i = 3; + (&x)->i = 4; +} diff --git a/gcc/testsuite/gcc.dg/c11-anon-struct-2.c b/gcc/testsuite/gcc.dg/c11-anon-struct-2.c new file mode 100644 index 0000000..d954b4b --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-anon-struct-2.c @@ -0,0 +1,57 @@ +/* Test for anonymous structures and unions in C11. Test for invalid + cases. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +typedef struct s0 +{ + int i; +} s0; + +struct s1 +{ + int a; + struct s0; /* { dg-error "declaration does not declare anything" } */ +}; + +struct s2 +{ + int a; + s0; /* { dg-error "declaration does not declare anything" } */ +}; + +struct s3 +{ + struct + { + int i; + }; + struct + { + int i; /* { dg-error "duplicate member" } */ + }; +}; + +struct s4 +{ + int a; + struct s + { + int i; + }; /* { dg-error "declaration does not declare anything" } */ +}; + +struct s5 +{ + struct + { + int i; + } a; + int b; +} x; + +void +f (void) +{ + x.i = 0; /* { dg-error "has no member" } */ +} diff --git a/gcc/testsuite/gcc.dg/c11-anon-struct-3.c b/gcc/testsuite/gcc.dg/c11-anon-struct-3.c new file mode 100644 index 0000000..05cc366 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-anon-struct-3.c @@ -0,0 +1,34 @@ +/* Test for anonymous structures and unions in C11. Test for invalid + cases: typedefs disallowed by N1549. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +typedef struct +{ + int i; +} s0; + +typedef union +{ + int i; +} u0; + +struct s1 +{ + int a; + u0; /* { dg-error "declaration does not declare anything" } */ + struct + { + int b; + }; +}; + +union u1 +{ + int b; + s0; /* { dg-error "declaration does not declare anything" } */ + union + { + int c; + }; +}; diff --git a/gcc/testsuite/gcc.dg/c11-float-1.c b/gcc/testsuite/gcc.dg/c11-float-1.c new file mode 100644 index 0000000..376c44d --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-float-1.c @@ -0,0 +1,169 @@ +/* Test for C11 macros. */ +/* Origin: Joseph Myers */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +/* This test checks that the C11 macros are defined; + it does not check the correctness of their values. */ + +#include + +#ifndef FLT_ROUNDS +#error "FLT_ROUNDS undefined" +#endif + +#ifndef FLT_RADIX +#error "FLT_RADIX undefined" +#endif + +#ifndef FLT_MANT_DIG +#error "FLT_MANT_DIG undefined" +#endif + +#ifndef FLT_DIG +#error "FLT_DIG undefined" +#endif + +#ifndef FLT_MIN_EXP +#error "FLT_MIN_EXP undefined" +#endif + +#ifndef FLT_MIN_10_EXP +#error "FLT_MIN_10_EXP undefined" +#endif + +#ifndef FLT_MAX_EXP +#error "FLT_MAX_EXP undefined" +#endif + +#ifndef FLT_MAX_10_EXP +#error "FLT_MAX_10_EXP undefined" +#endif + +#ifndef FLT_MAX +#error "FLT_MAX undefined" +#endif + +#ifndef FLT_EPSILON +#error "FLT_EPSILON undefined" +#endif + +#ifndef FLT_MIN +#error "FLT_MIN undefined" +#endif + +#ifndef DBL_MANT_DIG +#error "DBL_MANT_DIG undefined" +#endif + +#ifndef DBL_DIG +#error "DBL_DIG undefined" +#endif + +#ifndef DBL_MIN_EXP +#error "DBL_MIN_EXP undefined" +#endif + +#ifndef DBL_MIN_10_EXP +#error "DBL_MIN_10_EXP undefined" +#endif + +#ifndef DBL_MAX_EXP +#error "DBL_MAX_EXP undefined" +#endif + +#ifndef DBL_MAX_10_EXP +#error "DBL_MAX_10_EXP undefined" +#endif + +#ifndef DBL_MAX +#error "DBL_MAX undefined" +#endif + +#ifndef DBL_EPSILON +#error "DBL_EPSILON undefined" +#endif + +#ifndef DBL_MIN +#error "DBL_MIN undefined" +#endif + +#ifndef LDBL_MANT_DIG +#error "LDBL_MANT_DIG undefined" +#endif + +#ifndef LDBL_DIG +#error "LDBL_DIG undefined" +#endif + +#ifndef LDBL_MIN_EXP +#error "LDBL_MIN_EXP undefined" +#endif + +#ifndef LDBL_MIN_10_EXP +#error "LDBL_MIN_10_EXP undefined" +#endif + +#ifndef LDBL_MAX_EXP +#error "LDBL_MAX_EXP undefined" +#endif + +#ifndef LDBL_MAX_10_EXP +#error "LDBL_MAX_10_EXP undefined" +#endif + +#ifndef LDBL_MAX +#error "LDBL_MAX undefined" +#endif + +#ifndef LDBL_EPSILON +#error "LDBL_EPSILON undefined" +#endif + +#ifndef LDBL_MIN +#error "LDBL_MIN undefined" +#endif + +#ifndef FLT_EVAL_METHOD +#error "FLT_EVAL_METHOD undefined" +#endif + +#ifndef DECIMAL_DIG +#error "DECIMAL_DIG undefined" +#endif + +#ifndef FLT_DECIMAL_DIG +#error "FLT_DECIMAL_DIG undefined" +#endif + +#ifndef DBL_DECIMAL_DIG +#error "DBL_DECIMAL_DIG undefined" +#endif + +#ifndef LDBL_DECIMAL_DIG +#error "LDBL_DECIMAL_DIG undefined" +#endif + +#ifndef FLT_HAS_SUBNORM +#error "FLT_HAS_SUBNORM undefined" +#endif + +#ifndef DBL_HAS_SUBNORM +#error "DBL_HAS_SUBNORM undefined" +#endif + +#ifndef LDBL_HAS_SUBNORM +#error "LDBL_HAS_SUBNORM undefined" +#endif + +#ifndef FLT_TRUE_MIN +#error "FLT_TRUE_MIN undefined" +#endif + +#ifndef DBL_TRUE_MIN +#error "DBL_TRUE_MIN undefined" +#endif + +#ifndef LDBL_TRUE_MIN +#error "LDBL_TRUE_MIN undefined" +#endif diff --git a/gcc/testsuite/gcc.dg/c11-noreturn-1.c b/gcc/testsuite/gcc.dg/c11-noreturn-1.c new file mode 100644 index 0000000..e92c5ae --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-noreturn-1.c @@ -0,0 +1,59 @@ +/* Test C11 _Noreturn. Test valid code. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +_Noreturn void exit (int); + +_Noreturn int f1 (void); + +_Noreturn void f2 (void); + +static void _Noreturn f3 (void) { exit (0); } + +/* Returning from a noreturn function is undefined at runtime, not a + constraint violation, but recommended practice is to diagnose if + such a return appears possible. */ + +_Noreturn int +f4 (void) +{ + return 1; /* { dg-warning "has a 'return' statement" } */ + /* { dg-warning "does return" "second warning" { target *-*-* } 20 } */ +} + +_Noreturn void +f5 (void) +{ + return; /* { dg-warning "has a 'return' statement" } */ + /* { dg-warning "does return" "second warning" { target *-*-* } 27 } */ +} + +_Noreturn void +f6 (void) +{ +} /* { dg-warning "does return" } */ + +_Noreturn void +f7 (int a) +{ + if (a) + exit (0); +} /* { dg-warning "does return" } */ + +/* Declarations need not all have _Noreturn. */ + +void f2 (void); + +void f8 (void); +_Noreturn void f8 (void); + +/* Duplicate _Noreturn is OK. */ +_Noreturn _Noreturn void _Noreturn f9 (void); + +/* _Noreturn does not affect type compatibility. */ + +void (*fp) (void) = f5; + +/* noreturn is an ordinary identifier. */ + +int noreturn; diff --git a/gcc/testsuite/gcc.dg/c11-noreturn-2.c b/gcc/testsuite/gcc.dg/c11-noreturn-2.c new file mode 100644 index 0000000..951d028 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-noreturn-2.c @@ -0,0 +1,77 @@ +/* Test C11 _Noreturn. Test valid code using stdnoreturn.h. */ +/* { dg-do run } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +#include + +extern int strcmp (const char *, const char *); + +noreturn void exit (int); +noreturn void abort (void); + +noreturn int f1 (void); + +noreturn void f2 (void); + +static void noreturn f3 (void) { exit (0); } + +/* Returning from a noreturn function is undefined at runtime, not a + constraint violation, but recommended practice is to diagnose if + such a return appears possible. */ + +noreturn int +f4 (void) +{ + return 1; /* { dg-warning "has a 'return' statement" } */ + /* { dg-warning "does return" "second warning" { target *-*-* } 25 } */ +} + +noreturn void +f5 (void) +{ + return; /* { dg-warning "has a 'return' statement" } */ + /* { dg-warning "does return" "second warning" { target *-*-* } 32 } */ +} + +noreturn void +f6 (void) +{ +} /* { dg-warning "does return" } */ + +noreturn void +f7 (int a) +{ + if (a) + exit (0); +} /* { dg-warning "does return" } */ + +/* Declarations need not all have noreturn. */ + +void f2 (void); + +void f8 (void); +noreturn void f8 (void); + +/* Duplicate noreturn is OK. */ +noreturn noreturn void noreturn f9 (void); + +/* noreturn does not affect type compatibility. */ + +void (*fp) (void) = f5; + +#ifndef noreturn +#error "noreturn not defined" +#endif + +#define str(x) #x +#define xstr(x) str(x) + +const char *s = xstr(noreturn); + +int +main (void) +{ + if (strcmp (s, "_Noreturn") != 0) + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/c11-noreturn-3.c b/gcc/testsuite/gcc.dg/c11-noreturn-3.c new file mode 100644 index 0000000..168d012 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-noreturn-3.c @@ -0,0 +1,11 @@ +/* Test C11 _Noreturn. Test _Noreturn on main, hosted. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors -fhosted" } */ + +_Noreturn void exit (int); + +_Noreturn int +main (void) /* { dg-error "'main' declared '_Noreturn'" } */ +{ + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/c11-noreturn-4.c b/gcc/testsuite/gcc.dg/c11-noreturn-4.c new file mode 100644 index 0000000..a92a114 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-noreturn-4.c @@ -0,0 +1,11 @@ +/* Test C11 _Noreturn. Test _Noreturn on main, freestanding. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors -ffreestanding" } */ + +_Noreturn void exit (int); + +_Noreturn int +main (void) +{ + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/c11-noreturn-5.c b/gcc/testsuite/gcc.dg/c11-noreturn-5.c new file mode 100644 index 0000000..d1c0949 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-noreturn-5.c @@ -0,0 +1,17 @@ +/* Test C11 _Noreturn. Test invalid uses. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +_Noreturn struct s; /* { dg-error "empty declaration" } */ + +typedef _Noreturn void f (void); /* { dg-error "typedef" } */ + +void g (_Noreturn void fp (void)); /* { dg-error "parameter" } */ + +_Noreturn void (*p) (void); /* { dg-error "variable" } */ + +struct t { int a; _Noreturn void (*f) (void); }; /* { dg-error "expected" } */ + +int *_Noreturn *q; /* { dg-error "expected" } */ + +int i = sizeof (_Noreturn int (*) (void)); /* { dg-error "expected" } */ diff --git a/gcc/testsuite/gcc.dg/c11-pointer-float-1.c b/gcc/testsuite/gcc.dg/c11-pointer-float-1.c new file mode 100644 index 0000000..8c24165 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-pointer-float-1.c @@ -0,0 +1,28 @@ +/* Test C11 constraint against pointer / floating-point casts. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +void *p; +float f; +double d; +long double ld; +_Complex float cf; +_Complex double cd; +_Complex long double cld; + +void +func (void) +{ + f = (float) p; /* { dg-error "pointer" } */ + d = (double) p; /* { dg-error "pointer" } */ + ld = (long double) p; /* { dg-error "pointer" } */ + cf = (_Complex float) p; /* { dg-error "pointer" } */ + cd = (_Complex double) p; /* { dg-error "pointer" } */ + cld = (_Complex long double) p; /* { dg-error "pointer" } */ + p = (void *) f; /* { dg-error "pointer" } */ + p = (void *) d; /* { dg-error "pointer" } */ + p = (void *) ld; /* { dg-error "pointer" } */ + p = (void *) cf; /* { dg-error "pointer" } */ + p = (void *) cd; /* { dg-error "pointer" } */ + p = (void *) cld; /* { dg-error "pointer" } */ +} diff --git a/gcc/testsuite/gcc.dg/c11-static-assert-1.c b/gcc/testsuite/gcc.dg/c11-static-assert-1.c new file mode 100644 index 0000000..9209a7a --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-static-assert-1.c @@ -0,0 +1,41 @@ +/* Test C11 static assertions. Valid assertions. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +_Static_assert (1, "foo"); + +enum e { E0, E1 }; + +_Static_assert (E1, L"bar"); + +_Static_assert (-1, "foo" L"bar"); + +struct s +{ + int a; + _Static_assert (3, "s"); + int b; +}; + +union u +{ + int i; + _Static_assert ((int)1.0, L""); +}; + +void +f (void) +{ + int i; + i = 1; + _Static_assert (0 + 1, "f"); + i = 2; +} + +void +g (void) +{ + int i = 0; + for (_Static_assert (1, ""); i < 10; i++) + ; +} diff --git a/gcc/testsuite/gcc.dg/c11-static-assert-2.c b/gcc/testsuite/gcc.dg/c11-static-assert-2.c new file mode 100644 index 0000000..de2f573 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-static-assert-2.c @@ -0,0 +1,41 @@ +/* Test C11 static assertions. Failed assertions. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +_Static_assert (0, "assert1"); /* { dg-error "static assertion failed: \"assert1\"" } */ + +enum e { E0, E1 }; + +_Static_assert (E0, L"assert2"); /* { dg-error "static assertion failed: \"assert2\"" } */ + +_Static_assert (-0, "ass" L"ert3"); /* { dg-error "static assertion failed: \"assert3\"" } */ + +struct s +{ + int a; + _Static_assert (0, "assert4"); /* { dg-error "static assertion failed: \"assert4\"" } */ + int b; +}; + +union u +{ + int i; + _Static_assert ((int)0.0, L"assert5"); /* { dg-error "static assertion failed: \"assert5\"" } */ +}; + +void +f (void) +{ + int i; + i = 1; + _Static_assert (0 + 0, "assert6"); /* { dg-error "static assertion failed: \"assert6\"" } */ + i = 2; +} + +void +g (void) +{ + int i = 0; + for (_Static_assert (0, "assert7"); i < 10; i++) /* { dg-error "static assertion failed: \"assert7\"" } */ + ; +} diff --git a/gcc/testsuite/gcc.dg/c11-static-assert-3.c b/gcc/testsuite/gcc.dg/c11-static-assert-3.c new file mode 100644 index 0000000..79448a5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-static-assert-3.c @@ -0,0 +1,28 @@ +/* Test C11 static assertions. Invalid assertions. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +_Static_assert (__INT_MAX__ * 2, "overflow"); /* { dg-warning "integer overflow in expression" } */ +/* { dg-error "overflow in constant expression" "error" { target *-*-* } 5 } */ + +_Static_assert ((void *)(__SIZE_TYPE__)16, "non-integer"); /* { dg-error "not an integer" } */ + +_Static_assert (1.0, "non-integer"); /* { dg-error "not an integer" } */ + +_Static_assert ((int)(1.0 + 1.0), "non-constant-expression"); /* { dg-error "not an integer constant expression" } */ + +int i; + +_Static_assert (i, "non-constant"); /* { dg-error "not constant" } */ + +void +f (void) +{ + int j = 0; + for (_Static_assert (sizeof (struct s { int k; }), ""); j < 10; j++) /* { dg-error "loop initial declaration" } */ + ; +} + +_Static_assert (1, 1); /* { dg-error "expected" } */ + +_Static_assert (1, ("")); /* { dg-error "expected" } */ diff --git a/gcc/testsuite/gcc.dg/c11-static-assert-4.c b/gcc/testsuite/gcc.dg/c11-static-assert-4.c new file mode 100644 index 0000000..ddab440 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-static-assert-4.c @@ -0,0 +1,13 @@ +/* Test C11 static assertions. More invalid assertions. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +/* Static assertions not valid in old-style parameter declarations + because declarations there must have declarators. */ + +void +f (i) + int i; + _Static_assert (1, ""); /* { dg-error "expected" } */ +{ +} diff --git a/gcc/testsuite/gcc.dg/c11-static-assert-5.c b/gcc/testsuite/gcc.dg/c11-static-assert-5.c new file mode 100644 index 0000000..e88b816 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-static-assert-5.c @@ -0,0 +1,5 @@ +/* Test C11 static assertions. Non-constant-expression without -pedantic. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11" } */ + +_Static_assert ((int)(1.0 + 1.0), "non-constant-expression"); diff --git a/gcc/testsuite/gcc.dg/c11-static-assert-6.c b/gcc/testsuite/gcc.dg/c11-static-assert-6.c new file mode 100644 index 0000000..ac7e141 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-static-assert-6.c @@ -0,0 +1,5 @@ +/* Test C11 static assertions. Non-constant-expression with -pedantic. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic" } */ + +_Static_assert ((int)(1.0 + 1.0), "non-constant-expression"); /* { dg-warning "not an integer constant expression" } */ diff --git a/gcc/testsuite/gcc.dg/c11-typedef-1.c b/gcc/testsuite/gcc.dg/c11-typedef-1.c new file mode 100644 index 0000000..3224ba5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-typedef-1.c @@ -0,0 +1,70 @@ +/* Test typedef redeclaration in C11. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +/* C11 permits typedefs to be redeclared to the same type, but not to + different-but-compatible types, and not when the type is variably + modified. */ + +#include + +typedef int TI; +typedef int TI2; +typedef TI2 TI; +typedef TI TI2; + +enum e { E1 = 0, E2 = INT_MAX, E3 = -1 }; +typedef enum e TE; +typedef enum e TE; /* { dg-message "previous declaration" } */ +typedef int TE; /* { dg-error "with different type" } */ + +struct s; +typedef struct s TS; +struct s { int i; }; +typedef struct s TS; + +typedef int IA[]; +typedef TI2 IA[]; /* { dg-message "previous declaration" } */ +typedef int A2[2]; +typedef TI A2[2]; /* { dg-message "previous declaration" } */ +typedef IA A2; /* { dg-error "with different type" } */ +typedef int A3[3]; +typedef A3 IA; /* { dg-error "with different type" } */ + +typedef void F(int); +typedef void F(TI); /* { dg-message "previous declaration" } */ +typedef void F(enum e); /* { dg-error "with different type" } */ + +typedef int G(void); +typedef TI G(void); /* { dg-message "previous declaration" } */ +typedef enum e G(void); /* { dg-error "with different type" } */ + +typedef int *P; +typedef TI *P; /* { dg-message "previous declaration" } */ +typedef enum e *P; /* { dg-error "with different type" } */ + +typedef void F2(); +typedef void F2(); /* { dg-message "previous declaration" } */ +typedef void F2(int); /* { dg-error "with different type" } */ + +void +f (void) +{ + int a = 1; + int b = 2; + typedef void FN(int (*p)[a]); + typedef void FN(int (*p)[b]); + typedef void FN(int (*p)[*]); /* { dg-message "previous declaration" } */ + typedef void FN(int (*p)[1]); /* { dg-error "with different type" } */ + typedef void FN2(int (*p)[a]); + typedef void FN2(int (*p)[b]); + typedef void FN2(int (*p)[*]); /* { dg-message "previous declaration" } */ + typedef void FN2(int (*p)[]); /* { dg-error "with different type" } */ + typedef int AV[a]; /* { dg-message "previous declaration" } */ + typedef int AV[b-1]; /* { dg-error "redefinition" } */ + typedef int AAa[a]; /* { dg-message "previous declaration" } */ + typedef int AAb[b-1]; + typedef AAa *VF(void); /* { dg-message "previous declaration" } */ + typedef AAb *VF(void); /* { dg-error "redefinition" } */ + typedef AAa AAa; /* { dg-error "redefinition" } */ +} diff --git a/gcc/testsuite/gcc.dg/c11-uni-string-1.c b/gcc/testsuite/gcc.dg/c11-uni-string-1.c new file mode 100644 index 0000000..9f86bea --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-uni-string-1.c @@ -0,0 +1,112 @@ +/* Test Unicode strings in C11. Test valid code. */ +/* { dg-do run } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +/* More thorough tests are in c-c++-common/raw-string-*.c; this test + verifies the particular subset (Unicode but not raw strings) that + is in C11. */ + +typedef __CHAR16_TYPE__ char16_t; +typedef __CHAR32_TYPE__ char32_t; +typedef __SIZE_TYPE__ size_t; + +extern void abort (void); +extern void exit (int); +extern int memcmp (const void *, const void *, size_t); + +#define R "(R)" +#define u8R "(u8R)" +#define uR "(uR)" +#define UR "(UR)" +#define LR "(LR)" +#define u8 randomu8 +#define u randomu +#define U randomU + +const char su8[] = u8"a\u010d"; +const char su8a[] = "a\xc4\x8d"; + +const char16_t su16[] = u"\u0567"; +const char16_t su16a[] = { 0x0567, 0 }; + +const char32_t su32[] = U"\u0123"; +const char32_t su32a[] = { 0x0123, 0 }; + +const char tu[] = R"a"; +const char tua[] = "(R)a"; + +const char tu8[] = u8R"b"; +const char tu8a[] = "(u8R)b"; + +const char tu16[] = uR"c"; +const char tu16a[] = "(uR)c"; + +const char tu32[] = UR"d"; +const char tu32a[] = "(UR)d"; + +const char tl[] = LR"e"; +const char tla[] = "(LR)e"; + +#define str(x) #x +const char ts[] = str(u"a" U"b" u8"c"); +const char tsa[] = "u\"a\" U\"b\" u8\"c\""; + +/* GCC always uses UTF-16 and UTF-32 for char16_t and char32_t. */ +#ifndef __STDC_UTF_16__ +#error "__STDC_UTF_16__ not defined" +#endif +#ifndef __STDC_UTF_32__ +#error "__STDC_UTF_32__ not defined" +#endif +#define xstr(x) str(x) +const char tm16[] = xstr(__STDC_UTF_16__); +const char tm16a[] = "1"; +const char tm32[] = xstr(__STDC_UTF_32__); +const char tm32a[] = "1"; + +int +main (void) +{ + if (sizeof (su8) != sizeof (su8a) + || memcmp (su8, su8a, sizeof (su8)) != 0) + abort (); + if (sizeof (su16) != sizeof (su16a) + || memcmp (su16, su16a, sizeof (su16)) != 0) + abort (); + if (sizeof (su32) != sizeof (su32a) + || memcmp (su32, su32a, sizeof (su32)) != 0) + abort (); + if (sizeof (tu) != sizeof (tua) + || memcmp (tu, tua, sizeof (tu)) != 0) + abort (); + if (sizeof (tu8) != sizeof (tu8a) + || memcmp (tu8, tu8a, sizeof (tu8)) != 0) + abort (); + if (sizeof (tu16) != sizeof (tu16a) + || memcmp (tu16, tu16a, sizeof (tu16)) != 0) + abort (); + if (sizeof (tu32) != sizeof (tu32a) + || memcmp (tu32, tu32a, sizeof (tu32)) != 0) + abort (); + if (sizeof (tl) != sizeof (tla) + || memcmp (tl, tla, sizeof (tl)) != 0) + abort (); + if (sizeof (ts) != sizeof (tsa) + || memcmp (ts, tsa, sizeof (ts)) != 0) + abort (); + if (sizeof (tm16) != sizeof (tm16a) + || memcmp (tm16, tm16a, sizeof (tm16)) != 0) + abort (); + if (sizeof (tm32) != sizeof (tm32a) + || memcmp (tm32, tm32a, sizeof (tm32)) != 0) + abort (); + if (u'\u0123' != 0x0123) + abort (); + if (U'\u0456' != 0x0456) + abort (); +#undef u8 +#define u8 + if (u8'a' != 'a') + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/c11-uni-string-2.c b/gcc/testsuite/gcc.dg/c11-uni-string-2.c new file mode 100644 index 0000000..583c38a --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-uni-string-2.c @@ -0,0 +1,8 @@ +/* Test Unicode strings in C11. Test constraint. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +const void *p1 = L"a" u8"b"; /* { dg-error "concatenation" } */ +const void *p2 = L"a" "b" u8"c"; /* { dg-error "concatenation" } */ +const void *p3 = u8"a" L"b"; /* { dg-error "concatenation" } */ +const void *p4 = u8"a" "b" L"c"; /* { dg-error "concatenation" } */ diff --git a/gcc/testsuite/gcc.dg/c1x-align-1.c b/gcc/testsuite/gcc.dg/c1x-align-1.c deleted file mode 100644 index e0058c3..0000000 --- a/gcc/testsuite/gcc.dg/c1x-align-1.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Test C11 alignment support. Test valid code. */ -/* { dg-do compile } */ -/* { dg-options "-std=c11 -pedantic-errors" } */ - -#include - -_Alignas (_Alignof (max_align_t)) char c; -extern _Alignas (max_align_t) char c; -extern char c; - -extern _Alignas (max_align_t) short s; -_Alignas (max_align_t) short s; - -_Alignas (int) int i; -extern int i; - -_Alignas (max_align_t) long l; - -_Alignas (max_align_t) long long ll; - -_Alignas (max_align_t) float f; - -_Alignas (max_align_t) double d; - -_Alignas (max_align_t) _Complex long double cld; - -_Alignas (0) _Alignas (int) _Alignas (char) char ca[10]; - -_Alignas ((int) _Alignof (max_align_t) + 0) int x; - -enum e { E = _Alignof (max_align_t) }; -_Alignas (E) int y; - -void -func (void) -{ - _Alignas (max_align_t) long long auto_ll; -} - -/* Valid, but useless. */ -_Alignas (0) struct s; /* { dg-warning "useless" } */ diff --git a/gcc/testsuite/gcc.dg/c1x-align-2.c b/gcc/testsuite/gcc.dg/c1x-align-2.c deleted file mode 100644 index a1750ac..0000000 --- a/gcc/testsuite/gcc.dg/c1x-align-2.c +++ /dev/null @@ -1,92 +0,0 @@ -/* Test C11 alignment support. Test valid code using stdalign.h. */ -/* { dg-do run } */ -/* { dg-options "-std=c11 -pedantic-errors" } */ - -#include -#include - -extern int strcmp (const char *, const char *); - -extern void exit (int); -extern void abort (void); - -alignas (alignof (max_align_t)) char c; -extern alignas (max_align_t) char c; -extern char c; - -extern alignas (max_align_t) short s; -alignas (max_align_t) short s; - -alignas (int) int i; -extern int i; - -alignas (max_align_t) long l; - -alignas (max_align_t) long long ll; - -alignas (max_align_t) float f; - -alignas (max_align_t) double d; - -alignas (max_align_t) _Complex long double cld; - -alignas (0) alignas (int) alignas (char) char ca[10]; - -alignas ((int) alignof (max_align_t) + 0) int x; - -enum e { E = alignof (max_align_t) }; -alignas (E) int y; - -void -func (void) -{ - alignas (max_align_t) long long auto_ll; -} - -/* Valid, but useless. */ -alignas (0) struct s; /* { dg-warning "useless" } */ - -#ifndef alignas -#error "alignas not defined" -#endif - -#ifndef alignof -#error "alignof not defined" -#endif - -#ifndef __alignas_is_defined -#error "__alignas_is_defined not defined" -#endif - -#if __alignas_is_defined != 1 -#error "__alignas_is_defined not 1" -#endif - -#ifndef __alignof_is_defined -#error "__alignof_is_defined not defined" -#endif - -#if __alignof_is_defined != 1 -#error "__alignof_is_defined not 1" -#endif - -#define str(x) #x -#define xstr(x) str(x) - -const char *s1 = xstr(alignas); -const char *s2 = xstr(alignof); -const char *s3 = xstr(__alignas_is_defined); -const char *s4 = xstr(__alignof_is_defined); - -int -main (void) -{ - if (strcmp (s1, "_Alignas") != 0) - abort (); - if (strcmp (s2, "_Alignof") != 0) - abort (); - if (strcmp (s3, "1") != 0) - abort (); - if (strcmp (s4, "1") != 0) - abort (); -} diff --git a/gcc/testsuite/gcc.dg/c1x-align-3.c b/gcc/testsuite/gcc.dg/c1x-align-3.c deleted file mode 100644 index 39b81ef..0000000 --- a/gcc/testsuite/gcc.dg/c1x-align-3.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Test C11 alignment support. Test invalid code. */ -/* { dg-do compile } */ -/* { dg-options "-std=c11 -pedantic-errors" } */ - -int a = _Alignof (void (void)); /* { dg-error "function" } */ -struct s; -int b = _Alignof (struct s); /* { dg-error "incomplete" } */ -int c = _Alignof (void); /* { dg-error "void" } */ -int d = _Alignof (a); /* { dg-error "expression" } */ - -_Alignas (void (void)) char e; /* { dg-error "function" } */ -_Alignas (struct s) char f; /* { dg-error "incomplete" } */ -_Alignas (void) char g; /* { dg-error "void" } */ - -_Alignas (-__INT_MAX__-1) char h; /* { dg-error "too large|power of 2" } */ -_Alignas (-__INT_MAX__) char h2; /* { dg-error "too large|power of 2" } */ -_Alignas ((-__INT_MAX__-1)/2) char h3; /* { dg-error "too large|power of 2" } */ -_Alignas ((-__INT_MAX__-1)/4) char h4; /* { dg-error "too large|power of 2" } */ -_Alignas ((-__INT_MAX__-1)/8) char h5; /* { dg-error "too large|power of 2" } */ -_Alignas (-__LONG_LONG_MAX__-1) char i; /* { dg-error "too large|power of 2" } */ -_Alignas (-(__LONG_LONG_MAX__-1)/2) char i2; /* { dg-error "too large|power of 2" } */ -_Alignas (-(__LONG_LONG_MAX__-1)/4) char i3; /* { dg-error "too large|power of 2" } */ -_Alignas (-(__LONG_LONG_MAX__-1)/8) char i4; /* { dg-error "too large|power of 2" } */ -_Alignas (-(__LONG_LONG_MAX__-1)/16) char i5; /* { dg-error "too large|power of 2" } */ -_Alignas (-1) char j; /* { dg-error "power of 2" } */ -_Alignas (-2) char j; /* { dg-error "positive power of 2" } */ -_Alignas (3) char k; /* { dg-error "power of 2" } */ - -_Alignas ((void *) 1) char k; /* { dg-error "integer constant" } */ -int x; -_Alignas (x) char l; /* { dg-error "integer constant" } */ - -_Alignas (0) struct s; /* { dg-error "does not redeclare tag" } */ - -_Alignas (0) typedef int T; /* { dg-error "alignment specified for typedef" } */ -void func (_Alignas (0) int); /* { dg-error "alignment specified for unnamed parameter" } */ -void f2 (_Alignas (0) int parm2) {} /* { dg-error "alignment specified for parameter" } */ -void -f3 (void) -{ - register _Alignas (0) int reg; /* { dg-error "register" } */ -} -_Alignas (0) void f4 (void); /* { dg-error "alignment specified for function" } */ diff --git a/gcc/testsuite/gcc.dg/c1x-align-4.c b/gcc/testsuite/gcc.dg/c1x-align-4.c deleted file mode 100644 index 6377db6..0000000 --- a/gcc/testsuite/gcc.dg/c1x-align-4.c +++ /dev/null @@ -1,9 +0,0 @@ -/* Test C11 alignment support. Test reducing alignment (assumes there - are at least some alignment constraints). */ -/* { dg-do compile } */ -/* { dg-options "-std=c11 -pedantic-errors" } */ -/* { dg-skip-if "no alignment constraints" { "avr-*-*" } { "*" } { "" } } */ - -#include - -_Alignas (_Alignof (char)) max_align_t x; /* { dg-error "reduce alignment" } */ diff --git a/gcc/testsuite/gcc.dg/c1x-align-5.c b/gcc/testsuite/gcc.dg/c1x-align-5.c deleted file mode 100644 index c8e4751..0000000 --- a/gcc/testsuite/gcc.dg/c1x-align-5.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Test C11 alignment support. Test invalid code. */ -/* { dg-do compile } */ -/* { dg-options "-std=c11 -pedantic-errors" } */ - -void foo (int []); -void bar1 (int [_Alignas (double) 10]); /* { dg-error "expected expression before" } */ -void bar2 (int [static _Alignas (double) 10]); /* { dg-error "expected expression before" } */ -void bar3 (int [static const _Alignas (double) 10]); /* { dg-error "expected expression before" } */ -void bar4 (int [const _Alignas (double) 10]); /* { dg-error "expected expression before" } */ -void bar5 (int [_Alignas (0) *]); /* { dg-error "expected expression before" } */ - -void foo (int a[_Alignas (0) 10]) { } /* { dg-error "expected expression before" } */ - -void -test (void) -{ - int a[_Alignas (int) 10]; /* { dg-error "expected expression before" } */ - int b[10]; - foo (b); -} diff --git a/gcc/testsuite/gcc.dg/c1x-anon-struct-1.c b/gcc/testsuite/gcc.dg/c1x-anon-struct-1.c deleted file mode 100644 index 779ae66..0000000 --- a/gcc/testsuite/gcc.dg/c1x-anon-struct-1.c +++ /dev/null @@ -1,72 +0,0 @@ -/* Test for anonymous structures and unions in C11. */ -/* { dg-do compile } */ -/* { dg-options "-std=c11 -pedantic-errors" } */ - -#include - -struct s1 -{ - int a; - union - { - int i; - }; - struct - { - int b; - }; -}; - -union u1 -{ - int b; - struct - { - int i; - }; - union - { - int c; - }; -}; - -struct s2 -{ - struct - { - int a; - }; -}; - -struct s3 -{ - union - { - int i; - }; -}; - -struct s4 -{ - struct - { - int i; - }; - int a[]; -}; - -struct s1 x = - { - .b = 1, - .i = 2, - .a = 3 - }; - -int o = offsetof (struct s1, i); - -void -f (void) -{ - x.i = 3; - (&x)->i = 4; -} diff --git a/gcc/testsuite/gcc.dg/c1x-anon-struct-2.c b/gcc/testsuite/gcc.dg/c1x-anon-struct-2.c deleted file mode 100644 index d954b4b..0000000 --- a/gcc/testsuite/gcc.dg/c1x-anon-struct-2.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Test for anonymous structures and unions in C11. Test for invalid - cases. */ -/* { dg-do compile } */ -/* { dg-options "-std=c11 -pedantic-errors" } */ - -typedef struct s0 -{ - int i; -} s0; - -struct s1 -{ - int a; - struct s0; /* { dg-error "declaration does not declare anything" } */ -}; - -struct s2 -{ - int a; - s0; /* { dg-error "declaration does not declare anything" } */ -}; - -struct s3 -{ - struct - { - int i; - }; - struct - { - int i; /* { dg-error "duplicate member" } */ - }; -}; - -struct s4 -{ - int a; - struct s - { - int i; - }; /* { dg-error "declaration does not declare anything" } */ -}; - -struct s5 -{ - struct - { - int i; - } a; - int b; -} x; - -void -f (void) -{ - x.i = 0; /* { dg-error "has no member" } */ -} diff --git a/gcc/testsuite/gcc.dg/c1x-anon-struct-3.c b/gcc/testsuite/gcc.dg/c1x-anon-struct-3.c deleted file mode 100644 index 05cc366..0000000 --- a/gcc/testsuite/gcc.dg/c1x-anon-struct-3.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Test for anonymous structures and unions in C11. Test for invalid - cases: typedefs disallowed by N1549. */ -/* { dg-do compile } */ -/* { dg-options "-std=c11 -pedantic-errors" } */ - -typedef struct -{ - int i; -} s0; - -typedef union -{ - int i; -} u0; - -struct s1 -{ - int a; - u0; /* { dg-error "declaration does not declare anything" } */ - struct - { - int b; - }; -}; - -union u1 -{ - int b; - s0; /* { dg-error "declaration does not declare anything" } */ - union - { - int c; - }; -}; diff --git a/gcc/testsuite/gcc.dg/c1x-float-1.c b/gcc/testsuite/gcc.dg/c1x-float-1.c deleted file mode 100644 index 376c44d..0000000 --- a/gcc/testsuite/gcc.dg/c1x-float-1.c +++ /dev/null @@ -1,169 +0,0 @@ -/* Test for C11 macros. */ -/* Origin: Joseph Myers */ -/* { dg-do preprocess } */ -/* { dg-options "-std=c11 -pedantic-errors" } */ - -/* This test checks that the C11 macros are defined; - it does not check the correctness of their values. */ - -#include - -#ifndef FLT_ROUNDS -#error "FLT_ROUNDS undefined" -#endif - -#ifndef FLT_RADIX -#error "FLT_RADIX undefined" -#endif - -#ifndef FLT_MANT_DIG -#error "FLT_MANT_DIG undefined" -#endif - -#ifndef FLT_DIG -#error "FLT_DIG undefined" -#endif - -#ifndef FLT_MIN_EXP -#error "FLT_MIN_EXP undefined" -#endif - -#ifndef FLT_MIN_10_EXP -#error "FLT_MIN_10_EXP undefined" -#endif - -#ifndef FLT_MAX_EXP -#error "FLT_MAX_EXP undefined" -#endif - -#ifndef FLT_MAX_10_EXP -#error "FLT_MAX_10_EXP undefined" -#endif - -#ifndef FLT_MAX -#error "FLT_MAX undefined" -#endif - -#ifndef FLT_EPSILON -#error "FLT_EPSILON undefined" -#endif - -#ifndef FLT_MIN -#error "FLT_MIN undefined" -#endif - -#ifndef DBL_MANT_DIG -#error "DBL_MANT_DIG undefined" -#endif - -#ifndef DBL_DIG -#error "DBL_DIG undefined" -#endif - -#ifndef DBL_MIN_EXP -#error "DBL_MIN_EXP undefined" -#endif - -#ifndef DBL_MIN_10_EXP -#error "DBL_MIN_10_EXP undefined" -#endif - -#ifndef DBL_MAX_EXP -#error "DBL_MAX_EXP undefined" -#endif - -#ifndef DBL_MAX_10_EXP -#error "DBL_MAX_10_EXP undefined" -#endif - -#ifndef DBL_MAX -#error "DBL_MAX undefined" -#endif - -#ifndef DBL_EPSILON -#error "DBL_EPSILON undefined" -#endif - -#ifndef DBL_MIN -#error "DBL_MIN undefined" -#endif - -#ifndef LDBL_MANT_DIG -#error "LDBL_MANT_DIG undefined" -#endif - -#ifndef LDBL_DIG -#error "LDBL_DIG undefined" -#endif - -#ifndef LDBL_MIN_EXP -#error "LDBL_MIN_EXP undefined" -#endif - -#ifndef LDBL_MIN_10_EXP -#error "LDBL_MIN_10_EXP undefined" -#endif - -#ifndef LDBL_MAX_EXP -#error "LDBL_MAX_EXP undefined" -#endif - -#ifndef LDBL_MAX_10_EXP -#error "LDBL_MAX_10_EXP undefined" -#endif - -#ifndef LDBL_MAX -#error "LDBL_MAX undefined" -#endif - -#ifndef LDBL_EPSILON -#error "LDBL_EPSILON undefined" -#endif - -#ifndef LDBL_MIN -#error "LDBL_MIN undefined" -#endif - -#ifndef FLT_EVAL_METHOD -#error "FLT_EVAL_METHOD undefined" -#endif - -#ifndef DECIMAL_DIG -#error "DECIMAL_DIG undefined" -#endif - -#ifndef FLT_DECIMAL_DIG -#error "FLT_DECIMAL_DIG undefined" -#endif - -#ifndef DBL_DECIMAL_DIG -#error "DBL_DECIMAL_DIG undefined" -#endif - -#ifndef LDBL_DECIMAL_DIG -#error "LDBL_DECIMAL_DIG undefined" -#endif - -#ifndef FLT_HAS_SUBNORM -#error "FLT_HAS_SUBNORM undefined" -#endif - -#ifndef DBL_HAS_SUBNORM -#error "DBL_HAS_SUBNORM undefined" -#endif - -#ifndef LDBL_HAS_SUBNORM -#error "LDBL_HAS_SUBNORM undefined" -#endif - -#ifndef FLT_TRUE_MIN -#error "FLT_TRUE_MIN undefined" -#endif - -#ifndef DBL_TRUE_MIN -#error "DBL_TRUE_MIN undefined" -#endif - -#ifndef LDBL_TRUE_MIN -#error "LDBL_TRUE_MIN undefined" -#endif diff --git a/gcc/testsuite/gcc.dg/c1x-noreturn-1.c b/gcc/testsuite/gcc.dg/c1x-noreturn-1.c deleted file mode 100644 index e92c5ae..0000000 --- a/gcc/testsuite/gcc.dg/c1x-noreturn-1.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Test C11 _Noreturn. Test valid code. */ -/* { dg-do compile } */ -/* { dg-options "-std=c11 -pedantic-errors" } */ - -_Noreturn void exit (int); - -_Noreturn int f1 (void); - -_Noreturn void f2 (void); - -static void _Noreturn f3 (void) { exit (0); } - -/* Returning from a noreturn function is undefined at runtime, not a - constraint violation, but recommended practice is to diagnose if - such a return appears possible. */ - -_Noreturn int -f4 (void) -{ - return 1; /* { dg-warning "has a 'return' statement" } */ - /* { dg-warning "does return" "second warning" { target *-*-* } 20 } */ -} - -_Noreturn void -f5 (void) -{ - return; /* { dg-warning "has a 'return' statement" } */ - /* { dg-warning "does return" "second warning" { target *-*-* } 27 } */ -} - -_Noreturn void -f6 (void) -{ -} /* { dg-warning "does return" } */ - -_Noreturn void -f7 (int a) -{ - if (a) - exit (0); -} /* { dg-warning "does return" } */ - -/* Declarations need not all have _Noreturn. */ - -void f2 (void); - -void f8 (void); -_Noreturn void f8 (void); - -/* Duplicate _Noreturn is OK. */ -_Noreturn _Noreturn void _Noreturn f9 (void); - -/* _Noreturn does not affect type compatibility. */ - -void (*fp) (void) = f5; - -/* noreturn is an ordinary identifier. */ - -int noreturn; diff --git a/gcc/testsuite/gcc.dg/c1x-noreturn-2.c b/gcc/testsuite/gcc.dg/c1x-noreturn-2.c deleted file mode 100644 index 951d028..0000000 --- a/gcc/testsuite/gcc.dg/c1x-noreturn-2.c +++ /dev/null @@ -1,77 +0,0 @@ -/* Test C11 _Noreturn. Test valid code using stdnoreturn.h. */ -/* { dg-do run } */ -/* { dg-options "-std=c11 -pedantic-errors" } */ - -#include - -extern int strcmp (const char *, const char *); - -noreturn void exit (int); -noreturn void abort (void); - -noreturn int f1 (void); - -noreturn void f2 (void); - -static void noreturn f3 (void) { exit (0); } - -/* Returning from a noreturn function is undefined at runtime, not a - constraint violation, but recommended practice is to diagnose if - such a return appears possible. */ - -noreturn int -f4 (void) -{ - return 1; /* { dg-warning "has a 'return' statement" } */ - /* { dg-warning "does return" "second warning" { target *-*-* } 25 } */ -} - -noreturn void -f5 (void) -{ - return; /* { dg-warning "has a 'return' statement" } */ - /* { dg-warning "does return" "second warning" { target *-*-* } 32 } */ -} - -noreturn void -f6 (void) -{ -} /* { dg-warning "does return" } */ - -noreturn void -f7 (int a) -{ - if (a) - exit (0); -} /* { dg-warning "does return" } */ - -/* Declarations need not all have noreturn. */ - -void f2 (void); - -void f8 (void); -noreturn void f8 (void); - -/* Duplicate noreturn is OK. */ -noreturn noreturn void noreturn f9 (void); - -/* noreturn does not affect type compatibility. */ - -void (*fp) (void) = f5; - -#ifndef noreturn -#error "noreturn not defined" -#endif - -#define str(x) #x -#define xstr(x) str(x) - -const char *s = xstr(noreturn); - -int -main (void) -{ - if (strcmp (s, "_Noreturn") != 0) - abort (); - exit (0); -} diff --git a/gcc/testsuite/gcc.dg/c1x-noreturn-3.c b/gcc/testsuite/gcc.dg/c1x-noreturn-3.c deleted file mode 100644 index 168d012..0000000 --- a/gcc/testsuite/gcc.dg/c1x-noreturn-3.c +++ /dev/null @@ -1,11 +0,0 @@ -/* Test C11 _Noreturn. Test _Noreturn on main, hosted. */ -/* { dg-do compile } */ -/* { dg-options "-std=c11 -pedantic-errors -fhosted" } */ - -_Noreturn void exit (int); - -_Noreturn int -main (void) /* { dg-error "'main' declared '_Noreturn'" } */ -{ - exit (0); -} diff --git a/gcc/testsuite/gcc.dg/c1x-noreturn-4.c b/gcc/testsuite/gcc.dg/c1x-noreturn-4.c deleted file mode 100644 index a92a114..0000000 --- a/gcc/testsuite/gcc.dg/c1x-noreturn-4.c +++ /dev/null @@ -1,11 +0,0 @@ -/* Test C11 _Noreturn. Test _Noreturn on main, freestanding. */ -/* { dg-do compile } */ -/* { dg-options "-std=c11 -pedantic-errors -ffreestanding" } */ - -_Noreturn void exit (int); - -_Noreturn int -main (void) -{ - exit (0); -} diff --git a/gcc/testsuite/gcc.dg/c1x-noreturn-5.c b/gcc/testsuite/gcc.dg/c1x-noreturn-5.c deleted file mode 100644 index d1c0949..0000000 --- a/gcc/testsuite/gcc.dg/c1x-noreturn-5.c +++ /dev/null @@ -1,17 +0,0 @@ -/* Test C11 _Noreturn. Test invalid uses. */ -/* { dg-do compile } */ -/* { dg-options "-std=c11 -pedantic-errors" } */ - -_Noreturn struct s; /* { dg-error "empty declaration" } */ - -typedef _Noreturn void f (void); /* { dg-error "typedef" } */ - -void g (_Noreturn void fp (void)); /* { dg-error "parameter" } */ - -_Noreturn void (*p) (void); /* { dg-error "variable" } */ - -struct t { int a; _Noreturn void (*f) (void); }; /* { dg-error "expected" } */ - -int *_Noreturn *q; /* { dg-error "expected" } */ - -int i = sizeof (_Noreturn int (*) (void)); /* { dg-error "expected" } */ diff --git a/gcc/testsuite/gcc.dg/c1x-pointer-float-1.c b/gcc/testsuite/gcc.dg/c1x-pointer-float-1.c deleted file mode 100644 index 8c24165..0000000 --- a/gcc/testsuite/gcc.dg/c1x-pointer-float-1.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Test C11 constraint against pointer / floating-point casts. */ -/* { dg-do compile } */ -/* { dg-options "-std=c11 -pedantic-errors" } */ - -void *p; -float f; -double d; -long double ld; -_Complex float cf; -_Complex double cd; -_Complex long double cld; - -void -func (void) -{ - f = (float) p; /* { dg-error "pointer" } */ - d = (double) p; /* { dg-error "pointer" } */ - ld = (long double) p; /* { dg-error "pointer" } */ - cf = (_Complex float) p; /* { dg-error "pointer" } */ - cd = (_Complex double) p; /* { dg-error "pointer" } */ - cld = (_Complex long double) p; /* { dg-error "pointer" } */ - p = (void *) f; /* { dg-error "pointer" } */ - p = (void *) d; /* { dg-error "pointer" } */ - p = (void *) ld; /* { dg-error "pointer" } */ - p = (void *) cf; /* { dg-error "pointer" } */ - p = (void *) cd; /* { dg-error "pointer" } */ - p = (void *) cld; /* { dg-error "pointer" } */ -} diff --git a/gcc/testsuite/gcc.dg/c1x-static-assert-1.c b/gcc/testsuite/gcc.dg/c1x-static-assert-1.c deleted file mode 100644 index 9209a7a..0000000 --- a/gcc/testsuite/gcc.dg/c1x-static-assert-1.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Test C11 static assertions. Valid assertions. */ -/* { dg-do compile } */ -/* { dg-options "-std=c11 -pedantic-errors" } */ - -_Static_assert (1, "foo"); - -enum e { E0, E1 }; - -_Static_assert (E1, L"bar"); - -_Static_assert (-1, "foo" L"bar"); - -struct s -{ - int a; - _Static_assert (3, "s"); - int b; -}; - -union u -{ - int i; - _Static_assert ((int)1.0, L""); -}; - -void -f (void) -{ - int i; - i = 1; - _Static_assert (0 + 1, "f"); - i = 2; -} - -void -g (void) -{ - int i = 0; - for (_Static_assert (1, ""); i < 10; i++) - ; -} diff --git a/gcc/testsuite/gcc.dg/c1x-static-assert-2.c b/gcc/testsuite/gcc.dg/c1x-static-assert-2.c deleted file mode 100644 index de2f573..0000000 --- a/gcc/testsuite/gcc.dg/c1x-static-assert-2.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Test C11 static assertions. Failed assertions. */ -/* { dg-do compile } */ -/* { dg-options "-std=c11 -pedantic-errors" } */ - -_Static_assert (0, "assert1"); /* { dg-error "static assertion failed: \"assert1\"" } */ - -enum e { E0, E1 }; - -_Static_assert (E0, L"assert2"); /* { dg-error "static assertion failed: \"assert2\"" } */ - -_Static_assert (-0, "ass" L"ert3"); /* { dg-error "static assertion failed: \"assert3\"" } */ - -struct s -{ - int a; - _Static_assert (0, "assert4"); /* { dg-error "static assertion failed: \"assert4\"" } */ - int b; -}; - -union u -{ - int i; - _Static_assert ((int)0.0, L"assert5"); /* { dg-error "static assertion failed: \"assert5\"" } */ -}; - -void -f (void) -{ - int i; - i = 1; - _Static_assert (0 + 0, "assert6"); /* { dg-error "static assertion failed: \"assert6\"" } */ - i = 2; -} - -void -g (void) -{ - int i = 0; - for (_Static_assert (0, "assert7"); i < 10; i++) /* { dg-error "static assertion failed: \"assert7\"" } */ - ; -} diff --git a/gcc/testsuite/gcc.dg/c1x-static-assert-3.c b/gcc/testsuite/gcc.dg/c1x-static-assert-3.c deleted file mode 100644 index 79448a5..0000000 --- a/gcc/testsuite/gcc.dg/c1x-static-assert-3.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Test C11 static assertions. Invalid assertions. */ -/* { dg-do compile } */ -/* { dg-options "-std=c11 -pedantic-errors" } */ - -_Static_assert (__INT_MAX__ * 2, "overflow"); /* { dg-warning "integer overflow in expression" } */ -/* { dg-error "overflow in constant expression" "error" { target *-*-* } 5 } */ - -_Static_assert ((void *)(__SIZE_TYPE__)16, "non-integer"); /* { dg-error "not an integer" } */ - -_Static_assert (1.0, "non-integer"); /* { dg-error "not an integer" } */ - -_Static_assert ((int)(1.0 + 1.0), "non-constant-expression"); /* { dg-error "not an integer constant expression" } */ - -int i; - -_Static_assert (i, "non-constant"); /* { dg-error "not constant" } */ - -void -f (void) -{ - int j = 0; - for (_Static_assert (sizeof (struct s { int k; }), ""); j < 10; j++) /* { dg-error "loop initial declaration" } */ - ; -} - -_Static_assert (1, 1); /* { dg-error "expected" } */ - -_Static_assert (1, ("")); /* { dg-error "expected" } */ diff --git a/gcc/testsuite/gcc.dg/c1x-static-assert-4.c b/gcc/testsuite/gcc.dg/c1x-static-assert-4.c deleted file mode 100644 index ddab440..0000000 --- a/gcc/testsuite/gcc.dg/c1x-static-assert-4.c +++ /dev/null @@ -1,13 +0,0 @@ -/* Test C11 static assertions. More invalid assertions. */ -/* { dg-do compile } */ -/* { dg-options "-std=c11 -pedantic-errors" } */ - -/* Static assertions not valid in old-style parameter declarations - because declarations there must have declarators. */ - -void -f (i) - int i; - _Static_assert (1, ""); /* { dg-error "expected" } */ -{ -} diff --git a/gcc/testsuite/gcc.dg/c1x-static-assert-5.c b/gcc/testsuite/gcc.dg/c1x-static-assert-5.c deleted file mode 100644 index e88b816..0000000 --- a/gcc/testsuite/gcc.dg/c1x-static-assert-5.c +++ /dev/null @@ -1,5 +0,0 @@ -/* Test C11 static assertions. Non-constant-expression without -pedantic. */ -/* { dg-do compile } */ -/* { dg-options "-std=c11" } */ - -_Static_assert ((int)(1.0 + 1.0), "non-constant-expression"); diff --git a/gcc/testsuite/gcc.dg/c1x-static-assert-6.c b/gcc/testsuite/gcc.dg/c1x-static-assert-6.c deleted file mode 100644 index ac7e141..0000000 --- a/gcc/testsuite/gcc.dg/c1x-static-assert-6.c +++ /dev/null @@ -1,5 +0,0 @@ -/* Test C11 static assertions. Non-constant-expression with -pedantic. */ -/* { dg-do compile } */ -/* { dg-options "-std=c11 -pedantic" } */ - -_Static_assert ((int)(1.0 + 1.0), "non-constant-expression"); /* { dg-warning "not an integer constant expression" } */ diff --git a/gcc/testsuite/gcc.dg/c1x-typedef-1.c b/gcc/testsuite/gcc.dg/c1x-typedef-1.c deleted file mode 100644 index 3224ba5..0000000 --- a/gcc/testsuite/gcc.dg/c1x-typedef-1.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Test typedef redeclaration in C11. */ -/* { dg-do compile } */ -/* { dg-options "-std=c11 -pedantic-errors" } */ - -/* C11 permits typedefs to be redeclared to the same type, but not to - different-but-compatible types, and not when the type is variably - modified. */ - -#include - -typedef int TI; -typedef int TI2; -typedef TI2 TI; -typedef TI TI2; - -enum e { E1 = 0, E2 = INT_MAX, E3 = -1 }; -typedef enum e TE; -typedef enum e TE; /* { dg-message "previous declaration" } */ -typedef int TE; /* { dg-error "with different type" } */ - -struct s; -typedef struct s TS; -struct s { int i; }; -typedef struct s TS; - -typedef int IA[]; -typedef TI2 IA[]; /* { dg-message "previous declaration" } */ -typedef int A2[2]; -typedef TI A2[2]; /* { dg-message "previous declaration" } */ -typedef IA A2; /* { dg-error "with different type" } */ -typedef int A3[3]; -typedef A3 IA; /* { dg-error "with different type" } */ - -typedef void F(int); -typedef void F(TI); /* { dg-message "previous declaration" } */ -typedef void F(enum e); /* { dg-error "with different type" } */ - -typedef int G(void); -typedef TI G(void); /* { dg-message "previous declaration" } */ -typedef enum e G(void); /* { dg-error "with different type" } */ - -typedef int *P; -typedef TI *P; /* { dg-message "previous declaration" } */ -typedef enum e *P; /* { dg-error "with different type" } */ - -typedef void F2(); -typedef void F2(); /* { dg-message "previous declaration" } */ -typedef void F2(int); /* { dg-error "with different type" } */ - -void -f (void) -{ - int a = 1; - int b = 2; - typedef void FN(int (*p)[a]); - typedef void FN(int (*p)[b]); - typedef void FN(int (*p)[*]); /* { dg-message "previous declaration" } */ - typedef void FN(int (*p)[1]); /* { dg-error "with different type" } */ - typedef void FN2(int (*p)[a]); - typedef void FN2(int (*p)[b]); - typedef void FN2(int (*p)[*]); /* { dg-message "previous declaration" } */ - typedef void FN2(int (*p)[]); /* { dg-error "with different type" } */ - typedef int AV[a]; /* { dg-message "previous declaration" } */ - typedef int AV[b-1]; /* { dg-error "redefinition" } */ - typedef int AAa[a]; /* { dg-message "previous declaration" } */ - typedef int AAb[b-1]; - typedef AAa *VF(void); /* { dg-message "previous declaration" } */ - typedef AAb *VF(void); /* { dg-error "redefinition" } */ - typedef AAa AAa; /* { dg-error "redefinition" } */ -} diff --git a/gcc/testsuite/gcc.dg/c1x-uni-string-1.c b/gcc/testsuite/gcc.dg/c1x-uni-string-1.c deleted file mode 100644 index 9f86bea..0000000 --- a/gcc/testsuite/gcc.dg/c1x-uni-string-1.c +++ /dev/null @@ -1,112 +0,0 @@ -/* Test Unicode strings in C11. Test valid code. */ -/* { dg-do run } */ -/* { dg-options "-std=c11 -pedantic-errors" } */ - -/* More thorough tests are in c-c++-common/raw-string-*.c; this test - verifies the particular subset (Unicode but not raw strings) that - is in C11. */ - -typedef __CHAR16_TYPE__ char16_t; -typedef __CHAR32_TYPE__ char32_t; -typedef __SIZE_TYPE__ size_t; - -extern void abort (void); -extern void exit (int); -extern int memcmp (const void *, const void *, size_t); - -#define R "(R)" -#define u8R "(u8R)" -#define uR "(uR)" -#define UR "(UR)" -#define LR "(LR)" -#define u8 randomu8 -#define u randomu -#define U randomU - -const char su8[] = u8"a\u010d"; -const char su8a[] = "a\xc4\x8d"; - -const char16_t su16[] = u"\u0567"; -const char16_t su16a[] = { 0x0567, 0 }; - -const char32_t su32[] = U"\u0123"; -const char32_t su32a[] = { 0x0123, 0 }; - -const char tu[] = R"a"; -const char tua[] = "(R)a"; - -const char tu8[] = u8R"b"; -const char tu8a[] = "(u8R)b"; - -const char tu16[] = uR"c"; -const char tu16a[] = "(uR)c"; - -const char tu32[] = UR"d"; -const char tu32a[] = "(UR)d"; - -const char tl[] = LR"e"; -const char tla[] = "(LR)e"; - -#define str(x) #x -const char ts[] = str(u"a" U"b" u8"c"); -const char tsa[] = "u\"a\" U\"b\" u8\"c\""; - -/* GCC always uses UTF-16 and UTF-32 for char16_t and char32_t. */ -#ifndef __STDC_UTF_16__ -#error "__STDC_UTF_16__ not defined" -#endif -#ifndef __STDC_UTF_32__ -#error "__STDC_UTF_32__ not defined" -#endif -#define xstr(x) str(x) -const char tm16[] = xstr(__STDC_UTF_16__); -const char tm16a[] = "1"; -const char tm32[] = xstr(__STDC_UTF_32__); -const char tm32a[] = "1"; - -int -main (void) -{ - if (sizeof (su8) != sizeof (su8a) - || memcmp (su8, su8a, sizeof (su8)) != 0) - abort (); - if (sizeof (su16) != sizeof (su16a) - || memcmp (su16, su16a, sizeof (su16)) != 0) - abort (); - if (sizeof (su32) != sizeof (su32a) - || memcmp (su32, su32a, sizeof (su32)) != 0) - abort (); - if (sizeof (tu) != sizeof (tua) - || memcmp (tu, tua, sizeof (tu)) != 0) - abort (); - if (sizeof (tu8) != sizeof (tu8a) - || memcmp (tu8, tu8a, sizeof (tu8)) != 0) - abort (); - if (sizeof (tu16) != sizeof (tu16a) - || memcmp (tu16, tu16a, sizeof (tu16)) != 0) - abort (); - if (sizeof (tu32) != sizeof (tu32a) - || memcmp (tu32, tu32a, sizeof (tu32)) != 0) - abort (); - if (sizeof (tl) != sizeof (tla) - || memcmp (tl, tla, sizeof (tl)) != 0) - abort (); - if (sizeof (ts) != sizeof (tsa) - || memcmp (ts, tsa, sizeof (ts)) != 0) - abort (); - if (sizeof (tm16) != sizeof (tm16a) - || memcmp (tm16, tm16a, sizeof (tm16)) != 0) - abort (); - if (sizeof (tm32) != sizeof (tm32a) - || memcmp (tm32, tm32a, sizeof (tm32)) != 0) - abort (); - if (u'\u0123' != 0x0123) - abort (); - if (U'\u0456' != 0x0456) - abort (); -#undef u8 -#define u8 - if (u8'a' != 'a') - abort (); - exit (0); -} diff --git a/gcc/testsuite/gcc.dg/c1x-uni-string-2.c b/gcc/testsuite/gcc.dg/c1x-uni-string-2.c deleted file mode 100644 index 583c38a..0000000 --- a/gcc/testsuite/gcc.dg/c1x-uni-string-2.c +++ /dev/null @@ -1,8 +0,0 @@ -/* Test Unicode strings in C11. Test constraint. */ -/* { dg-do compile } */ -/* { dg-options "-std=c11 -pedantic-errors" } */ - -const void *p1 = L"a" u8"b"; /* { dg-error "concatenation" } */ -const void *p2 = L"a" "b" u8"c"; /* { dg-error "concatenation" } */ -const void *p3 = u8"a" L"b"; /* { dg-error "concatenation" } */ -const void *p4 = u8"a" "b" L"c"; /* { dg-error "concatenation" } */ -- cgit v1.1