[compiler-rt] r249375 - builtins: Use MSVC-equivalents of attributes

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 5 21:33:05 PDT 2015


Author: compnerd
Date: Mon Oct  5 23:33:05 2015
New Revision: 249375

URL: http://llvm.org/viewvc/llvm-project?rev=249375&view=rev
Log:
builtins: Use MSVC-equivalents of attributes

This allows us to build the builtins using MSVC.  NFC.

Patch by Tee Hao Wei!

Modified:
    compiler-rt/trunk/lib/builtins/extendhfsf2.c
    compiler-rt/trunk/lib/builtins/int_lib.h
    compiler-rt/trunk/lib/builtins/int_util.h
    compiler-rt/trunk/lib/builtins/truncsfhf2.c

Modified: compiler-rt/trunk/lib/builtins/extendhfsf2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/extendhfsf2.c?rev=249375&r1=249374&r2=249375&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/extendhfsf2.c (original)
+++ compiler-rt/trunk/lib/builtins/extendhfsf2.c Mon Oct  5 23:33:05 2015
@@ -14,7 +14,7 @@
 
 // Use a forwarding definition and noinline to implement a poor man's alias,
 // as there isn't a good cross-platform way of defining one.
-COMPILER_RT_ABI __attribute__((noinline)) float __extendhfsf2(uint16_t a) {
+COMPILER_RT_ABI NOINLINE float __extendhfsf2(uint16_t a) {
     return __extendXfYf2__(a);
 }
 

Modified: compiler-rt/trunk/lib/builtins/int_lib.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/int_lib.h?rev=249375&r1=249374&r2=249375&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/int_lib.h (original)
+++ compiler-rt/trunk/lib/builtins/int_lib.h Mon Oct  5 23:33:05 2015
@@ -35,13 +35,23 @@
 # define COMPILER_RT_ABI __attribute__((pcs("aapcs")))
 #else
 # define ARM_EABI_FNALIAS(aeabi_name, name)
-# if defined(__arm__) && defined(_WIN32)
+# if defined(__arm__) && defined(_WIN32) && (!defined(_MSC_VER) || defined(__clang__))
 #   define COMPILER_RT_ABI __attribute__((pcs("aapcs")))
 # else
 #   define COMPILER_RT_ABI
 # endif
 #endif
 
+#ifdef _MSC_VER
+#define NOINLINE __declspec(noinline)
+#define NORETURN __declspec(noreturn)
+#define UNUSED
+#else
+#define NOINLINE __attribute__((noinline))
+#define NORETURN __attribute__((noreturn))
+#define UNUSED __attribute__((unused))
+#endif
+
 #if defined(__NetBSD__) && (defined(_KERNEL) || defined(_STANDALONE))
 /*
  * Kernel and boot environment can't use normal headers,

Modified: compiler-rt/trunk/lib/builtins/int_util.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/int_util.h?rev=249375&r1=249374&r2=249375&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/int_util.h (original)
+++ compiler-rt/trunk/lib/builtins/int_util.h Mon Oct  5 23:33:05 2015
@@ -20,15 +20,14 @@
 #define INT_UTIL_H
 
 /** \brief Trigger a program abort (or panic for kernel code). */
-#define compilerrt_abort() compilerrt_abort_impl(__FILE__, __LINE__, \
-                                                 __func__)
+#define compilerrt_abort() compilerrt_abort_impl(__FILE__, __LINE__, __func__)
 
-void compilerrt_abort_impl(const char *file, int line,
-                           const char *function) __attribute__((noreturn));
+NORETURN void compilerrt_abort_impl(const char *file, int line,
+                                    const char *function);
 
 #define COMPILE_TIME_ASSERT(expr) COMPILE_TIME_ASSERT1(expr, __COUNTER__)
 #define COMPILE_TIME_ASSERT1(expr, cnt) COMPILE_TIME_ASSERT2(expr, cnt)
-#define COMPILE_TIME_ASSERT2(expr, cnt) \
-    typedef char ct_assert_##cnt[(expr) ? 1 : -1] __attribute__((unused))
+#define COMPILE_TIME_ASSERT2(expr, cnt)                                        \
+  typedef char ct_assert_##cnt[(expr) ? 1 : -1] UNUSED
 
 #endif /* INT_UTIL_H */

Modified: compiler-rt/trunk/lib/builtins/truncsfhf2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/truncsfhf2.c?rev=249375&r1=249374&r2=249375&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/truncsfhf2.c (original)
+++ compiler-rt/trunk/lib/builtins/truncsfhf2.c Mon Oct  5 23:33:05 2015
@@ -13,7 +13,7 @@
 
 // Use a forwarding definition and noinline to implement a poor man's alias,
 // as there isn't a good cross-platform way of defining one.
-COMPILER_RT_ABI __attribute__((noinline)) uint16_t __truncsfhf2(float a) {
+COMPILER_RT_ABI NOINLINE uint16_t __truncsfhf2(float a) {
     return __truncXfYf2__(a);
 }
 




More information about the llvm-commits mailing list