[mlir] Fix an msvc warning
authorBenjamin Kramer <benny.kra@googlemail.com>
Sat, 18 Jun 2022 08:07:51 +0000 (10:07 +0200)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sat, 18 Jun 2022 08:07:51 +0000 (10:07 +0200)
Float16bits.cpp(148): warning C4067: unexpected tokens following preprocessor directive - expected a newline

mlir/lib/ExecutionEngine/Float16bits.cpp

index 6ee2e41..289eaea 100644 (file)
@@ -145,10 +145,12 @@ std::ostream &operator<<(std::ostream &os, const bf16 &d) {
 // Provide a float->bfloat conversion routine in case the runtime doesn't have
 // one.
 extern "C" uint16_t
-#if defined(__has_attribute) && __has_attribute(weak) &&                       \
-    !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(_WIN32)
+#ifdef __has_attribute
+#if __has_attribute(weak) && !defined(__MINGW32__) && !defined(__CYGWIN__) &&  \
+    !defined(_WIN32)
     __attribute__((__weak__))
 #endif
+#endif
     __truncsfbf2(float f) {
   return float2bfloat(f);
 }
@@ -156,10 +158,12 @@ extern "C" uint16_t
 // Provide a double->bfloat conversion routine in case the runtime doesn't have
 // one.
 extern "C" uint16_t
-#if defined(__has_attribute) && __has_attribute(weak) &&                       \
-    !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(_WIN32)
+#ifdef __has_attribute
+#if __has_attribute(weak) && !defined(__MINGW32__) && !defined(__CYGWIN__) &&  \
+    !defined(_WIN32)
     __attribute__((__weak__))
 #endif
+#endif
     __truncdfbf2(double d) {
   // This does a double rounding step, but it's precise enough for our use
   // cases.