diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c-family/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c-family/c.opt | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/dfp/c11-constants-1.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/dfp/c11-constants-2.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/dfp/c2x-constants-1.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/dfp/c2x-constants-2.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/dfp/constants-pedantic.c | 14 |
8 files changed, 73 insertions, 8 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index a0ce54b..fea97bb 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,5 +1,10 @@ 2019-10-11 Joseph Myers <joseph@codesourcery.com> + * c.opt (Wc11-c2x-compat): Add CPP(cpp_warn_c11_c2x_compat) + CppReason(CPP_W_C11_C2X_COMPAT). + +2019-10-11 Joseph Myers <joseph@codesourcery.com> + * c-common.c (c_common_reswords): Do not use D_EXT for _Decimal32, _Decimal64 and _Decimal128. diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index a1360ba..495eb16 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -367,7 +367,7 @@ C ObjC C++ ObjC++ CPP(warn_builtin_macro_redefined) CppReason(CPP_W_BUILTIN_MACR Warn when a built-in preprocessor macro is undefined or redefined. Wc11-c2x-compat -C ObjC Var(warn_c11_c2x_compat) Init(-1) Warning +C ObjC CPP(cpp_warn_c11_c2x_compat) CppReason(CPP_W_C11_C2X_COMPAT) Var(warn_c11_c2x_compat) Init(-1) Warning Warn about features not present in ISO C11, but present in ISO C2X. Wc90-c99-compat diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dadb442..9b31f35 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-10-11 Joseph Myers <joseph@codesourcery.com> + + * gcc.dg/dfp/c11-constants-1.c, gcc.dg/dfp/c11-constants-2.c, + gcc.dg/dfp/c2x-constants-1.c, gcc.dg/dfp/c2x-constants-2.c: New + tests. + * gcc.dg/dfp/constants-pedantic.c: Use -std=gnu17 explicitly. + Update expected diagnostics. + 2019-10-11 Marek Polacek <polacek@redhat.com> PR c++/92070 - bogus error with -fchecking=2. diff --git a/gcc/testsuite/gcc.dg/dfp/c11-constants-1.c b/gcc/testsuite/gcc.dg/dfp/c11-constants-1.c new file mode 100644 index 0000000..472ed25 --- /dev/null +++ b/gcc/testsuite/gcc.dg/dfp/c11-constants-1.c @@ -0,0 +1,13 @@ +/* Test that DFP constants are diagnosed in C11 mode: -pedantic. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic" } */ + +int a = (int) 1.1DF; /* { dg-warning "C2X feature" } */ +int b = (int) 2.df; /* { dg-warning "C2X feature" } */ +int c = (int) .33DD; /* { dg-warning "C2X feature" } */ +int d = (int) 2e1dd; /* { dg-warning "C2X feature" } */ +int e = (int) .3e2DL; /* { dg-warning "C2X feature" } */ +int f = (int) 4.5e3dl; /* { dg-warning "C2X feature" } */ +int g = (int) 5.e0DF; /* { dg-warning "C2X feature" } */ +int h = (int) 1e+2df; /* { dg-warning "C2X feature" } */ +int i = (int) 1000e-3DL; /* { dg-warning "C2X feature" } */ diff --git a/gcc/testsuite/gcc.dg/dfp/c11-constants-2.c b/gcc/testsuite/gcc.dg/dfp/c11-constants-2.c new file mode 100644 index 0000000..79b20a2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/dfp/c11-constants-2.c @@ -0,0 +1,13 @@ +/* Test that DFP constants are diagnosed in C11 mode: -pedantic-errors. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +int a = (int) 1.1DF; /* { dg-error "C2X feature" } */ +int b = (int) 2.df; /* { dg-error "C2X feature" } */ +int c = (int) .33DD; /* { dg-error "C2X feature" } */ +int d = (int) 2e1dd; /* { dg-error "C2X feature" } */ +int e = (int) .3e2DL; /* { dg-error "C2X feature" } */ +int f = (int) 4.5e3dl; /* { dg-error "C2X feature" } */ +int g = (int) 5.e0DF; /* { dg-error "C2X feature" } */ +int h = (int) 1e+2df; /* { dg-error "C2X feature" } */ +int i = (int) 1000e-3DL; /* { dg-error "C2X feature" } */ diff --git a/gcc/testsuite/gcc.dg/dfp/c2x-constants-1.c b/gcc/testsuite/gcc.dg/dfp/c2x-constants-1.c new file mode 100644 index 0000000..3375506 --- /dev/null +++ b/gcc/testsuite/gcc.dg/dfp/c2x-constants-1.c @@ -0,0 +1,13 @@ +/* Test that DFP constants are accepted in C2X mode. */ +/* { dg-do compile } */ +/* { dg-options "-std=c2x -pedantic-errors" } */ + +int a = (int) 1.1DF; +int b = (int) 2.df; +int c = (int) .33DD; +int d = (int) 2e1dd; +int e = (int) .3e2DL; +int f = (int) 4.5e3dl; +int g = (int) 5.e0DF; +int h = (int) 1e+2df; +int i = (int) 1000e-3DL; diff --git a/gcc/testsuite/gcc.dg/dfp/c2x-constants-2.c b/gcc/testsuite/gcc.dg/dfp/c2x-constants-2.c new file mode 100644 index 0000000..eed35f2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/dfp/c2x-constants-2.c @@ -0,0 +1,13 @@ +/* Test that DFP constants are accepted in C2X mode: compat warnings. */ +/* { dg-do compile } */ +/* { dg-options "-std=c2x -Wc11-c2x-compat" } */ + +int a = (int) 1.1DF; /* { dg-warning "C2X feature" } */ +int b = (int) 2.df; /* { dg-warning "C2X feature" } */ +int c = (int) .33DD; /* { dg-warning "C2X feature" } */ +int d = (int) 2e1dd; /* { dg-warning "C2X feature" } */ +int e = (int) .3e2DL; /* { dg-warning "C2X feature" } */ +int f = (int) 4.5e3dl; /* { dg-warning "C2X feature" } */ +int g = (int) 5.e0DF; /* { dg-warning "C2X feature" } */ +int h = (int) 1e+2df; /* { dg-warning "C2X feature" } */ +int i = (int) 1000e-3DL; /* { dg-warning "C2X feature" } */ diff --git a/gcc/testsuite/gcc.dg/dfp/constants-pedantic.c b/gcc/testsuite/gcc.dg/dfp/constants-pedantic.c index be81b0f..1d85fed 100644 --- a/gcc/testsuite/gcc.dg/dfp/constants-pedantic.c +++ b/gcc/testsuite/gcc.dg/dfp/constants-pedantic.c @@ -1,14 +1,14 @@ /* { dg-do compile } */ -/* { dg-options "-pedantic" } */ +/* { dg-options "-std=gnu17 -pedantic" } */ /* N1150 6: Constants. C99 6.4.4.2: Floating constants. */ #include "dfp-dbg.h" -_Decimal32 a = 1.1df; /* { dg-warning "GCC extension|ISO C" } */ -_Decimal32 b = -.003DF; /* { dg-warning "GCC extension|ISO C" } */ -_Decimal64 c = 11e-1dl; /* { dg-warning "GCC extension|ISO C" } */ -_Decimal64 d = -.3DL; /* { dg-warning "GCC extension|ISO C" } */ -_Decimal128 e = 000.3e0dl; /* { dg-warning "GCC extension|ISO C" } */ -_Decimal128 f = 3000300030003e0DL; /* { dg-warning "GCC extension|ISO C" } */ +_Decimal32 a = 1.1df; /* { dg-warning "C2X feature|ISO C" } */ +_Decimal32 b = -.003DF; /* { dg-warning "C2X feature|ISO C" } */ +_Decimal64 c = 11e-1dl; /* { dg-warning "C2X feature|ISO C" } */ +_Decimal64 d = -.3DL; /* { dg-warning "C2X feature|ISO C" } */ +_Decimal128 e = 000.3e0dl; /* { dg-warning "C2X feature|ISO C" } */ +_Decimal128 f = 3000300030003e0DL; /* { dg-warning "C2X feature|ISO C" } */ |