]> granicus.if.org Git - clang/commitdiff
[mips] Removing __SIZEOF_INT128__ macro for MIPS64
authorSimon Atanasyan <simon@atanasyan.com>
Wed, 10 Dec 2014 15:44:07 +0000 (15:44 +0000)
committerSimon Atanasyan <simon@atanasyan.com>
Wed, 10 Dec 2014 15:44:07 +0000 (15:44 +0000)
This is a temporary workaround while MIPS64 has not yet fully supported
128-bit integers. But declaration of int128 type is necessary even though
`__SIZEOF_INT128__` is undefined because c++ standard header files like
`limits` throw error message if `__int128` is not available.

Patch by Sagar Thakur.

Differential Revision: http://reviews.llvm.org/D6402

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223927 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/InitPreprocessor.cpp
test/Preprocessor/init.c

index 3550ac25159b7be4e15c3cd05a3c50b92b32019e..f4241a94ae026b721549097f09c7f0b1ff1e904c 100644 (file)
@@ -662,7 +662,12 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
                    TI.getTypeWidth(TI.getWCharType()), TI, Builder);
   DefineTypeSizeof("__SIZEOF_WINT_T__",
                    TI.getTypeWidth(TI.getWIntType()), TI, Builder);
-  if (TI.hasInt128Type())
+  // This is a temporary workaround while MIPS64 has not yet fully supported
+  // 128-bit integers. But declaration of int128 type is necessary even though
+  // __SIZEOF_INT128__ is undefined because c++ standard header files like
+  // limits throw error message if __int128 is not available.
+  if (TI.hasInt128Type() && !(TI.getTriple().getArch() == llvm::Triple::mips64el
+                   || TI.getTriple().getArch() == llvm::Triple::mips64))
     DefineTypeSizeof("__SIZEOF_INT128__", 128, TI, Builder);
 
   DefineType("__INTMAX_TYPE__", TI.getIntMaxType(), Builder);
index 43492f86a8ccf88a2db0d0dbf4114e5e5517a641..4f321140c6b2b4d1fa9db179f2477cd4b4661cc6 100644 (file)
 // MIPS64BE:#define __SIG_ATOMIC_WIDTH__ 32
 // MIPS64BE:#define __SIZEOF_DOUBLE__ 8
 // MIPS64BE:#define __SIZEOF_FLOAT__ 4
+// MIPS64BE-NOT:#define __SIZEOF_INT128__ 16
 // MIPS64BE:#define __SIZEOF_INT__ 4
 // MIPS64BE:#define __SIZEOF_LONG_DOUBLE__ 16
 // MIPS64BE:#define __SIZEOF_LONG_LONG__ 8
 // MIPS64EL:#define __SIG_ATOMIC_WIDTH__ 32
 // MIPS64EL:#define __SIZEOF_DOUBLE__ 8
 // MIPS64EL:#define __SIZEOF_FLOAT__ 4
+// MIPS64EL-NOT:#define __SIZEOF_INT128__ 16
 // MIPS64EL:#define __SIZEOF_INT__ 4
 // MIPS64EL:#define __SIZEOF_LONG_DOUBLE__ 16
 // MIPS64EL:#define __SIZEOF_LONG_LONG__ 8