From 32ac5e41ef957ed8ac497ebfbf84b61ee95be9a2 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Wed, 15 Feb 2017 07:50:11 +0000 Subject: [PATCH] Add a definition for __STRUCT_PARM_ALIGN__ for elfv2 and 64-bit darwin platforms to match what other compilers produce. llvm-svn: 295156 --- clang/lib/Basic/Targets.cpp | 5 +++++ clang/test/Preprocessor/init.c | 1 + 2 files changed, 6 insertions(+) diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 2ccb45902e11..647b14e16d1b 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -1232,6 +1232,11 @@ void PPCTargetInfo::getTargetDefines(const LangOptions &Opts, if (LongDoubleWidth == 128) Builder.defineMacro("__LONG_DOUBLE_128__"); + // Define this for elfv2 (64-bit only) or 64-bit darwin. + if (ABI == "elfv2" || + (getTriple().getOS() == llvm::Triple::Darwin && PointerWidth == 64)) + Builder.defineMacro("__STRUCT_PARM_ALIGN__", "16"); + if (Opts.AltiVec) { Builder.defineMacro("__VEC__", "10206"); Builder.defineMacro("__ALTIVEC__"); diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c index 6ab86de2ff67..a7726e3111f7 100644 --- a/clang/test/Preprocessor/init.c +++ b/clang/test/Preprocessor/init.c @@ -5635,6 +5635,7 @@ // PPC64LE:#define __SIZE_MAX__ 18446744073709551615UL // PPC64LE:#define __SIZE_TYPE__ long unsigned int // PPC64LE:#define __SIZE_WIDTH__ 64 +// PPC64LE:#define __STRUCT_PARM_ALIGN__ 16 // PPC64LE:#define __UINT16_C_SUFFIX__ // PPC64LE:#define __UINT16_MAX__ 65535 // PPC64LE:#define __UINT16_TYPE__ unsigned short