+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
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)
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
+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
--- /dev/null
+/* 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;
+}