Skip to content

Commit

Permalink
[mips] Removing __SIZEOF_INT128__ macro for MIPS64
Browse files Browse the repository at this point in the history
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

llvm-svn: 223927
  • Loading branch information
atanasyan committed Dec 10, 2014
1 parent e5a2a0c commit d83248e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion clang/lib/Frontend/InitPreprocessor.cpp
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions clang/test/Preprocessor/init.c
Expand Up @@ -3138,6 +3138,7 @@
// 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
Expand Down Expand Up @@ -3345,6 +3346,7 @@
// 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
Expand Down

0 comments on commit d83248e

Please sign in to comment.