[compiler-rt] r183214 - Fix ALIGNED misuse in asan_thread.cc (built on all platforms); also, add a comment to the ALIGNED macro describing the correct usage

Timur Iskhodzhanov timurrrr at google.com
Tue Jun 4 01:25:17 PDT 2013


Author: timurrrr
Date: Tue Jun  4 03:25:17 2013
New Revision: 183214

URL: http://llvm.org/viewvc/llvm-project?rev=183214&view=rev
Log:
Fix ALIGNED misuse in asan_thread.cc (built on all platforms); also, add a comment to the ALIGNED macro describing the correct usage

Modified:
    compiler-rt/trunk/lib/asan/asan_thread.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h

Modified: compiler-rt/trunk/lib/asan/asan_thread.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_thread.cc?rev=183214&r1=183213&r2=183214&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_thread.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_thread.cc Tue Jun  4 03:25:17 2013
@@ -40,7 +40,7 @@ void AsanThreadContext::OnFinished() {
 }
 
 // MIPS requires aligned address
-static char thread_registry_placeholder[sizeof(ThreadRegistry)] ALIGNED(16);
+static ALIGNED(16) char thread_registry_placeholder[sizeof(ThreadRegistry)];
 static ThreadRegistry *asan_thread_registry;
 
 static ThreadContextBase *GetAsanThreadContext(u32 tid) {

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h?rev=183214&r1=183213&r2=183214&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h Tue Jun  4 03:25:17 2013
@@ -132,6 +132,8 @@ using namespace __sanitizer;  // NOLINT
 #else  // _MSC_VER
 # define ALWAYS_INLINE inline __attribute__((always_inline))
 # define ALIAS(x) __attribute__((alias(x)))
+// Please only use the ALIGNED macro before the type.
+// Using ALIGNED after the variable declaration is not portable!
 # define ALIGNED(x) __attribute__((aligned(x)))
 # define FORMAT(f, a)  __attribute__((format(printf, f, a)))
 # define NOINLINE __attribute__((noinline))





More information about the llvm-commits mailing list