aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2013-09-18 10:01:40 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2013-09-18 10:01:40 +0000
commitce6923c53da68bc3e0eabb1d071217402a104148 (patch)
tree03f7c27c5287577987f7b1ef007495fd35f4beb0 /gcc/c-family
parentd30d00a2f1851cf6e6fe3b392a90b10e54388c20 (diff)
downloadgcc-ce6923c53da68bc3e0eabb1d071217402a104148.zip
gcc-ce6923c53da68bc3e0eabb1d071217402a104148.tar.gz
gcc-ce6923c53da68bc3e0eabb1d071217402a104148.tar.bz2
re PR sanitizer/58411 (no_sanitize_undefined function attribute)
2013-09-18 Marek Polacek <polacek@redhat.com> PR sanitizer/58411 * doc/extend.texi: Document no_sanitize_undefined attribute. * builtins.c (fold_builtin_0): Don't sanitize function if it has the no_sanitize_undefined attribute. From-SVN: r202682
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog7
-rw-r--r--gcc/c-family/c-common.c21
2 files changed, 28 insertions, 0 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 3061b4a..1772ba5 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,10 @@
+2013-09-18 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/58411
+ * c-common.c (handle_no_sanitize_undefined_attribute): New function.
+ Declare it.
+ (struct attribute_spec c_common_att): Add no_sanitize_undefined.
+
2013-09-14 Iain Sandoe <iain@codesourcery.com>
PR target/48094
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 62aa9fc..8ecb70c 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -311,6 +311,8 @@ static tree handle_no_sanitize_address_attribute (tree *, tree, tree,
int, bool *);
static tree handle_no_address_safety_analysis_attribute (tree *, tree, tree,
int, bool *);
+static tree handle_no_sanitize_undefined_attribute (tree *, tree, tree, int,
+ bool *);
static tree handle_noinline_attribute (tree *, tree, tree, int, bool *);
static tree handle_noclone_attribute (tree *, tree, tree, int, bool *);
static tree handle_leaf_attribute (tree *, tree, tree, int, bool *);
@@ -722,6 +724,9 @@ const struct attribute_spec c_common_attribute_table[] =
{ "no_sanitize_address", 0, 0, true, false, false,
handle_no_sanitize_address_attribute,
false },
+ { "no_sanitize_undefined", 0, 0, true, false, false,
+ handle_no_sanitize_undefined_attribute,
+ false },
{ "warning", 1, 1, true, false, false,
handle_error_attribute, false },
{ "error", 1, 1, true, false, false,
@@ -6575,6 +6580,22 @@ handle_no_address_safety_analysis_attribute (tree *node, tree name, tree, int,
return NULL_TREE;
}
+/* Handle a "no_sanitize_undefined" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_no_sanitize_undefined_attribute (tree *node, tree name, tree, int,
+ bool *no_add_attrs)
+{
+ if (TREE_CODE (*node) != FUNCTION_DECL)
+ {
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
+ *no_add_attrs = true;
+ }
+
+ return NULL_TREE;
+}
+
/* Handle a "noinline" attribute; arguments as in
struct attribute_spec.handler. */