aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-02-02 12:42:10 -0800
committerIan Lance Taylor <iant@golang.org>2021-02-02 12:42:10 -0800
commit8910f1cd79445bbe2da01f8ccf7c37909349529e (patch)
treeba67a346969358fd7cc2b7c12384479de8364cab /gcc/c-family
parent45c32be1f96ace25b66c34a84818dc5e07e9d516 (diff)
parent8e4a738d2540ab6aff77506d368bf4e3fa6963bd (diff)
downloadgcc-8910f1cd79445bbe2da01f8ccf7c37909349529e.zip
gcc-8910f1cd79445bbe2da01f8ccf7c37909349529e.tar.gz
gcc-8910f1cd79445bbe2da01f8ccf7c37909349529e.tar.bz2
Merge from trunk revision 8e4a738d2540ab6aff77506d368bf4e3fa6963bd.
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog111
-rw-r--r--gcc/c-family/c-ada-spec.c2
-rw-r--r--gcc/c-family/c-ada-spec.h2
-rw-r--r--gcc/c-family/c-attribs.c168
-rw-r--r--gcc/c-family/c-common.c4
-rw-r--r--gcc/c-family/c-common.def2
-rw-r--r--gcc/c-family/c-common.h6
-rw-r--r--gcc/c-family/c-cppbuiltin.c2
-rw-r--r--gcc/c-family/c-dump.c2
-rw-r--r--gcc/c-family/c-format.c2
-rw-r--r--gcc/c-family/c-format.h2
-rw-r--r--gcc/c-family/c-gimplify.c2
-rw-r--r--gcc/c-family/c-indentation.c2
-rw-r--r--gcc/c-family/c-indentation.h2
-rw-r--r--gcc/c-family/c-lex.c2
-rw-r--r--gcc/c-family/c-objc.h2
-rw-r--r--gcc/c-family/c-omp.c2
-rw-r--r--gcc/c-family/c-opts.c31
-rw-r--r--gcc/c-family/c-pch.c2
-rw-r--r--gcc/c-family/c-ppoutput.c2
-rw-r--r--gcc/c-family/c-pragma.c5
-rw-r--r--gcc/c-family/c-pragma.h6
-rw-r--r--gcc/c-family/c-pretty-print.c358
-rw-r--r--gcc/c-family/c-pretty-print.h2
-rw-r--r--gcc/c-family/c-semantics.c2
-rw-r--r--gcc/c-family/c-spellcheck.cc2
-rw-r--r--gcc/c-family/c-spellcheck.h2
-rw-r--r--gcc/c-family/c-target-def.h2
-rw-r--r--gcc/c-family/c-target.def2
-rw-r--r--gcc/c-family/c-target.h2
-rw-r--r--gcc/c-family/c-ubsan.c2
-rw-r--r--gcc/c-family/c-ubsan.h2
-rw-r--r--gcc/c-family/c-warn.c2
-rw-r--r--gcc/c-family/c.opt50
-rw-r--r--gcc/c-family/cppspec.c2
-rw-r--r--gcc/c-family/known-headers.cc2
-rw-r--r--gcc/c-family/known-headers.h2
-rw-r--r--gcc/c-family/name-hint.h2
-rw-r--r--gcc/c-family/stub-objc.c2
39 files changed, 699 insertions, 100 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 2e88f20..fa67d1a 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,112 @@
+2021-01-28 Jakub Jelinek <jakub@redhat.com>
+
+ * c.opt (-std=c++2a, -std=c++20, -std=gnu++2a, -std=gnu++20): Remove
+ draft from description.
+ (-std=c++2b): Fix a pasto, 2020 -> 2023.
+
+2021-01-26 Paul Fee <paul.f.fee@gmail.com>
+
+ * c-common.h (cxx_dialect): Add cxx23 as a dialect.
+ * c.opt: Add options for -std=c++23, std=c++2b, -std=gnu++23
+ and -std=gnu++2b
+ * c-opts.c (set_std_cxx23): New.
+ (c_common_handle_option): Set options when -std=c++23 is enabled.
+ (c_common_post_options): Adjust comments.
+ (set_std_cxx20): Likewise.
+
+2021-01-25 Martin Sebor <msebor@redhat.com>
+
+ PR c++/98646
+ * c-common.c (check_nonnull_arg): Adjust warning text.
+
+2021-01-17 Martin Sebor <msebor@redhat.com>
+
+ * c-pretty-print.c (c_pretty_printer::primary_expression): Don't
+ assume SSA_NAME_IDENTIFIER evaluates to nonzero.
+
+2021-01-16 Kwok Cheung Yeung <kcy@codesourcery.com>
+
+ * c-pragma.h (pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_DETACH.
+ Redefine PRAGMA_OACC_CLAUSE_DETACH.
+
+2021-01-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/98597
+ * c-pretty-print.c: Include options.h.
+ (c_fold_indirect_ref_for_warn): New function.
+ (print_mem_ref): Use it. If it returns something that has compatible
+ type and is TBAA compatible with zero offset, print it and return,
+ otherwise print it using offsetof syntax or array ref syntax. Fix up
+ printing if MEM_REFs first operand is ADDR_EXPR, or when the first
+ argument has pointer to array type. Print pointers using the standard
+ formatting.
+
+2021-01-12 Martin Sebor <msebor@redhat.com>
+
+ PR c/98597
+ PR c/98592
+ * c-pretty-print.c (print_mem_ref): Avoid assuming MEM_REF operand
+ has pointer type. Remove redundant code. Avoid calling
+ gimple_canonical_types_compatible_p.
+
+2021-01-07 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/98578
+ * c-pretty-print.c (print_mem_ref): Strip array from access type.
+ Avoid assuming acces type's size is constant. Correct condition
+ guarding the printing of a parenthesis.
+
+2021-01-06 Martin Sebor <msebor@redhat.com>
+
+ PR c++/95768
+ * c-pretty-print.c (c_pretty_printer::primary_expression): For
+ SSA_NAMEs print VLA names and GIMPLE defining statements.
+ (print_mem_ref): New function.
+ (c_pretty_printer::unary_expression): Call it.
+
+2021-01-06 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/95582
+ * c-attribs.c (c_common_attribute_table): Add entry for
+ signed_bool_precision.
+ (handle_signed_bool_precision_attribute): New.
+
+2020-12-24 Iain Sandoe <iain@sandoe.co.uk>
+
+ * c.opt: Add -stdlib= option and enumerations for
+ libstdc++ and libc++.
+
+2020-12-16 Martin Liska <mliska@suse.cz>
+
+ * c.opt: Remove usage of Report.
+
+2020-12-14 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/98166
+ PR c++/57111
+ PR middle-end/98160
+ * c-attribs.c (maybe_add_noinline): New function.
+ (handle_malloc_attribute): Call it. Use ATTR_FLAG_INTERNAL.
+ Implicitly add attribute noinline to functions not declared inline
+ and warn on those.
+
+2020-12-09 Tobias Burnus <tobias@codesourcery.com>
+
+ * c-pragma.c (omp_pragmas): Add 'allocate'.
+ * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_ALLOCATE.
+
+2020-12-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/98187
+ * c-pragma.c (omp_pragmas): Remove "master".
+ (omp_pragmas_simd): Add "master".
+
+2020-12-07 Marek Polacek <polacek@redhat.com>
+
+ PR c++/98126
+ * c-common.c (verify_tree_lim_r): New function.
+ (verify_sequence_points): Use it. Use nullptr instead of 0.
+
2020-12-03 Martin Sebor <msebor@redhat.com>
PR c++/90629
@@ -11806,7 +11915,7 @@
* c-common.c: Include gt-c-family-c-common.h.
* c-pragma.c: Include gt-c-family-c-pragma.h.
-Copyright (C) 2010-2020 Free Software Foundation, Inc.
+Copyright (C) 2010-2021 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c
index 883036f..bc0aa5e 100644
--- a/gcc/c-family/c-ada-spec.c
+++ b/gcc/c-family/c-ada-spec.c
@@ -1,6 +1,6 @@
/* Print GENERIC declaration (functions, variables, types) trees coming from
the C and C++ front-ends as well as macros in Ada syntax.
- Copyright (C) 2010-2020 Free Software Foundation, Inc.
+ Copyright (C) 2010-2021 Free Software Foundation, Inc.
Adapted from tree-pretty-print.c by Arnaud Charlet <charlet@adacore.com>
This file is part of GCC.
diff --git a/gcc/c-family/c-ada-spec.h b/gcc/c-family/c-ada-spec.h
index 35638b1..d3c40d6 100644
--- a/gcc/c-family/c-ada-spec.h
+++ b/gcc/c-family/c-ada-spec.h
@@ -1,5 +1,5 @@
/* Interface for -fdump-ada-spec capability.
- Copyright (C) 2010-2020 Free Software Foundation, Inc.
+ Copyright (C) 2010-2021 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c
index f7dad7a..84ec86b 100644
--- a/gcc/c-family/c-attribs.c
+++ b/gcc/c-family/c-attribs.c
@@ -1,5 +1,5 @@
/* C-family attributes handling.
- Copyright (C) 1992-2020 Free Software Foundation, Inc.
+ Copyright (C) 1992-2021 Free Software Foundation, Inc.
This file is part of GCC.
@@ -161,6 +161,8 @@ static tree handle_copy_attribute (tree *, tree, tree, int, bool *);
static tree handle_nsobject_attribute (tree *, tree, tree, int, bool *);
static tree handle_objc_root_class_attribute (tree *, tree, tree, int, bool *);
static tree handle_objc_nullability_attribute (tree *, tree, tree, int, bool *);
+static tree handle_signed_bool_precision_attribute (tree *, tree, tree, int,
+ bool *);
/* Helper to define attribute exclusions. */
#define ATTR_EXCL(name, function, type, variable) \
@@ -274,6 +276,8 @@ const struct attribute_spec c_common_attribute_table[] =
{
/* { name, min_len, max_len, decl_req, type_req, fn_type_req,
affects_type_identity, handler, exclude } */
+ { "signed_bool_precision", 1, 1, false, true, false, true,
+ handle_signed_bool_precision_attribute, NULL },
{ "packed", 0, 0, false, false, false, false,
handle_packed_attribute,
attr_aligned_exclusions },
@@ -894,6 +898,43 @@ validate_attr_arg (tree node[2], tree name, tree newarg)
/* Attribute handlers common to C front ends. */
+/* Handle a "signed_bool_precision" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_signed_bool_precision_attribute (tree *node, tree name, tree args,
+ int, bool *no_add_attrs)
+{
+ *no_add_attrs = true;
+ if (!flag_gimple)
+ {
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
+ return NULL_TREE;
+ }
+
+ if (!TYPE_P (*node) || TREE_CODE (*node) != BOOLEAN_TYPE)
+ {
+ warning (OPT_Wattributes, "%qE attribute only supported on "
+ "boolean types", name);
+ return NULL_TREE;
+ }
+
+ unsigned HOST_WIDE_INT prec = HOST_WIDE_INT_M1U;
+ if (tree_fits_uhwi_p (TREE_VALUE (args)))
+ prec = tree_to_uhwi (TREE_VALUE (args));
+ if (prec > MAX_FIXED_MODE_SIZE)
+ {
+ warning (OPT_Wattributes, "%qE attribute with unsupported boolean "
+ "precision", name);
+ return NULL_TREE;
+ }
+
+ tree new_type = build_nonstandard_boolean_type (prec);
+ *node = lang_hooks.types.reconstruct_complex_type (*node, new_type);
+
+ return NULL_TREE;
+}
+
/* Handle a "packed" attribute; arguments as in
struct attribute_spec.handler. */
@@ -3130,12 +3171,64 @@ handle_no_profile_instrument_function_attribute (tree *node, tree name, tree,
return NULL_TREE;
}
+/* If ALLOC_DECL and DEALLOC_DECL are a pair of user-defined functions,
+ if they are declared inline issue warnings and return null. Otherwise
+ create attribute noinline, install it in ALLOC_DECL, and return it.
+ Otherwise return null. */
+
+static tree
+maybe_add_noinline (tree name, tree alloc_decl, tree dealloc_decl,
+ bool *no_add_attrs)
+{
+ if (fndecl_built_in_p (alloc_decl) || fndecl_built_in_p (dealloc_decl))
+ return NULL_TREE;
+
+ /* When inlining (or optimization) is enabled and the allocator and
+ deallocator are not built-in functions, ignore the attribute on
+ functions declared inline since it could lead to false positives
+ when inlining one or the other call would wind up calling
+ a mismatched allocator or deallocator. */
+ if ((optimize && DECL_DECLARED_INLINE_P (alloc_decl))
+ || lookup_attribute ("always_inline", DECL_ATTRIBUTES (alloc_decl)))
+ {
+ warning (OPT_Wattributes,
+ "%<%E (%E)%> attribute ignored on functions "
+ "declared %qs", name, DECL_NAME (dealloc_decl), "inline");
+ *no_add_attrs = true;
+ return NULL_TREE;
+ }
+
+ if ((optimize && DECL_DECLARED_INLINE_P (dealloc_decl))
+ || lookup_attribute ("always_inline", DECL_ATTRIBUTES (dealloc_decl)))
+ {
+ warning (OPT_Wattributes,
+ "%<%E (%E)%> attribute ignored with deallocation "
+ "functions declared %qs",
+ name, DECL_NAME (dealloc_decl), "inline");
+ inform (DECL_SOURCE_LOCATION (dealloc_decl),
+ "deallocation function declared here" );
+ *no_add_attrs = true;
+ return NULL_TREE;
+ }
+
+ /* Disable inlining for non-standard deallocators to avoid false
+ positives due to mismatches between the inlined implementation
+ of one and not the other pair of functions. */
+ tree attr = tree_cons (get_identifier ("noinline"), NULL_TREE, NULL_TREE);
+ decl_attributes (&alloc_decl, attr, 0);
+ return attr;
+}
+
/* Handle the "malloc" attribute. */
static tree
-handle_malloc_attribute (tree *node, tree name, tree args,
- int ARG_UNUSED (flags), bool *no_add_attrs)
+handle_malloc_attribute (tree *node, tree name, tree args, int flags,
+ bool *no_add_attrs)
{
+ if (flags & ATTR_FLAG_INTERNAL)
+ /* Recursive call. */
+ return NULL_TREE;
+
tree fndecl = *node;
if (TREE_CODE (*node) != FUNCTION_DECL)
@@ -3174,11 +3267,21 @@ handle_malloc_attribute (tree *node, tree name, tree args,
return NULL_TREE;
}
- /* In C++ the argument may be wrapped in a cast to disambiguate one
- of a number of overloads (such as operator delete). Strip it. */
STRIP_NOPS (dealloc);
if (TREE_CODE (dealloc) == ADDR_EXPR)
- dealloc = TREE_OPERAND (dealloc, 0);
+ {
+ /* In C++ the argument may be wrapped in a cast to disambiguate
+ one of a number of overloads (such as operator delete). To
+ make things interesting, the cast looks different between
+ different C++ versions. Strip it and install the attribute
+ with the disambiguated function. */
+ dealloc = TREE_OPERAND (dealloc, 0);
+
+ *no_add_attrs = true;
+ tree attr = tree_cons (NULL_TREE, dealloc, TREE_CHAIN (args));
+ attr = build_tree_list (name, attr);
+ return decl_attributes (node, attr, 0);
+ }
if (TREE_CODE (dealloc) != FUNCTION_DECL)
{
@@ -3233,10 +3336,21 @@ handle_malloc_attribute (tree *node, tree name, tree args,
return NULL_TREE;
}
- *no_add_attrs = false;
- tree attr_free = build_tree_list (NULL_TREE, DECL_NAME (fndecl));
- attr_free = build_tree_list (get_identifier ("*dealloc"), attr_free);
- decl_attributes (&dealloc, attr_free, 0);
+ /* Disable inlining for non-standard deallocators to avoid false
+ positives (or warn if either function is explicitly inline). */
+ tree at_noinline =
+ maybe_add_noinline (name, fndecl, dealloc, no_add_attrs);
+ if (*no_add_attrs)
+ return NULL_TREE;
+
+ /* Add attribute *dealloc to the deallocator function associating
+ it with this one. Ideally, the attribute would reference
+ the DECL of the deallocator but since that changes for each
+ redeclaration, use DECL_NAME instead. (DECL_ASSEMBLER_NAME
+ need not be set set this point and setting it here is too early. */
+ tree attrs = build_tree_list (NULL_TREE, DECL_NAME (fndecl));
+ attrs = tree_cons (get_identifier ("*dealloc"), attrs, at_noinline);
+ decl_attributes (&dealloc, attrs, 0);
return NULL_TREE;
}
@@ -3248,15 +3362,21 @@ handle_malloc_attribute (tree *node, tree name, tree args,
return NULL_TREE;
}
+ /* As above, disable inlining for non-standard deallocators to avoid
+ false positives (or warn). */
+ tree at_noinline =
+ maybe_add_noinline (name, fndecl, dealloc, no_add_attrs);
+ if (*no_add_attrs)
+ return NULL_TREE;
+
/* It's valid to declare the same function with multiple instances
of attribute malloc, each naming the same or different deallocator
functions, and each referencing either the same or a different
positional argument. */
- *no_add_attrs = false;
- tree attr_free = tree_cons (NULL_TREE, argpos, NULL_TREE);
- attr_free = tree_cons (NULL_TREE, DECL_NAME (fndecl), attr_free);
- attr_free = build_tree_list (get_identifier ("*dealloc"), attr_free);
- decl_attributes (&dealloc, attr_free, 0);
+ tree attrs = tree_cons (NULL_TREE, argpos, NULL_TREE);
+ attrs = tree_cons (NULL_TREE, DECL_NAME (fndecl), attrs);
+ attrs = tree_cons (get_identifier ("*dealloc"), attrs, at_noinline);
+ decl_attributes (&dealloc, attrs, 0);
return NULL_TREE;
}
@@ -3274,11 +3394,13 @@ handle_dealloc_attribute (tree *node, tree name, tree args, int,
if (!attrs)
return NULL_TREE;
- tree arg_fname = TREE_VALUE (args);
+ tree arg = TREE_VALUE (args);
args = TREE_CHAIN (args);
- tree arg_pos = args ? TREE_VALUE (args) : NULL_TREE;
+ tree arg_pos = args ? TREE_VALUE (args) : integer_zero_node;
- gcc_checking_assert (TREE_CODE (arg_fname) == IDENTIFIER_NODE);
+ gcc_checking_assert ((DECL_P (arg)
+ && fndecl_built_in_p (arg, BUILT_IN_NORMAL))
+ || TREE_CODE (arg) == IDENTIFIER_NODE);
const char* const namestr = IDENTIFIER_POINTER (name);
for (tree at = attrs; (at = lookup_attribute (namestr, at));
@@ -3290,12 +3412,12 @@ handle_dealloc_attribute (tree *node, tree name, tree args, int,
tree pos = TREE_CHAIN (alloc);
alloc = TREE_VALUE (alloc);
- pos = pos ? TREE_VALUE (pos) : NULL_TREE;
- gcc_checking_assert (TREE_CODE (alloc) == IDENTIFIER_NODE);
+ pos = pos ? TREE_VALUE (pos) : integer_zero_node;
+ gcc_checking_assert ((DECL_P (alloc)
+ && fndecl_built_in_p (alloc, BUILT_IN_NORMAL))
+ || TREE_CODE (alloc) == IDENTIFIER_NODE);
- if (alloc == arg_fname
- && ((!pos && !arg_pos)
- || (pos && arg_pos && tree_int_cst_equal (pos, arg_pos))))
+ if (alloc == arg && tree_int_cst_equal (pos, arg_pos))
{
/* The function already has the attribute either without any
arguments or with the same arguments as the attribute that's
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 0b348ae..813212c 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -1,5 +1,5 @@
/* Subroutines shared by all languages that are variants of C.
- Copyright (C) 1992-2020 Free Software Foundation, Inc.
+ Copyright (C) 1992-2021 Free Software Foundation, Inc.
This file is part of GCC.
@@ -5595,7 +5595,7 @@ check_nonnull_arg (void *ctx, tree param, unsigned HOST_WIDE_INT param_num)
if (param_num == 0)
{
warned = warning_at (loc, OPT_Wnonnull,
- "%qs pointer null", "this");
+ "%qs pointer is null", "this");
if (warned && pctx->fndecl)
inform (DECL_SOURCE_LOCATION (pctx->fndecl),
"in a call to non-static member function %qD",
diff --git a/gcc/c-family/c-common.def b/gcc/c-family/c-common.def
index 3d3e497..38b6b8c 100644
--- a/gcc/c-family/c-common.def
+++ b/gcc/c-family/c-common.def
@@ -1,7 +1,7 @@
/* This file contains the definitions and documentation for the
additional tree codes used in the GNU C compiler (see tree.def
for the standard codes).
- Copyright (C) 1987-2020 Free Software Foundation, Inc.
+ Copyright (C) 1987-2021 Free Software Foundation, Inc.
Written by Benjamin Chelf <chelf@codesourcery.com>
This file is part of GCC.
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 80830d8..f30b6c6 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -1,5 +1,5 @@
/* Definitions for c-common.c.
- Copyright (C) 1987-2020 Free Software Foundation, Inc.
+ Copyright (C) 1987-2021 Free Software Foundation, Inc.
This file is part of GCC.
@@ -738,7 +738,9 @@ enum cxx_dialect {
/* C++17 */
cxx17,
/* C++20 */
- cxx20
+ cxx20,
+ /* C++23 */
+ cxx23
};
/* The C++ dialect being used. C++98 is the default. */
diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index 7b7b07d..dca6815 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -1,5 +1,5 @@
/* Define builtin-in macros for the C family front ends.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/c-family/c-dump.c b/gcc/c-family/c-dump.c
index d3caacc..28b4ec2 100644
--- a/gcc/c-family/c-dump.c
+++ b/gcc/c-family/c-dump.c
@@ -1,5 +1,5 @@
/* Tree-dumping functionality for C-family languages.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 Free Software Foundation, Inc.
Written by Mark Mitchell <mark@codesourcery.com>
This file is part of GCC.
diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c
index 77d24ad..0a63cac 100644
--- a/gcc/c-family/c-format.c
+++ b/gcc/c-family/c-format.c
@@ -1,5 +1,5 @@
/* Check calls to formatted I/O functions (-Wformat).
- Copyright (C) 1992-2020 Free Software Foundation, Inc.
+ Copyright (C) 1992-2021 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/c-family/c-format.h b/gcc/c-family/c-format.h
index ff8a9f9..2f926f4 100644
--- a/gcc/c-family/c-format.h
+++ b/gcc/c-family/c-format.h
@@ -1,5 +1,5 @@
/* Check calls to formatted I/O functions (-Wformat).
- Copyright (C) 1992-2020 Free Software Foundation, Inc.
+ Copyright (C) 1992-2021 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/c-family/c-gimplify.c b/gcc/c-family/c-gimplify.c
index a7c0ec3..e1dfca2 100644
--- a/gcc/c-family/c-gimplify.c
+++ b/gcc/c-family/c-gimplify.c
@@ -2,7 +2,7 @@
by the C-based front ends. The structure of gimplified, or
language-independent, trees is dictated by the grammar described in this
file.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 Free Software Foundation, Inc.
Lowering of expressions contributed by Sebastian Pop <s.pop@laposte.net>
Re-written to support lowering of whole function trees, documentation
and miscellaneous cleanups by Diego Novillo <dnovillo@redhat.com>
diff --git a/gcc/c-family/c-indentation.c b/gcc/c-family/c-indentation.c
index 836a524..fb8da03 100644
--- a/gcc/c-family/c-indentation.c
+++ b/gcc/c-family/c-indentation.c
@@ -1,5 +1,5 @@
/* Implementation of -Wmisleading-indentation
- Copyright (C) 2015-2020 Free Software Foundation, Inc.
+ Copyright (C) 2015-2021 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/c-family/c-indentation.h b/gcc/c-family/c-indentation.h
index e183d3a..741067d 100644
--- a/gcc/c-family/c-indentation.h
+++ b/gcc/c-family/c-indentation.h
@@ -1,5 +1,5 @@
/* Definitions for c-indentation.c.
- Copyright (C) 2015-2020 Free Software Foundation, Inc.
+ Copyright (C) 2015-2021 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c
index c8d33d0..fe40a0f 100644
--- a/gcc/c-family/c-lex.c
+++ b/gcc/c-family/c-lex.c
@@ -1,5 +1,5 @@
/* Mainly the interface between cpplib and the C front ends.
- Copyright (C) 1987-2020 Free Software Foundation, Inc.
+ Copyright (C) 1987-2021 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/c-family/c-objc.h b/gcc/c-family/c-objc.h
index 4b50260..75fe434 100644
--- a/gcc/c-family/c-objc.h
+++ b/gcc/c-family/c-objc.h
@@ -1,5 +1,5 @@
/* Definitions of Objective-C front-end entry points used for C and C++.
- Copyright (C) 1987-2020 Free Software Foundation, Inc.
+ Copyright (C) 1987-2021 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c
index 8457211..fb1a0d6 100644
--- a/gcc/c-family/c-omp.c
+++ b/gcc/c-family/c-omp.c
@@ -1,7 +1,7 @@
/* This file contains routines to construct OpenACC and OpenMP constructs,
called from parsing in the C and C++ front ends.
- Copyright (C) 2005-2020 Free Software Foundation, Inc.
+ Copyright (C) 2005-2021 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>,
Diego Novillo <dnovillo@redhat.com>.
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 59cabd1..bd15b9c 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -1,5 +1,5 @@
/* C/ObjC/C++ command line option handling.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 Free Software Foundation, Inc.
Contributed by Neil Booth.
This file is part of GCC.
@@ -113,6 +113,7 @@ static void set_std_cxx11 (int);
static void set_std_cxx14 (int);
static void set_std_cxx17 (int);
static void set_std_cxx20 (int);
+static void set_std_cxx23 (int);
static void set_std_c89 (int, int);
static void set_std_c99 (int);
static void set_std_c11 (int);
@@ -649,6 +650,12 @@ c_common_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value,
set_std_cxx20 (code == OPT_std_c__20 /* ISO */);
break;
+ case OPT_std_c__23:
+ case OPT_std_gnu__23:
+ if (!preprocessing_asm_p)
+ set_std_cxx23 (code == OPT_std_c__23 /* ISO */);
+ break;
+
case OPT_std_c90:
case OPT_std_iso9899_199409:
if (!preprocessing_asm_p)
@@ -1019,7 +1026,7 @@ c_common_post_options (const char **pfilename)
warn_narrowing = 1;
/* Unless -f{,no-}ext-numeric-literals has been used explicitly,
- for -std=c++{11,14,17,2a} default to -fno-ext-numeric-literals. */
+ for -std=c++{11,14,17,20,23} default to -fno-ext-numeric-literals. */
if (flag_iso && !global_options_set.x_flag_ext_numeric_literals)
cpp_opts->ext_numeric_literals = 0;
}
@@ -1763,7 +1770,7 @@ set_std_cxx20 (int iso)
flag_no_gnu_keywords = iso;
flag_no_nonansi_builtin = iso;
flag_iso = iso;
- /* C++17 includes the C11 standard library. */
+ /* C++20 includes the C11 standard library. */
flag_isoc94 = 1;
flag_isoc99 = 1;
flag_isoc11 = 1;
@@ -1773,6 +1780,24 @@ set_std_cxx20 (int iso)
lang_hooks.name = "GNU C++20";
}
+/* Set the C++ 2023 standard (without GNU extensions if ISO). */
+static void
+set_std_cxx23 (int iso)
+{
+ cpp_set_lang (parse_in, iso ? CLK_CXX23: CLK_GNUCXX23);
+ flag_no_gnu_keywords = iso;
+ flag_no_nonansi_builtin = iso;
+ flag_iso = iso;
+ /* C++23 includes the C11 standard library. */
+ flag_isoc94 = 1;
+ flag_isoc99 = 1;
+ flag_isoc11 = 1;
+ /* C++23 includes coroutines. */
+ flag_coroutines = true;
+ cxx_dialect = cxx23;
+ lang_hooks.name = "GNU C++23";
+}
+
/* Args to -d specify what to dump. Silently ignore
unrecognized options; they may be aimed at toplev.c. */
static void
diff --git a/gcc/c-family/c-pch.c b/gcc/c-family/c-pch.c
index fdeb860..fd94c37 100644
--- a/gcc/c-family/c-pch.c
+++ b/gcc/c-family/c-pch.c
@@ -1,5 +1,5 @@
/* Precompiled header implementation for the C languages.
- Copyright (C) 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/c-family/c-ppoutput.c b/gcc/c-family/c-ppoutput.c
index e3e0e59..04e4164 100644
--- a/gcc/c-family/c-ppoutput.c
+++ b/gcc/c-family/c-ppoutput.c
@@ -1,5 +1,5 @@
/* Preprocess only, using cpplib.
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 Free Software Foundation, Inc.
Written by Per Bothner, 1994-95.
This program is free software; you can redistribute it and/or modify it
diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c
index d68985c..4f8e8e0 100644
--- a/gcc/c-family/c-pragma.c
+++ b/gcc/c-family/c-pragma.c
@@ -1,5 +1,5 @@
/* Handle #pragma, system V.4 style. Supports #pragma weak and #pragma pack.
- Copyright (C) 1992-2020 Free Software Foundation, Inc.
+ Copyright (C) 1992-2021 Free Software Foundation, Inc.
This file is part of GCC.
@@ -1309,6 +1309,7 @@ static const struct omp_pragma_def oacc_pragmas[] = {
{ "wait", PRAGMA_OACC_WAIT }
};
static const struct omp_pragma_def omp_pragmas[] = {
+ { "allocate", PRAGMA_OMP_ALLOCATE },
{ "atomic", PRAGMA_OMP_ATOMIC },
{ "barrier", PRAGMA_OMP_BARRIER },
{ "cancel", PRAGMA_OMP_CANCEL },
@@ -1317,7 +1318,6 @@ static const struct omp_pragma_def omp_pragmas[] = {
{ "depobj", PRAGMA_OMP_DEPOBJ },
{ "end", PRAGMA_OMP_END_DECLARE_TARGET },
{ "flush", PRAGMA_OMP_FLUSH },
- { "master", PRAGMA_OMP_MASTER },
{ "requires", PRAGMA_OMP_REQUIRES },
{ "section", PRAGMA_OMP_SECTION },
{ "sections", PRAGMA_OMP_SECTIONS },
@@ -1333,6 +1333,7 @@ static const struct omp_pragma_def omp_pragmas_simd[] = {
{ "distribute", PRAGMA_OMP_DISTRIBUTE },
{ "for", PRAGMA_OMP_FOR },
{ "loop", PRAGMA_OMP_LOOP },
+ { "master", PRAGMA_OMP_MASTER },
{ "ordered", PRAGMA_OMP_ORDERED },
{ "parallel", PRAGMA_OMP_PARALLEL },
{ "scan", PRAGMA_OMP_SCAN },
diff --git a/gcc/c-family/c-pragma.h b/gcc/c-family/c-pragma.h
index 5a493fe..6c34ffa 100644
--- a/gcc/c-family/c-pragma.h
+++ b/gcc/c-family/c-pragma.h
@@ -1,5 +1,5 @@
/* Pragma related interfaces.
- Copyright (C) 1995-2020 Free Software Foundation, Inc.
+ Copyright (C) 1995-2021 Free Software Foundation, Inc.
This file is part of GCC.
@@ -42,6 +42,7 @@ enum pragma_kind {
PRAGMA_OACC_UPDATE,
PRAGMA_OACC_WAIT,
+ PRAGMA_OMP_ALLOCATE,
PRAGMA_OMP_ATOMIC,
PRAGMA_OMP_BARRIER,
PRAGMA_OMP_CANCEL,
@@ -94,6 +95,7 @@ enum pragma_omp_clause {
PRAGMA_OMP_CLAUSE_DEFAULT,
PRAGMA_OMP_CLAUSE_DEFAULTMAP,
PRAGMA_OMP_CLAUSE_DEPEND,
+ PRAGMA_OMP_CLAUSE_DETACH,
PRAGMA_OMP_CLAUSE_DEVICE,
PRAGMA_OMP_CLAUSE_DEVICE_TYPE,
PRAGMA_OMP_CLAUSE_DIST_SCHEDULE,
@@ -150,7 +152,6 @@ enum pragma_omp_clause {
PRAGMA_OACC_CLAUSE_COPYOUT,
PRAGMA_OACC_CLAUSE_CREATE,
PRAGMA_OACC_CLAUSE_DELETE,
- PRAGMA_OACC_CLAUSE_DETACH,
PRAGMA_OACC_CLAUSE_DEVICEPTR,
PRAGMA_OACC_CLAUSE_DEVICE_RESIDENT,
PRAGMA_OACC_CLAUSE_FINALIZE,
@@ -173,6 +174,7 @@ enum pragma_omp_clause {
PRAGMA_OACC_CLAUSE_COPYIN = PRAGMA_OMP_CLAUSE_COPYIN,
PRAGMA_OACC_CLAUSE_DEVICE = PRAGMA_OMP_CLAUSE_DEVICE,
PRAGMA_OACC_CLAUSE_DEFAULT = PRAGMA_OMP_CLAUSE_DEFAULT,
+ PRAGMA_OACC_CLAUSE_DETACH = PRAGMA_OMP_CLAUSE_DETACH,
PRAGMA_OACC_CLAUSE_FIRSTPRIVATE = PRAGMA_OMP_CLAUSE_FIRSTPRIVATE,
PRAGMA_OACC_CLAUSE_IF = PRAGMA_OMP_CLAUSE_IF,
PRAGMA_OACC_CLAUSE_PRIVATE = PRAGMA_OMP_CLAUSE_PRIVATE,
diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c
index 3027703..2095d4b 100644
--- a/gcc/c-family/c-pretty-print.c
+++ b/gcc/c-family/c-pretty-print.c
@@ -1,5 +1,5 @@
/* Subroutines common to both C and C++ pretty-printers.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
This file is part of GCC.
@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "c-pretty-print.h"
+#include "gimple-pretty-print.h"
#include "diagnostic.h"
#include "stor-layout.h"
#include "stringpool.h"
@@ -30,6 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pretty-print.h"
#include "selftest.h"
#include "langhooks.h"
+#include "options.h"
/* The pretty-printer code is primarily designed to closely follow
(GNU) C and C++ grammars. That is to be contrasted with spaghetti
@@ -1334,6 +1336,39 @@ c_pretty_printer::primary_expression (tree e)
pp_c_right_paren (this);
break;
+ case SSA_NAME:
+ if (SSA_NAME_VAR (e))
+ {
+ tree var = SSA_NAME_VAR (e);
+ if (tree id = SSA_NAME_IDENTIFIER (e))
+ {
+ const char *name = IDENTIFIER_POINTER (id);
+ const char *dot;
+ if (DECL_ARTIFICIAL (var) && (dot = strchr (name, '.')))
+ {
+ /* Print the name without the . suffix (such as in VLAs).
+ Use pp_c_identifier so that it can be converted into
+ the appropriate encoding. */
+ size_t size = dot - name;
+ char *ident = XALLOCAVEC (char, size + 1);
+ memcpy (ident, name, size);
+ ident[size] = '\0';
+ pp_c_identifier (this, ident);
+ }
+ else
+ primary_expression (var);
+ }
+ else
+ primary_expression (var);
+ }
+ else
+ {
+ /* Print only the right side of the GIMPLE assignment. */
+ gimple *def_stmt = SSA_NAME_DEF_STMT (e);
+ pp_gimple_stmt_1 (this, def_stmt, 0, TDF_RHS_ONLY);
+ }
+ break;
+
default:
/* FIXME: Make sure we won't get into an infinite loop. */
if (location_wrapper_p (e))
@@ -1780,6 +1815,302 @@ pp_c_call_argument_list (c_pretty_printer *pp, tree t)
pp_c_right_paren (pp);
}
+/* Try to fold *(type *)&op into op.fld.fld2[1] if possible.
+ Only used for printing expressions. Should punt if ambiguous
+ (e.g. in unions). */
+
+static tree
+c_fold_indirect_ref_for_warn (location_t loc, tree type, tree op,
+ offset_int &off)
+{
+ tree optype = TREE_TYPE (op);
+ if (off == 0)
+ {
+ if (lang_hooks.types_compatible_p (optype, type))
+ return op;
+ /* *(foo *)&complexfoo => __real__ complexfoo */
+ else if (TREE_CODE (optype) == COMPLEX_TYPE
+ && lang_hooks.types_compatible_p (type, TREE_TYPE (optype)))
+ return build1_loc (loc, REALPART_EXPR, type, op);
+ }
+ /* ((foo*)&complexfoo)[1] => __imag__ complexfoo */
+ else if (TREE_CODE (optype) == COMPLEX_TYPE
+ && lang_hooks.types_compatible_p (type, TREE_TYPE (optype))
+ && tree_to_uhwi (TYPE_SIZE_UNIT (type)) == off)
+ {
+ off = 0;
+ return build1_loc (loc, IMAGPART_EXPR, type, op);
+ }
+ /* ((foo *)&fooarray)[x] => fooarray[x] */
+ if (TREE_CODE (optype) == ARRAY_TYPE
+ && TYPE_SIZE_UNIT (TREE_TYPE (optype))
+ && TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (optype))) == INTEGER_CST
+ && !integer_zerop (TYPE_SIZE_UNIT (TREE_TYPE (optype))))
+ {
+ tree type_domain = TYPE_DOMAIN (optype);
+ tree min_val = size_zero_node;
+ if (type_domain && TYPE_MIN_VALUE (type_domain))
+ min_val = TYPE_MIN_VALUE (type_domain);
+ offset_int el_sz = wi::to_offset (TYPE_SIZE_UNIT (TREE_TYPE (optype)));
+ offset_int idx = off / el_sz;
+ offset_int rem = off % el_sz;
+ if (TREE_CODE (min_val) == INTEGER_CST)
+ {
+ tree index
+ = wide_int_to_tree (sizetype, idx + wi::to_offset (min_val));
+ op = build4_loc (loc, ARRAY_REF, TREE_TYPE (optype), op, index,
+ NULL_TREE, NULL_TREE);
+ off = rem;
+ if (tree ret = c_fold_indirect_ref_for_warn (loc, type, op, off))
+ return ret;
+ return op;
+ }
+ }
+ /* ((foo *)&struct_with_foo_field)[x] => COMPONENT_REF */
+ else if (TREE_CODE (optype) == RECORD_TYPE)
+ {
+ for (tree field = TYPE_FIELDS (optype);
+ field; field = DECL_CHAIN (field))
+ if (TREE_CODE (field) == FIELD_DECL
+ && TREE_TYPE (field) != error_mark_node
+ && TYPE_SIZE_UNIT (TREE_TYPE (field))
+ && TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (field))) == INTEGER_CST)
+ {
+ tree pos = byte_position (field);
+ if (TREE_CODE (pos) != INTEGER_CST)
+ continue;
+ offset_int upos = wi::to_offset (pos);
+ offset_int el_sz
+ = wi::to_offset (TYPE_SIZE_UNIT (TREE_TYPE (field)));
+ if (upos <= off && off < upos + el_sz)
+ {
+ tree cop = build3_loc (loc, COMPONENT_REF, TREE_TYPE (field),
+ op, field, NULL_TREE);
+ off = off - upos;
+ if (tree ret = c_fold_indirect_ref_for_warn (loc, type, cop,
+ off))
+ return ret;
+ return cop;
+ }
+ }
+ }
+ /* Similarly for unions, but in this case try to be very conservative,
+ only match if some field has type compatible with type and it is the
+ only such field. */
+ else if (TREE_CODE (optype) == UNION_TYPE)
+ {
+ tree fld = NULL_TREE;
+ for (tree field = TYPE_FIELDS (optype);
+ field; field = DECL_CHAIN (field))
+ if (TREE_CODE (field) == FIELD_DECL
+ && TREE_TYPE (field) != error_mark_node
+ && lang_hooks.types_compatible_p (TREE_TYPE (field), type))
+ {
+ if (fld)
+ return NULL_TREE;
+ else
+ fld = field;
+ }
+ if (fld)
+ {
+ off = 0;
+ return build3_loc (loc, COMPONENT_REF, TREE_TYPE (fld), op, fld,
+ NULL_TREE);
+ }
+ }
+
+ return NULL_TREE;
+}
+
+/* Print the MEM_REF expression REF, including its type and offset.
+ Apply casts as necessary if the type of the access is different
+ from the type of the accessed object. Produce compact output
+ designed to include both the element index as well as any
+ misalignment by preferring
+ ((int*)((char*)p + 1))[2]
+ over
+ *(int*)((char*)p + 9)
+ The former is more verbose but makes it clearer that the access
+ to the third element of the array is misaligned by one byte. */
+
+static void
+print_mem_ref (c_pretty_printer *pp, tree e)
+{
+ tree arg = TREE_OPERAND (e, 0);
+
+ /* The byte offset. Initially equal to the MEM_REF offset, then
+ adjusted to the remainder of the division by the byte size of
+ the access. */
+ offset_int byte_off = wi::to_offset (TREE_OPERAND (e, 1));
+ /* The result of dividing BYTE_OFF by the size of the access. */
+ offset_int elt_idx = 0;
+ /* True to include a cast to char* (for a nonzero final BYTE_OFF). */
+ bool char_cast = false;
+ tree op = NULL_TREE;
+ bool array_ref_only = false;
+ if (TREE_CODE (arg) == ADDR_EXPR)
+ {
+ op = c_fold_indirect_ref_for_warn (EXPR_LOCATION (e), TREE_TYPE (e),
+ TREE_OPERAND (arg, 0), byte_off);
+ /* Try to fold it back to component, array ref or their combination,
+ but print it only if the types and TBAA types are compatible. */
+ if (op
+ && byte_off == 0
+ && lang_hooks.types_compatible_p (TREE_TYPE (e), TREE_TYPE (op))
+ && (!flag_strict_aliasing
+ || (get_deref_alias_set (TREE_OPERAND (e, 1))
+ == get_alias_set (op))))
+ {
+ pp->expression (op);
+ return;
+ }
+ if (op == NULL_TREE)
+ op = TREE_OPERAND (arg, 0);
+ /* If the types or TBAA types are incompatible, undo the
+ UNION_TYPE handling from c_fold_indirect_ref_for_warn, and similarly
+ undo __real__/__imag__ the code below doesn't try to handle. */
+ if (op != TREE_OPERAND (arg, 0)
+ && ((TREE_CODE (op) == COMPONENT_REF
+ && TREE_CODE (TREE_TYPE (TREE_OPERAND (op, 0))) == UNION_TYPE)
+ || TREE_CODE (op) == REALPART_EXPR
+ || TREE_CODE (op) == IMAGPART_EXPR))
+ op = TREE_OPERAND (op, 0);
+ if (op != TREE_OPERAND (arg, 0))
+ {
+ array_ref_only = true;
+ for (tree ref = op; ref != TREE_OPERAND (arg, 0);
+ ref = TREE_OPERAND (ref, 0))
+ if (TREE_CODE (ref) != ARRAY_REF)
+ {
+ array_ref_only = false;
+ break;
+ }
+ }
+ }
+
+ tree access_type = TREE_TYPE (e);
+ tree arg_type = TREE_TYPE (TREE_TYPE (arg));
+ if (tree access_size = TYPE_SIZE_UNIT (access_type))
+ if (byte_off != 0
+ && TREE_CODE (access_size) == INTEGER_CST
+ && !integer_zerop (access_size))
+ {
+ offset_int asize = wi::to_offset (access_size);
+ elt_idx = byte_off / asize;
+ byte_off = byte_off % asize;
+ }
+
+ /* True to include a cast to the accessed type. */
+ const bool access_cast
+ = ((op && op != TREE_OPERAND (arg, 0))
+ || VOID_TYPE_P (arg_type)
+ || !lang_hooks.types_compatible_p (access_type, arg_type));
+ const bool has_off = byte_off != 0 || (op && op != TREE_OPERAND (arg, 0));
+
+ if (has_off && (byte_off != 0 || !array_ref_only))
+ {
+ /* When printing the byte offset for a pointer to a type of
+ a different size than char, include a cast to char* first,
+ before printing the cast to a pointer to the accessed type. */
+ tree size = TYPE_SIZE (arg_type);
+ if (size == NULL_TREE
+ || TREE_CODE (size) != INTEGER_CST
+ || wi::to_wide (size) != BITS_PER_UNIT)
+ char_cast = true;
+ }
+
+ if (elt_idx == 0)
+ pp_c_star (pp);
+ else if (access_cast || char_cast)
+ pp_c_left_paren (pp);
+
+ if (access_cast)
+ {
+ /* Include a cast to the accessed type if it isn't compatible
+ with the type of the referenced object (or if the object
+ is typeless). */
+ pp_c_left_paren (pp);
+ pp->type_id (build_pointer_type (access_type));
+ pp_c_right_paren (pp);
+ }
+
+ if (has_off)
+ pp_c_left_paren (pp);
+
+ if (char_cast)
+ {
+ /* Include a cast to char *. */
+ pp_c_left_paren (pp);
+ pp->type_id (string_type_node);
+ pp_c_right_paren (pp);
+ }
+
+ pp->unary_expression (arg);
+
+ if (op && op != TREE_OPERAND (arg, 0))
+ {
+ auto_vec<tree, 16> refs;
+ tree ref;
+ unsigned i;
+ bool array_refs = true;
+ for (ref = op; ref != TREE_OPERAND (arg, 0); ref = TREE_OPERAND (ref, 0))
+ refs.safe_push (ref);
+ FOR_EACH_VEC_ELT_REVERSE (refs, i, ref)
+ if (array_refs && TREE_CODE (ref) == ARRAY_REF)
+ {
+ pp_c_left_bracket (pp);
+ pp->expression (TREE_OPERAND (ref, 1));
+ pp_c_right_bracket (pp);
+ }
+ else
+ {
+ if (array_refs)
+ {
+ array_refs = false;
+ pp_string (pp, " + offsetof");
+ pp_c_left_paren (pp);
+ pp->type_id (TREE_TYPE (TREE_OPERAND (ref, 0)));
+ pp_comma (pp);
+ }
+ else if (TREE_CODE (ref) == COMPONENT_REF)
+ pp_c_dot (pp);
+ if (TREE_CODE (ref) == COMPONENT_REF)
+ pp->expression (TREE_OPERAND (ref, 1));
+ else
+ {
+ pp_c_left_bracket (pp);
+ pp->expression (TREE_OPERAND (ref, 1));
+ pp_c_right_bracket (pp);
+ }
+ }
+ if (!array_refs)
+ pp_c_right_paren (pp);
+ }
+
+ if (byte_off != 0)
+ {
+ pp_space (pp);
+ pp_plus (pp);
+ pp_space (pp);
+ tree off = wide_int_to_tree (ssizetype, byte_off);
+ pp->constant (off);
+ }
+
+ if (has_off)
+ pp_c_right_paren (pp);
+
+ if (elt_idx != 0)
+ {
+ if (access_cast || char_cast)
+ pp_c_right_paren (pp);
+
+ pp_c_left_bracket (pp);
+ tree idx = wide_int_to_tree (ssizetype, elt_idx);
+ pp->constant (idx);
+ pp_c_right_bracket (pp);
+ }
+}
+
/* unary-expression:
postfix-expression
++ cast-expression
@@ -1837,30 +2168,7 @@ c_pretty_printer::unary_expression (tree e)
break;
case MEM_REF:
- if (TREE_CODE (TREE_OPERAND (e, 0)) == ADDR_EXPR
- && integer_zerop (TREE_OPERAND (e, 1)))
- expression (TREE_OPERAND (TREE_OPERAND (e, 0), 0));
- else
- {
- pp_c_star (this);
- if (!integer_zerop (TREE_OPERAND (e, 1)))
- {
- pp_c_left_paren (this);
- tree type = TREE_TYPE (TREE_TYPE (TREE_OPERAND (e, 0)));
- if (TYPE_SIZE_UNIT (type) == NULL_TREE
- || !integer_onep (TYPE_SIZE_UNIT (type)))
- pp_c_type_cast (this, ptr_type_node);
- }
- pp_c_cast_expression (this, TREE_OPERAND (e, 0));
- if (!integer_zerop (TREE_OPERAND (e, 1)))
- {
- pp_plus (this);
- pp_c_integer_constant (this,
- fold_convert (ssizetype,
- TREE_OPERAND (e, 1)));
- pp_c_right_paren (this);
- }
- }
+ print_mem_ref (this, e);
break;
case TARGET_MEM_REF:
diff --git a/gcc/c-family/c-pretty-print.h b/gcc/c-family/c-pretty-print.h
index 9db6df0..82dd70d 100644
--- a/gcc/c-family/c-pretty-print.h
+++ b/gcc/c-family/c-pretty-print.h
@@ -1,5 +1,5 @@
/* Various declarations for the C and C++ pretty-printers.
- Copyright (C) 2002-2020 Free Software Foundation, Inc.
+ Copyright (C) 2002-2021 Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
This file is part of GCC.
diff --git a/gcc/c-family/c-semantics.c b/gcc/c-family/c-semantics.c
index a6316a1..b269e38 100644
--- a/gcc/c-family/c-semantics.c
+++ b/gcc/c-family/c-semantics.c
@@ -1,5 +1,5 @@
/* This file contains subroutine used by the C front-end to construct GENERIC.
- Copyright (C) 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 Free Software Foundation, Inc.
Written by Benjamin Chelf (chelf@codesourcery.com).
This file is part of GCC.
diff --git a/gcc/c-family/c-spellcheck.cc b/gcc/c-family/c-spellcheck.cc
index 4c52f20..47a24ca 100644
--- a/gcc/c-family/c-spellcheck.cc
+++ b/gcc/c-family/c-spellcheck.cc
@@ -1,5 +1,5 @@
/* Find near-matches for macros.
- Copyright (C) 2016-2020 Free Software Foundation, Inc.
+ Copyright (C) 2016-2021 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/c-family/c-spellcheck.h b/gcc/c-family/c-spellcheck.h
index 657b979..fe7465e 100644
--- a/gcc/c-family/c-spellcheck.h
+++ b/gcc/c-family/c-spellcheck.h
@@ -1,5 +1,5 @@
/* Find near-matches for macros.
- Copyright (C) 2016-2020 Free Software Foundation, Inc.
+ Copyright (C) 2016-2021 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/c-family/c-target-def.h b/gcc/c-family/c-target-def.h
index 0028cb3..f99a756 100644
--- a/gcc/c-family/c-target-def.h
+++ b/gcc/c-family/c-target-def.h
@@ -1,5 +1,5 @@
/* Default initializers for C-family target hooks.
- Copyright (C) 2011-2020 Free Software Foundation, Inc.
+ Copyright (C) 2011-2021 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
diff --git a/gcc/c-family/c-target.def b/gcc/c-family/c-target.def
index 9e4c2b9..f2a1b7e 100644
--- a/gcc/c-family/c-target.def
+++ b/gcc/c-family/c-target.def
@@ -1,5 +1,5 @@
/* Target hook definitions for C-family front ends.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
diff --git a/gcc/c-family/c-target.h b/gcc/c-family/c-target.h
index 14e26ed..769e027 100644
--- a/gcc/c-family/c-target.h
+++ b/gcc/c-family/c-target.h
@@ -1,5 +1,5 @@
/* Data structure definitions for target-specific C-family behavior.
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
diff --git a/gcc/c-family/c-ubsan.c b/gcc/c-family/c-ubsan.c
index 06a9639..12a7bca 100644
--- a/gcc/c-family/c-ubsan.c
+++ b/gcc/c-family/c-ubsan.c
@@ -1,5 +1,5 @@
/* UndefinedBehaviorSanitizer, undefined behavior detector.
- Copyright (C) 2013-2020 Free Software Foundation, Inc.
+ Copyright (C) 2013-2021 Free Software Foundation, Inc.
Contributed by Marek Polacek <polacek@redhat.com>
This file is part of GCC.
diff --git a/gcc/c-family/c-ubsan.h b/gcc/c-family/c-ubsan.h
index dc6ca5c..19c3b44 100644
--- a/gcc/c-family/c-ubsan.h
+++ b/gcc/c-family/c-ubsan.h
@@ -1,5 +1,5 @@
/* UndefinedBehaviorSanitizer, undefined behavior detector.
- Copyright (C) 2013-2020 Free Software Foundation, Inc.
+ Copyright (C) 2013-2021 Free Software Foundation, Inc.
Contributed by Marek Polacek <polacek@redhat.com>
This file is part of GCC.
diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c
index 91abafe..e6e28d9 100644
--- a/gcc/c-family/c-warn.c
+++ b/gcc/c-family/c-warn.c
@@ -1,5 +1,5 @@
/* Diagnostic routines shared by all languages that are variants of C.
- Copyright (C) 1992-2020 Free Software Foundation, Inc.
+ Copyright (C) 1992-2021 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 7947828..b209d46 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1,5 +1,5 @@
; Options for the C, ObjC, C++ and ObjC++ front ends.
-; Copyright (C) 2003-2020 Free Software Foundation, Inc.
+; Copyright (C) 2003-2021 Free Software Foundation, Inc.
;
; This file is part of GCC.
;
@@ -1647,7 +1647,7 @@ C++ ObjC++ Var(flag_no_gnu_keywords, 0)
Recognize GNU-defined keywords.
fgnu-runtime
-ObjC ObjC++ LTO Report RejectNegative Var(flag_next_runtime,0) Init(NEXT_OBJC_RUNTIME)
+ObjC ObjC++ LTO RejectNegative Var(flag_next_runtime,0) Init(NEXT_OBJC_RUNTIME)
Generate code for GNU runtime environment.
fgnu89-inline
@@ -1691,7 +1691,7 @@ ffriend-injection
C++ ObjC++ WarnRemoved
fkeep-inline-dllexport
-C C++ ObjC ObjC++ Var(flag_keep_inline_dllexport) Init(1) Report Condition(TARGET_DLLIMPORT_DECL_ATTRIBUTES)
+C C++ ObjC ObjC++ Var(flag_keep_inline_dllexport) Init(1) Condition(TARGET_DLLIMPORT_DECL_ATTRIBUTES)
Don't emit dllexported inline functions unless needed.
flabels-ok
@@ -1780,7 +1780,7 @@ C++ ObjC++ Var(flag_new_ttp)
Implement resolution of DR 150 for matching of template template arguments.
fnext-runtime
-ObjC ObjC++ LTO Report RejectNegative Var(flag_next_runtime)
+ObjC ObjC++ LTO RejectNegative Var(flag_next_runtime)
Generate code for NeXT (Apple Mac OS X) runtime environment.
fnil-receivers
@@ -1821,7 +1821,7 @@ C++ ObjC++ Optimization Var(flag_nothrow_opt)
Treat a throw() exception specification as noexcept to improve code size.
fobjc-abi-version=
-ObjC ObjC++ LTO Joined Report RejectNegative UInteger Var(flag_objc_abi)
+ObjC ObjC++ LTO Joined RejectNegative UInteger Var(flag_objc_abi)
Specify which ABI to use for Objective-C family code and meta-data generation.
; Generate special '- .cxx_construct' and '- .cxx_destruct' methods
@@ -2208,11 +2208,19 @@ Conform to the ISO 2017 C++ standard.
std=c++2a
C++ ObjC++ Alias(std=c++20) Undocumented
-Conform to the ISO 2020 C++ draft standard (experimental and incomplete support).
+Conform to the ISO 2020 C++ standard (experimental and incomplete support).
std=c++20
C++ ObjC++
-Conform to the ISO 2020 C++ draft standard (experimental and incomplete support).
+Conform to the ISO 2020 C++ standard (experimental and incomplete support).
+
+std=c++2b
+C++ ObjC++ Alias(std=c++23)
+Conform to the ISO 2023 C++ draft standard (experimental and incomplete support).
+
+std=c++23
+C++ ObjC++ Undocumented
+Conform to the ISO 2023 C++ draft standard (experimental and incomplete support).
std=c11
C ObjC
@@ -2285,12 +2293,20 @@ C++ ObjC++
Conform to the ISO 2017 C++ standard with GNU extensions.
std=gnu++2a
-C++ ObjC++ Alias(std=gnu++20)
-Conform to the ISO 2020 C++ draft standard with GNU extensions (experimental and incomplete support).
+C++ ObjC++ Alias(std=gnu++20) Undocumented
+Conform to the ISO 2020 C++ standard with GNU extensions (experimental and incomplete support).
std=gnu++20
C++ ObjC++
-Conform to the ISO 2020 C++ draft standard with GNU extensions (experimental and incomplete support).
+Conform to the ISO 2020 C++ standard with GNU extensions (experimental and incomplete support).
+
+std=gnu++2b
+C++ ObjC++ Alias(std=gnu++23)
+Conform to the ISO 2023 C++ draft standard with GNU extensions (experimental and incomplete support).
+
+std=gnu++23
+C++ ObjC++ Undocumented
+Conform to the ISO 2023 C++ draft standard with GNU extensions (experimental and incomplete support).
std=gnu11
C ObjC
@@ -2356,6 +2372,20 @@ std=iso9899:2018
C ObjC Alias(std=c17)
Conform to the ISO 2017 C standard (published in 2018).
+stdlib=
+Driver C++ ObjC++ Common Condition(ENABLE_STDLIB_OPTION) Var(flag_stdlib_kind) Joined Enum(stdlib_kind) RejectNegative Init(1)
+-stdlib=[libstdc++|libc++] The standard library to be used for C++ headers
+and runtime.
+
+Enum
+Name(stdlib_kind) Type(int)
+
+EnumValue
+Enum(stdlib_kind) String(libstdc++) Value(1)
+
+EnumValue
+Enum(stdlib_kind) String(libc++) Value(2)
+
traditional
Driver
diff --git a/gcc/c-family/cppspec.c b/gcc/c-family/cppspec.c
index 9703fd9..65902b9 100644
--- a/gcc/c-family/cppspec.c
+++ b/gcc/c-family/cppspec.c
@@ -1,5 +1,5 @@
/* Specific flags and argument handling of the C preprocessor.
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999-2021 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/c-family/known-headers.cc b/gcc/c-family/known-headers.cc
index 977230a..8592471 100644
--- a/gcc/c-family/known-headers.cc
+++ b/gcc/c-family/known-headers.cc
@@ -1,5 +1,5 @@
/* Support for suggestions about missing #include directives.
- Copyright (C) 2017-2020 Free Software Foundation, Inc.
+ Copyright (C) 2017-2021 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/c-family/known-headers.h b/gcc/c-family/known-headers.h
index f0c89dc..e4eebdf 100644
--- a/gcc/c-family/known-headers.h
+++ b/gcc/c-family/known-headers.h
@@ -1,5 +1,5 @@
/* Support for suggestions about missing #include directives.
- Copyright (C) 2017-2020 Free Software Foundation, Inc.
+ Copyright (C) 2017-2021 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/c-family/name-hint.h b/gcc/c-family/name-hint.h
index 3660cd1..ea43324 100644
--- a/gcc/c-family/name-hint.h
+++ b/gcc/c-family/name-hint.h
@@ -1,5 +1,5 @@
/* Support for offering suggestions for handling unrecognized names.
- Copyright (C) 2016-2020 Free Software Foundation, Inc.
+ Copyright (C) 2016-2021 Free Software Foundation, Inc.
This file is part of GCC.
diff --git a/gcc/c-family/stub-objc.c b/gcc/c-family/stub-objc.c
index 1914432..e0ff803 100644
--- a/gcc/c-family/stub-objc.c
+++ b/gcc/c-family/stub-objc.c
@@ -1,7 +1,7 @@
/* Stub functions for Objective-C and Objective-C++ routines
that are called from within the C and C++ front-ends,
respectively.
- Copyright (C) 1991-2020 Free Software Foundation, Inc.
+ Copyright (C) 1991-2021 Free Software Foundation, Inc.
This file is part of GCC.