@@ -766,6 +766,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_thread", 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 },
@@ -758,7 +758,9 @@ public:
opt_pass * clone () { return new pass_tsan (m_ctxt); }
virtual bool gate (function *)
{
- return (flag_sanitize & SANITIZE_THREAD) != 0;
+ return ((flag_sanitize & SANITIZE_THREAD) != 0
+ && !lookup_attribute ("no_sanitize_thread",
+ DECL_ATTRIBUTES (current_function_decl)));
}
virtual unsigned int execute (function *) { return tsan_pass (); }
@@ -798,7 +800,9 @@ public:
/* opt_pass methods: */
virtual bool gate (function *)
{
- return (flag_sanitize & SANITIZE_THREAD) != 0 && !optimize;
+ return ((flag_sanitize & SANITIZE_THREAD) != 0 && !optimize
+ && !lookup_attribute ("no_sanitize_thread",
+ DECL_ATTRIBUTES (current_function_decl)));
}
virtual unsigned int execute (function *) { return tsan_pass (); }