aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-02-12 11:38:19 -0800
committerIan Lance Taylor <iant@golang.org>2021-02-12 11:38:19 -0800
commit89d7be42db00cd0953e7d4584877cf50a56ed046 (patch)
tree3a471e8ee60b7be687ab7501f70379618adcf174 /gcc/c-family
parent305e9d2c7815e90a29bbde1e3a7cd776861f4d7c (diff)
parent9769564e7456453e2273071d0faa5aab2554ff78 (diff)
downloadgcc-89d7be42db00cd0953e7d4584877cf50a56ed046.zip
gcc-89d7be42db00cd0953e7d4584877cf50a56ed046.tar.gz
gcc-89d7be42db00cd0953e7d4584877cf50a56ed046.tar.bz2
Merge from trunk revision 9769564e7456453e2273071d0faa5aab2554ff78.
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog13
-rw-r--r--gcc/c-family/c-common.c1
-rw-r--r--gcc/c-family/c-cppbuiltin.c5
-rw-r--r--gcc/c-family/c-lex.c8
-rw-r--r--gcc/c-family/c-warn.c20
5 files changed, 43 insertions, 4 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index fa67d1a..dfddd04 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,16 @@
+2021-02-10 Richard Biener <rguenther@suse.de>
+
+ * c-common.c (parse_optimize_options): Free decoded_options.
+
+2021-02-04 emsr <3dw4rd@verizon.net>
+
+ * c-cppbuiltin.c (c_cpp_builtins): __cpp_size_t_suffix=202011L.
+
+2021-02-03 Ed Smith-Rowland <3dw4rd@verizon.net>
+
+ * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_size_t_suffix.
+ * c-lex.c (interpret_integer): Set node type for size literal.
+
2021-01-28 Jakub Jelinek <jakub@redhat.com>
* c.opt (-std=c++2a, -std=c++20, -std=gnu++2a, -std=gnu++20): Remove
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 813212c..088626d 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -5770,6 +5770,7 @@ parse_optimize_options (tree args, bool attr_p)
decode_options (&global_options, &global_options_set,
decoded_options, decoded_options_count,
input_location, global_dc, NULL);
+ free (decoded_options);
targetm.override_options_after_change();
diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index dca6815..9f993c4 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -1025,6 +1025,11 @@ c_cpp_builtins (cpp_reader *pfile)
cpp_define (pfile, "__cpp_aggregate_paren_init=201902L");
cpp_define (pfile, "__cpp_using_enum=201907L");
}
+ if (cxx_dialect > cxx20)
+ {
+ /* Set feature test macros for C++23. */
+ cpp_define (pfile, "__cpp_size_t_suffix=202011L");
+ }
if (flag_concepts)
{
if (cxx_dialect >= cxx20)
diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c
index fe40a0f..6374b72 100644
--- a/gcc/c-family/c-lex.c
+++ b/gcc/c-family/c-lex.c
@@ -834,6 +834,14 @@ interpret_integer (const cpp_token *token, unsigned int flags,
type = ((flags & CPP_N_UNSIGNED)
? widest_unsigned_literal_type_node
: widest_integer_literal_type_node);
+ else if (flags & CPP_N_SIZE_T)
+ {
+ /* itk refers to fundamental types not aliased size types. */
+ if (flags & CPP_N_UNSIGNED)
+ type = size_type_node;
+ else
+ type = signed_size_type_node;
+ }
else
{
type = integer_types[itk];
diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c
index e6e28d9..2347e0b 100644
--- a/gcc/c-family/c-warn.c
+++ b/gcc/c-family/c-warn.c
@@ -3319,6 +3319,19 @@ warn_parm_ptrarray_mismatch (location_t origloc, tree curparms, tree newparms)
}
}
+/* Format EXPR if nonnull and return the formatted string. If EXPR is
+ null return DFLT. */
+
+static inline const char*
+expr_to_str (pretty_printer &pp, tree expr, const char *dflt)
+{
+ if (!expr)
+ return dflt;
+
+ dump_generic_node (&pp, expr, 0, TDF_VOPS | TDF_MEMSYMS, false);
+ return pp_formatted_text (&pp);
+}
+
/* Detect and diagnose a mismatch between an attribute access specification
on the original declaration of FNDECL and that on the parameters NEWPARMS
from its refeclaration. ORIGLOC is the location of the first declaration
@@ -3585,10 +3598,9 @@ warn_parm_array_mismatch (location_t origloc, tree fndecl, tree newparms)
the same. */
continue;
- const char* const newbndstr =
- newbnd ? print_generic_expr_to_str (newbnd) : "*";
- const char* const curbndstr =
- curbnd ? print_generic_expr_to_str (curbnd) : "*";
+ pretty_printer pp1, pp2;
+ const char* const newbndstr = expr_to_str (pp1, newbnd, "*");
+ const char* const curbndstr = expr_to_str (pp2, curbnd, "*");
if (!newpos != !curpos
|| (newpos && !tree_int_cst_equal (newpos, curpos)))