From 8136ac1c42dcfdd070f0bcba0f06424093df22db Mon Sep 17 00:00:00 2001 From: Daniel Chen Date: Wed, 10 Apr 2024 19:22:38 -0400 Subject: [Flang] Define c_int_fast16_t and c_int_fast32_t for PowerPC. (#88292) On Linux, PowerPC defines `int_fast16_t` and `int_fast32_t` as `long`. Need to update the corresponding type, `c_int_fast16_t` and `c_int_fast32_t` in `iso_c_binding` module so they are interoparable. --- flang/lib/Frontend/CompilerInvocation.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'flang/lib/Frontend/CompilerInvocation.cpp') diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index 8ce6ab7..e432c5a 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -1333,6 +1333,15 @@ void CompilerInvocation::setDefaultPredefinitions() { } llvm::Triple targetTriple{llvm::Triple(this->targetOpts.triple)}; + if (targetTriple.isPPC()) { + // '__powerpc__' is a generic macro for any PowerPC cases. e.g. Max integer + // size. + fortranOptions.predefinitions.emplace_back("__powerpc__", "1"); + } + if (targetTriple.isOSLinux()) { + fortranOptions.predefinitions.emplace_back("__linux__", "1"); + } + switch (targetTriple.getArch()) { default: break; @@ -1340,14 +1349,6 @@ void CompilerInvocation::setDefaultPredefinitions() { fortranOptions.predefinitions.emplace_back("__x86_64__", "1"); fortranOptions.predefinitions.emplace_back("__x86_64", "1"); break; - case llvm::Triple::ArchType::ppc: - case llvm::Triple::ArchType::ppcle: - case llvm::Triple::ArchType::ppc64: - case llvm::Triple::ArchType::ppc64le: - // '__powerpc__' is a generic macro for any PowerPC cases. e.g. Max integer - // size. - fortranOptions.predefinitions.emplace_back("__powerpc__", "1"); - break; } } -- cgit v1.1