aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-03-11 16:12:22 -0800
committerIan Lance Taylor <iant@golang.org>2021-03-11 16:12:22 -0800
commitbc636c218f2b28da06cd1404d5b35d1f8cc43fd1 (patch)
tree764937d8460563db6132d7c75e19b95ef3ea6ea8 /gcc/c-family
parent89d7be42db00cd0953e7d4584877cf50a56ed046 (diff)
parent7ad5a72c8bc6aa71a0d195ddfa207db01265fe0b (diff)
downloadgcc-bc636c218f2b28da06cd1404d5b35d1f8cc43fd1.zip
gcc-bc636c218f2b28da06cd1404d5b35d1f8cc43fd1.tar.gz
gcc-bc636c218f2b28da06cd1404d5b35d1f8cc43fd1.tar.bz2
Merge from trunk revision 7ad5a72c8bc6aa71a0d195ddfa207db01265fe0b.
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog60
-rw-r--r--gcc/c-family/c-ada-spec.c4
-rw-r--r--gcc/c-family/c-attribs.c40
-rw-r--r--gcc/c-family/c-common.c6
-rw-r--r--gcc/c-family/c-ppoutput.c9
-rw-r--r--gcc/c-family/c-pretty-print.c1
-rw-r--r--gcc/c-family/c.opt8
7 files changed, 115 insertions, 13 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index dfddd04..d1ce4b4 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,63 @@
+2021-03-05 Eric Botcazou <ebotcazou@adacore.com>
+
+ * c-ada-spec.c (dump_ada_declaration) <TYPE_DECL>: Dump nested types
+ after entering the separate class package, if any.
+
+2021-03-04 Richard Biener <rguenther@suse.de>
+
+ * c-pretty-print.c (c_pretty_printer::direct_abstract_declarator):
+ Handle ERROR_MARK.
+
+2021-03-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/99325
+ * c-ppoutput.c (print): Change src_line type from int to unsigned.
+ (token_streamer::stream) Likewise.
+ (maybe_print_line_1): Likewise. Don't strcmp src_file if src_loc is
+ UNKNOWN_LOCATION.
+
+2021-03-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/99324
+ * c-common.c (build_va_arg): Call c_common_mark_addressable_vec
+ instead of mark_addressable. Fix a comment typo -
+ neutrallly -> neutrally.
+
+2021-02-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/99304
+ * c-attribs.c (handle_malloc_attribute): Fix a typo in inform
+ message - refernced -> referenced. Remove superfluous space before
+ closing paren of function calls.
+
+2021-02-25 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/99166
+ * c.opt (-flang-info-module-cmi): Renamed option.
+
+2021-02-19 Nathan Sidwell <nathan@acm.org>
+
+ * c.opt (flang-info-module-read, flang-info-module-read=): New.
+
+2021-02-18 H.J. Lu <hjl.tools@gmail.com>
+
+ PR target/99113
+ * c-attribs.c (c_common_attribute_table): Add the "retain"
+ attribute.
+ (handle_retain_attribute): New function.
+
+2021-02-16 Marek Polacek <polacek@redhat.com>
+
+ PR c++/99062
+ * c-attribs.c (handle_assume_aligned_attribute): Check that the
+ alignment argument is non-negative. Tweak a warning message.
+
+2021-02-12 Martin Sebor <msebor@redhat.com>
+
+ PR c/99055
+ * c-warn.c (warn_parm_array_mismatch): Free strings returned from
+ print_generic_expr_to_str.
+
2021-02-10 Richard Biener <rguenther@suse.de>
* c-common.c (parse_optimize_options): Free decoded_options.
diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c
index bc0aa5e..dd8e8bb 100644
--- a/gcc/c-family/c-ada-spec.c
+++ b/gcc/c-family/c-ada-spec.c
@@ -2847,8 +2847,6 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
pp_string (buffer, "subtype ");
else
{
- dump_nested_types (buffer, t, spc);
-
if (separate_class_package (t))
{
is_class = true;
@@ -2859,6 +2857,8 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
newline_and_indent (buffer, spc);
}
+ dump_nested_types (buffer, t, spc);
+
pp_string (buffer, "type ");
}
break;
diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c
index 84ec86b..c1f652d 100644
--- a/gcc/c-family/c-attribs.c
+++ b/gcc/c-family/c-attribs.c
@@ -163,6 +163,7 @@ 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 *);
+static tree handle_retain_attribute (tree *, tree, tree, int, bool *);
/* Helper to define attribute exclusions. */
#define ATTR_EXCL(name, function, type, variable) \
@@ -328,6 +329,8 @@ const struct attribute_spec c_common_attribute_table[] =
handle_used_attribute, NULL },
{ "unused", 0, 0, false, false, false, false,
handle_unused_attribute, NULL },
+ { "retain", 0, 0, true, false, false, false,
+ handle_retain_attribute, NULL },
{ "externally_visible", 0, 0, true, false, false, false,
handle_externally_visible_attribute, NULL },
{ "no_reorder", 0, 0, true, false, false, false,
@@ -1564,6 +1567,28 @@ handle_unused_attribute (tree *node, tree name, tree ARG_UNUSED (args),
return NULL_TREE;
}
+/* Handle a "retain" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_retain_attribute (tree *pnode, tree name, tree ARG_UNUSED (args),
+ int ARG_UNUSED (flags), bool *no_add_attrs)
+{
+ tree node = *pnode;
+
+ if (SUPPORTS_SHF_GNU_RETAIN
+ && (TREE_CODE (node) == FUNCTION_DECL
+ || (VAR_P (node) && TREE_STATIC (node))))
+ ;
+ else
+ {
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
+ *no_add_attrs = true;
+ }
+
+ return NULL_TREE;
+}
+
/* Handle a "externally_visible" attribute; arguments as in
struct attribute_spec.handler. */
@@ -3318,7 +3343,7 @@ handle_malloc_attribute (tree *node, tree name, tree args, int flags,
error ("%qE attribute argument 1 must take a pointer "
"type as its first argument", name);
inform (DECL_SOURCE_LOCATION (dealloc),
- "refernced symbol declared here" );
+ "referenced symbol declared here");
*no_add_attrs = true;
return NULL_TREE;
}
@@ -3331,7 +3356,7 @@ handle_malloc_attribute (tree *node, tree name, tree args, int flags,
error ("%qE attribute argument 1 must take a pointer type "
"as its first argument; have %qT", name, argtype);
inform (DECL_SOURCE_LOCATION (dealloc),
- "referenced symbol declared here" );
+ "referenced symbol declared here");
*no_add_attrs = true;
return NULL_TREE;
}
@@ -3536,11 +3561,18 @@ handle_assume_aligned_attribute (tree *node, tree name, tree args, int,
if (!tree_fits_shwi_p (val))
{
warning (OPT_Wattributes,
- "%qE attribute %E is not an integer constant",
+ "%qE attribute argument %E is not an integer constant",
name, val);
*no_add_attrs = true;
return NULL_TREE;
}
+ else if (tree_int_cst_sgn (val) < 0)
+ {
+ warning (OPT_Wattributes,
+ "%qE attribute argument %E is not positive", name, val);
+ *no_add_attrs = true;
+ return NULL_TREE;
+ }
if (!align)
{
@@ -3556,7 +3588,7 @@ handle_assume_aligned_attribute (tree *node, tree name, tree args, int,
align = val;
}
- else if (tree_int_cst_sgn (val) < 0 || tree_int_cst_le (align, val))
+ else if (tree_int_cst_le (align, val))
{
/* The misalignment specified by the second argument
must be non-negative and less than the alignment. */
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 088626d..d227686 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -4553,7 +4553,7 @@ build_va_arg (location_t loc, tree expr, tree type)
if (canon_va_type == NULL_TREE)
error_at (loc, "first argument to %<va_arg%> not of type %<va_list%>");
- /* Let's handle things neutrallly, if expr:
+ /* Let's handle things neutrally, if expr:
- has undeclared type, or
- is not an va_list type. */
return build_va_arg_1 (loc, type, error_mark_node);
@@ -4565,7 +4565,7 @@ build_va_arg (location_t loc, tree expr, tree type)
/* Take the address, to get '&ap'. Note that &ap is not a va_list
type. */
- mark_addressable (expr);
+ c_common_mark_addressable_vec (expr);
expr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (expr)), expr);
return build_va_arg_1 (loc, type, expr);
@@ -4627,7 +4627,7 @@ build_va_arg (location_t loc, tree expr, tree type)
/* Take the address, to get '&ap'. Make sure it's a pointer to array
elem type. */
- mark_addressable (expr);
+ c_common_mark_addressable_vec (expr);
expr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (canon_va_type)),
expr);
diff --git a/gcc/c-family/c-ppoutput.c b/gcc/c-family/c-ppoutput.c
index 04e4164..ae33c1f 100644
--- a/gcc/c-family/c-ppoutput.c
+++ b/gcc/c-family/c-ppoutput.c
@@ -32,7 +32,7 @@ static struct
FILE *outf; /* Stream to write to. */
const cpp_token *prev; /* Previous token. */
const cpp_token *source; /* Source token for spacing. */
- int src_line; /* Line number currently being written. */
+ unsigned src_line; /* Line number currently being written. */
bool printed; /* True if something output at line. */
bool first_time; /* pp_file_change hasn't been called yet. */
bool prev_was_system_token; /* True if the previous token was a
@@ -213,7 +213,7 @@ token_streamer::stream (cpp_reader *pfile, const cpp_token *token,
/* Subtle logic to output a space if and only if necessary. */
if (avoid_paste)
{
- int src_line = LOCATION_LINE (loc);
+ unsigned src_line = LOCATION_LINE (loc);
if (print.source == NULL)
print.source = token;
@@ -237,7 +237,7 @@ token_streamer::stream (cpp_reader *pfile, const cpp_token *token,
}
else if (token->flags & PREV_WHITE)
{
- int src_line = LOCATION_LINE (loc);
+ unsigned src_line = LOCATION_LINE (loc);
if (src_line != print.src_line
&& do_line_adjustments
@@ -437,7 +437,7 @@ static bool
maybe_print_line_1 (location_t src_loc, FILE *stream)
{
bool emitted_line_marker = false;
- int src_line = LOCATION_LINE (src_loc);
+ unsigned src_line = LOCATION_LINE (src_loc);
const char *src_file = LOCATION_FILE (src_loc);
/* End the previous line of text. */
@@ -451,6 +451,7 @@ maybe_print_line_1 (location_t src_loc, FILE *stream)
if (!flag_no_line_commands
&& src_line >= print.src_line
&& src_line < print.src_line + 8
+ && src_loc != UNKNOWN_LOCATION
&& strcmp (src_file, print.src_file) == 0)
{
while (src_line > print.src_line)
diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c
index 2095d4b..a987da4 100644
--- a/gcc/c-family/c-pretty-print.c
+++ b/gcc/c-family/c-pretty-print.c
@@ -676,6 +676,7 @@ c_pretty_printer::direct_abstract_declarator (tree t)
case VECTOR_TYPE:
case COMPLEX_TYPE:
case TYPE_DECL:
+ case ERROR_MARK:
break;
default:
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index b209d46..64e46e7 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1752,6 +1752,14 @@ flang-info-include-translate=
C++ Joined RejectNegative MissingArgError(missing header name)
Note a #include translation of a specific header.
+flang-info-module-cmi
+C++ Var(note_module_cmi_yes)
+Note Compiled Module Interface pathnames.
+
+flang-info-module-cmi=
+C++ Joined RejectNegative MissingArgError(missing module name)
+Note Compiled Module Interface pathname of a specific module or header-unit.
+
fmax-include-depth=
C ObjC C++ ObjC++ Joined RejectNegative UInteger
fmax-include-depth=<number> Set the maximum depth of the nested #include.