aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2018-05-11 09:37:35 +0200
committerMartin Liska <marxin@gcc.gnu.org>2018-05-11 07:37:35 +0000
commit19916065b7fb26bbb36f7bbe5688ae2c1661dec3 (patch)
treef5d45b2c3debefede4370624eb06a7a8ed2947ab /gcc/c-family
parent683be2f77b3ce4db09e1175c1de4ec7f26f803e6 (diff)
downloadgcc-19916065b7fb26bbb36f7bbe5688ae2c1661dec3.zip
gcc-19916065b7fb26bbb36f7bbe5688ae2c1661dec3.tar.gz
gcc-19916065b7fb26bbb36f7bbe5688ae2c1661dec3.tar.bz2
Support LLVM style of no_sanitize attribute (PR sanitizer/85556).
2018-05-11 Martin Liska <mliska@suse.cz> PR sanitizer/85556 * doc/extend.texi: Document LLVM style format for no_sanitize attribute. 2018-05-11 Martin Liska <mliska@suse.cz> PR sanitizer/85556 * c-attribs.c (handle_no_sanitize_attribute): Iterate all TREE_LIST values. 2018-05-11 Martin Liska <mliska@suse.cz> PR sanitizer/85556 * c-c++-common/ubsan/attrib-6.c: New test. From-SVN: r260154
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog6
-rw-r--r--gcc/c-family/c-attribs.c20
2 files changed, 18 insertions, 8 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 052b222..d2fba2f 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,9 @@
+2018-05-11 Martin Liska <mliska@suse.cz>
+
+ PR sanitizer/85556
+ * c-attribs.c (handle_no_sanitize_attribute): Iterate all
+ TREE_LIST values.
+
2018-05-10 Jakub Jelinek <jakub@redhat.com>
PR c++/85662
diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c
index 9bddc1a..d302b4f 100644
--- a/gcc/c-family/c-attribs.c
+++ b/gcc/c-family/c-attribs.c
@@ -403,7 +403,7 @@ const struct attribute_spec c_common_attribute_table[] =
0, 0, true, false, false, false,
handle_no_address_safety_analysis_attribute,
NULL },
- { "no_sanitize", 1, 1, true, false, false, false,
+ { "no_sanitize", 1, -1, true, false, false, false,
handle_no_sanitize_attribute, NULL },
{ "no_sanitize_address", 0, 0, true, false, false, false,
handle_no_sanitize_address_attribute, NULL },
@@ -683,22 +683,26 @@ static tree
handle_no_sanitize_attribute (tree *node, tree name, tree args, int,
bool *no_add_attrs)
{
+ unsigned int flags = 0;
*no_add_attrs = true;
- tree id = TREE_VALUE (args);
if (TREE_CODE (*node) != FUNCTION_DECL)
{
warning (OPT_Wattributes, "%qE attribute ignored", name);
return NULL_TREE;
}
- if (TREE_CODE (id) != STRING_CST)
+ for (; args; args = TREE_CHAIN (args))
{
- error ("no_sanitize argument not a string");
- return NULL_TREE;
- }
+ tree id = TREE_VALUE (args);
+ if (TREE_CODE (id) != STRING_CST)
+ {
+ error ("no_sanitize argument not a string");
+ return NULL_TREE;
+ }
- char *string = ASTRDUP (TREE_STRING_POINTER (id));
- unsigned int flags = parse_no_sanitize_attribute (string);
+ char *string = ASTRDUP (TREE_STRING_POINTER (id));
+ flags |= parse_no_sanitize_attribute (string);
+ }
add_no_sanitize_value (*node, flags);