aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2019-10-11 23:22:52 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2019-10-11 23:22:52 +0100
commit175a85b29718141d73230ed19efcfcf963a0d0b6 (patch)
tree298edc1e58a374a72a21832169c07cd2157bcb8b /gcc/c-family
parent53f3c1a103d3939c1bf72361830280fa621d528a (diff)
downloadgcc-175a85b29718141d73230ed19efcfcf963a0d0b6.zip
gcc-175a85b29718141d73230ed19efcfcf963a0d0b6.tar.gz
gcc-175a85b29718141d73230ed19efcfcf963a0d0b6.tar.bz2
Support decimal floating-point constants in C2x.
ISO C2x adds decimal floating point as an optional standard feature. This patch accordingly makes GCC accept DFP constants (DF, DD, DL, df, dd, dl suffixes) in strict C2X mode, with a pedwarn-if-pedantic for older standards and a warning with -Wc11-c2x-compat even in C2x mode (which in turn requires -Wc11-c2x-compat to be newly passed through to libcpp). Bootstrapped with no regressions on x86_64-pc-linux-gnu. gcc/c-family: * c.opt (Wc11-c2x-compat): Add CPP(cpp_warn_c11_c2x_compat) CppReason(CPP_W_C11_C2X_COMPAT). gcc/testsuite: * 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. libcpp: * include/cpplib.h (struct cpp_options): Add dfp_constants and cpp_warn_c11_c2x_compat. (enum cpp_warning_reason): Add CPP_W_C11_C2X_COMPAT. * init.c (struct lang_flags): Add dfp_constants. (lang_defaults): Set dfp_constants to 1 for GNUC2X and STDC2X and 0 for other languages. (cpp_set_lang): Set dfp_constants from language. (cpp_create_reader): Set cpp_warn_c11_c2x_compat to -1. * expr.c (interpret_float_suffix): Mention DFP constants as C2X in comment. (cpp_classify_number): Do not diagnose DFP constants for languages setting dfp_constants, unless cpp_warn_c11_c2x_compat. From-SVN: r276908
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog5
-rw-r--r--gcc/c-family/c.opt2
2 files changed, 6 insertions, 1 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