[PATCH] D13413: Use MSVC-equivalents of attributes
angelsl via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 3 10:43:42 PDT 2015
angelsl created this revision.
angelsl added a reviewer: compnerd.
angelsl added subscribers: compnerd, llvm-commits.
http://reviews.llvm.org/D13413
Files:
lib/builtins/extendhfsf2.c
lib/builtins/int_lib.h
lib/builtins/int_util.h
lib/builtins/truncsfhf2.c
Index: lib/builtins/truncsfhf2.c
===================================================================
--- lib/builtins/truncsfhf2.c
+++ lib/builtins/truncsfhf2.c
@@ -11,9 +11,15 @@
#define DST_HALF
#include "fp_trunc_impl.inc"
+#ifdef _MSC_VER
+#define __NOINLINE __declspec(noinline)
+#else
+#define __NOINLINE __attribute__((noinline))
+#endif
+
// 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);
}
Index: lib/builtins/int_util.h
===================================================================
--- lib/builtins/int_util.h
+++ lib/builtins/int_util.h
@@ -19,16 +19,24 @@
#ifndef INT_UTIL_H
#define INT_UTIL_H
+#ifdef _MSC_VER
+#define __NORETURN(x) __declspec(noreturn) x
+#define __UNUSED
+#else
+#define __NORETURN(x) x __attribute__((noreturn))
+#define __UNUSED __attribute__((unused))
+#endif
+
/** \brief Trigger a program abort (or panic for kernel code). */
#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))
+ typedef char ct_assert_##cnt[(expr) ? 1 : -1] __UNUSED
#endif /* INT_UTIL_H */
Index: lib/builtins/int_lib.h
===================================================================
--- lib/builtins/int_lib.h
+++ lib/builtins/int_lib.h
@@ -35,7 +35,7 @@
# 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)
# define COMPILER_RT_ABI __attribute__((pcs("aapcs")))
# else
# define COMPILER_RT_ABI
Index: lib/builtins/extendhfsf2.c
===================================================================
--- lib/builtins/extendhfsf2.c
+++ lib/builtins/extendhfsf2.c
@@ -12,9 +12,15 @@
#define DST_SINGLE
#include "fp_extend_impl.inc"
+#ifdef _MSC_VER
+#define __NOINLINE __declspec(noinline)
+#else
+#define __NOINLINE __attribute__((noinline))
+#endif
+
// 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);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13413.36441.patch
Type: text/x-patch
Size: 3031 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151003/782497a3/attachment-0001.bin>
More information about the llvm-commits
mailing list