[compiler-rt] 9065357 - [sanitizer_common] Move UNDEFINED attribute outside _MSC_VER guard

Marco Elver via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 8 04:08:06 PDT 2023


Author: Marco Elver
Date: 2023-06-08T13:03:08+02:00
New Revision: 90653579c01700b7ba33ba29a02975ce6ef4881e

URL: https://github.com/llvm/llvm-project/commit/90653579c01700b7ba33ba29a02975ce6ef4881e
DIFF: https://github.com/llvm/llvm-project/commit/90653579c01700b7ba33ba29a02975ce6ef4881e.diff

LOG: [sanitizer_common] Move UNDEFINED attribute outside _MSC_VER guard

The __has_attribute check is sufficient, and if clang-cl is used, the
attribute will be available as well.

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
index e5dd65a8398c4..8d414b814478e 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
@@ -236,11 +236,6 @@ typedef u64 tid_t;
 #  define PREFETCH(x) __builtin_prefetch(x)
 # endif
 # define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
-# if __has_attribute(uninitialized)
-#  define UNINITIALIZED __attribute__((uninitialized))
-# else  // __has_attribute(uninitialized)
-#  define UNINITIALIZED
-# endif  // __has_attribute(uninitialized)
 #endif  // _MSC_VER
 
 #if !defined(_MSC_VER) || defined(__clang__)
@@ -265,6 +260,12 @@ typedef u64 tid_t;
 #  define FALLTHROUGH
 #endif
 
+#if __has_attribute(uninitialized)
+#  define UNINITIALIZED __attribute__((uninitialized))
+#else
+#  define UNINITIALIZED
+#endif
+
 // Unaligned versions of basic types.
 typedef ALIGNED(1) u16 uu16;
 typedef ALIGNED(1) u32 uu32;


        


More information about the llvm-commits mailing list