]> gcc.gnu.org Git - gcc.git/commitdiff
re PR sanitizer/64354 (no preprocessor symbol __SANITIZE_THREAD__)
authorMaxim Ostapenko <m.ostapenko@samsung.com>
Thu, 19 May 2016 12:05:59 +0000 (12:05 +0000)
committerMaxim Ostapenko <chefmax@gcc.gnu.org>
Thu, 19 May 2016 12:05:59 +0000 (15:05 +0300)
2016-05-19  Maxim Ostapenko  <m.ostapenko@samsung.com>

PR sanitizer/64354
* cppbuiltin.c (define_builtin_macros_for_compilation_flags): Add new
builtin __SANITIZE_THREAD__ macros for fsanitize=thread switch.
* doc/cpp.texi: Document new macros.

* c-c++-common/tsan/sanitize-thread-macro.c: New test.

From-SVN: r236457

gcc/ChangeLog
gcc/cppbuiltin.c
gcc/doc/cpp.texi
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/tsan/sanitize-thread-macro.c [new file with mode: 0644]

index b39357a002ca07ba5c065af9fa79287589e6d340..e7d7ab8469a9005f38af144528a0c7484ca55c2d 100644 (file)
@@ -1,3 +1,10 @@
+2016-05-19  Maxim Ostapenko  <m.ostapenko@samsung.com>
+
+       PR sanitizer/64354
+       * cppbuiltin.c (define_builtin_macros_for_compilation_flags): Add new
+       builtin __SANITIZE_THREAD__ macros for fsanitize=thread switch.
+       * doc/cpp.texi: Document new macros.
+
 2016-05-19 Bin Cheng  <bin.cheng@arm.com>
 
        PR tree-optimization/69848
index 6d494add73b71e5a848bdae22a6b0d987ae62e05..69ccdb918466b651605d352b8cc3f38dd4e14e99 100644 (file)
@@ -92,6 +92,9 @@ define_builtin_macros_for_compilation_flags (cpp_reader *pfile)
   if (flag_sanitize & SANITIZE_ADDRESS)
     cpp_define (pfile, "__SANITIZE_ADDRESS__");
 
+  if (flag_sanitize & SANITIZE_THREAD)
+    cpp_define (pfile, "__SANITIZE_THREAD__");
+
   if (optimize_size)
     cpp_define (pfile, "__OPTIMIZE_SIZE__");
   if (optimize)
index 9f914b2759d3e1dbbebbf92e7bd8dce97804f4d3..44f59bdfb4703524537c23f4b2fe128aaf955616 100644 (file)
@@ -2362,6 +2362,9 @@ in use.
 This macro is defined, with value 1, when @option{-fsanitize=address}
 or @option{-fsanitize=kernel-address} are in use.
 
+@item __SANITIZE_THREAD__
+This macro is defined, with value 1, when @option{-fsanitize=thread} is in use.
+
 @item __TIMESTAMP__
 This macro expands to a string constant that describes the date and time
 of the last modification of the current source file. The string constant
index d14ebefc563e477f5b8ef0171afa19e2099a8829..4f20c2cd63edfc75843a2bc139c9808c1a66e4df 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-19  Maxim Ostapenko  <m.ostapenko@samsung.com>
+
+       PR sanitizer/64354
+       * c-c++-common/tsan/sanitize-thread-macro.c: New test.
+
 2016-05-19  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/70729
diff --git a/gcc/testsuite/c-c++-common/tsan/sanitize-thread-macro.c b/gcc/testsuite/c-c++-common/tsan/sanitize-thread-macro.c
new file mode 100644 (file)
index 0000000..2b8a840
--- /dev/null
@@ -0,0 +1,12 @@
+/* Check that -fsanitize=thread options defines __SANITIZE_THREAD__ macros.  */
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
+
+int
+main ()
+{
+#ifndef __SANITIZE_THREAD__
+  bad construction
+#endif
+  return 0;
+}
This page took 0.086919 seconds and 5 git commands to generate.