diff options
author | Jason Merrill <jason@redhat.com> | 2011-03-11 16:36:02 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-03-11 16:36:02 -0500 |
commit | 1b9b91a68bbabc72c0329b39a6f91f27f9b831d0 (patch) | |
tree | 4f65d86af58a76be50feefe3ae8a1be9647ab615 | |
parent | 6a4e2bd5562ee6f41bbe85e70641baad81a44273 (diff) | |
download | gcc-1b9b91a68bbabc72c0329b39a6f91f27f9b831d0.zip gcc-1b9b91a68bbabc72c0329b39a6f91f27f9b831d0.tar.gz gcc-1b9b91a68bbabc72c0329b39a6f91f27f9b831d0.tar.bz2 |
re PR c++/46803 (libstdc++ build errors on invalid OpenBSD system header attributes)
PR c++/46803
* c-common.c (attribute_takes_identifier_p): Assume that an
unknown attribute takes an identifier.
From-SVN: r170885
-rw-r--r-- | gcc/c-family/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-family/c-common.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/attrib40.C | 4 |
4 files changed, 20 insertions, 3 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 60fc08f..35ca9a3 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2011-03-11 Jason Merrill <jason@redhat.com> + + PR c++/46803 + * c-common.c (attribute_takes_identifier_p): Assume that an + unknown attribute takes an identifier. + 2011-03-07 Nathan Froyd <froydnj@codesourcery.com> PR c/47786 diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index f029661..32b9a70 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -5665,9 +5665,14 @@ c_init_attributes (void) bool attribute_takes_identifier_p (const_tree attr_id) { - if (is_attribute_p ("mode", attr_id) - || is_attribute_p ("format", attr_id) - || is_attribute_p ("cleanup", attr_id)) + struct attribute_spec *spec = lookup_attribute_spec (attr_id); + if (spec == NULL) + /* Unknown attribute that we'll end up ignoring, return true so we + don't complain about an identifier argument. */ + return true; + else if (!strcmp ("mode", spec->name) + || !strcmp ("format", spec->name) + || !strcmp ("cleanup", spec->name)) return true; else return targetm.attribute_takes_identifier_p (attr_id); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cf7d6d8..6734535 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2011-03-11 Jason Merrill <jason@redhat.com> + * g++.dg/ext/attrib40.C: New. + * g++.dg/cpp0x/regress/array1.C: New. 2011-03-11 Richard Guenther <rguenther@suse.de> diff --git a/gcc/testsuite/g++.dg/ext/attrib40.C b/gcc/testsuite/g++.dg/ext/attrib40.C new file mode 100644 index 0000000..9c3f761 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attrib40.C @@ -0,0 +1,4 @@ +// PR c++/46803 + +int strftime(char *, int, const char *, const struct tm *) + __attribute__ ((__bounded__(__string__,1,2))); // { dg-warning "ignored" } |