aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorKonstantin Serebryany <konstantin.s.serebryany@gmail.com>2013-02-28 21:23:23 +0000
committerJakub Jelinek <jakub@redhat.com>2013-02-28 21:23:23 +0000
commita30851358eff7fe9e450fcf1e927ffaf2be29a3f (patch)
tree1c2dc482a40284c563034b228989888212c9c1f5 /gcc/c-family
parent1e6b1ea06e9c8b5a0d41f364f3934ca61348a2f4 (diff)
PR sanitizer/56454
* asan.c (gate_asan): Lookup no_sanitize_address instead of no_address_safety_analysis attribute. * doc/extend.texi (no_address_safety_attribute): Rename to no_sanitize_address attribute, mention no_address_safety_analysis attribute as deprecated alias. * c-common.c (handle_no_sanitize_address_attribute): New function. (c_common_attribute_table): Add no_sanitize_address attribute. (handle_no_address_safety_analysis_attribute): Add no_sanitize_address attribute, not no_address_safety_analysis attribute. * g++.dg/asan/default-options-1.C (__asan_default_options): Use no_sanitize_address attribute rather than no_address_safety_analysis. * g++.dg/asan/sanitizer_test_utils.h (ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS): Likewise. * c-c++-common/asan/attrib-1.c: Test no_sanitize_address attribute in addition to no_address_safety_analysis. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@196361 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog10
-rw-r--r--gcc/c-family/c-common.c28
2 files changed, 35 insertions, 3 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 50ad1016f7c..c1ad40b02a7 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,13 @@
+2013-02-28 Konstantin Serebryany <konstantin.s.serebryany@gmail.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/56454
+ * c-common.c (handle_no_sanitize_address_attribute): New function.
+ (c_common_attribute_table): Add no_sanitize_address attribute.
+ (handle_no_address_safety_analysis_attribute): Add
+ no_sanitize_address attribute, not no_address_safety_analysis
+ attribute.
+
2013-02-18 Aldy Hernandez <aldyh@redhat.com>
PR target/52555
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index a1d47a68045..d01de3e40d5 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -307,6 +307,8 @@ static tree handle_common_attribute (tree *, tree, tree, int, bool *);
static tree handle_noreturn_attribute (tree *, tree, tree, int, bool *);
static tree handle_hot_attribute (tree *, tree, tree, int, bool *);
static tree handle_cold_attribute (tree *, tree, tree, int, bool *);
+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_noinline_attribute (tree *, tree, tree, int, bool *);
@@ -715,6 +717,9 @@ const struct attribute_spec c_common_attribute_table[] =
0, 0, true, false, false,
handle_no_address_safety_analysis_attribute,
false },
+ { "no_sanitize_address", 0, 0, true, false, false,
+ handle_no_sanitize_address_attribute,
+ false },
{ "warning", 1, 1, true, false, false,
handle_error_attribute, false },
{ "error", 1, 1, true, false, false,
@@ -6505,12 +6510,12 @@ handle_cold_attribute (tree *node, tree name, tree ARG_UNUSED (args),
return NULL_TREE;
}
-/* Handle a "no_address_safety_analysis" attribute; arguments as in
+/* Handle a "no_sanitize_address" attribute; arguments as in
struct attribute_spec.handler. */
static tree
-handle_no_address_safety_analysis_attribute (tree *node, tree name, tree, int,
- bool *no_add_attrs)
+handle_no_sanitize_address_attribute (tree *node, tree name, tree, int,
+ bool *no_add_attrs)
{
if (TREE_CODE (*node) != FUNCTION_DECL)
{
@@ -6521,6 +6526,23 @@ handle_no_address_safety_analysis_attribute (tree *node, tree name, tree, int,
return NULL_TREE;
}
+/* Handle a "no_address_safety_analysis" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_no_address_safety_analysis_attribute (tree *node, tree name, tree, int,
+ bool *no_add_attrs)
+{
+ if (TREE_CODE (*node) != FUNCTION_DECL)
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
+ else if (!lookup_attribute ("no_sanitize_address", DECL_ATTRIBUTES (*node)))
+ DECL_ATTRIBUTES (*node)
+ = tree_cons (get_identifier ("no_sanitize_address"),
+ NULL_TREE, DECL_ATTRIBUTES (*node));
+ *no_add_attrs = true;
+ return NULL_TREE;
+}
+
/* Handle a "noinline" attribute; arguments as in
struct attribute_spec.handler. */