[PATCH] D112906: [PowerPC] Emit warning for ieeelongdouble on older GNU toolchain
Qiu Chaofan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 11 04:22:14 PST 2022
qiucf updated this revision to Diff 398906.
qiucf marked 2 inline comments as done.
qiucf edited the summary of this revision.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112906/new/
https://reviews.llvm.org/D112906
Files:
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/lib/Driver/ToolChains/PPCLinux.cpp
clang/lib/Driver/ToolChains/PPCLinux.h
clang/test/Driver/Inputs/powerpc64le-linux-gnu-tree/gcc-11.2.0/lib/gcc/powerpc64le-linux-gnu/11.2.0/.keep
clang/test/Driver/ppc-float-abi-warning.cpp
Index: clang/test/Driver/ppc-float-abi-warning.cpp
===================================================================
--- /dev/null
+++ clang/test/Driver/ppc-float-abi-warning.cpp
@@ -0,0 +1,13 @@
+// REQUIRES: powerpc-registered-target
+// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s \
+// RUN: --gcc-toolchain=%S/Inputs/powerpc64le-linux-gnu-tree/gcc-11.2.0 \
+// RUN: -mabi=ieeelongdouble -stdlib=libstdc++ 2>&1 | FileCheck %s
+// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s \
+// RUN: -mabi=ieeelongdouble -stdlib=libc++ 2>&1 | FileCheck %s
+// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN: -mabi=ieeelongdouble -stdlib=libc++ -Wno-unsupported-cxxlib 2>&1 | \
+// RUN: FileCheck %s --check-prefix=NOWARN
+
+// CHECK: warning: float ABI 'ieeelongdouble' is not supported by current C++ stdlib
+// NOWARN-NOT: warning: float ABI 'ieeelongdouble' is not supported by current C++ stdlib
+long double foo(long double x) { return x; }
Index: clang/lib/Driver/ToolChains/PPCLinux.h
===================================================================
--- clang/lib/Driver/ToolChains/PPCLinux.h
+++ clang/lib/Driver/ToolChains/PPCLinux.h
@@ -18,8 +18,7 @@
class LLVM_LIBRARY_VISIBILITY PPCLinuxToolChain : public Linux {
public:
PPCLinuxToolChain(const Driver &D, const llvm::Triple &Triple,
- const llvm::opt::ArgList &Args)
- : Linux(D, Triple, Args) {}
+ const llvm::opt::ArgList &Args);
void
AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
Index: clang/lib/Driver/ToolChains/PPCLinux.cpp
===================================================================
--- clang/lib/Driver/ToolChains/PPCLinux.cpp
+++ clang/lib/Driver/ToolChains/PPCLinux.cpp
@@ -8,12 +8,28 @@
#include "PPCLinux.h"
#include "clang/Driver/Driver.h"
+#include "clang/Driver/DriverDiagnostic.h"
#include "clang/Driver/Options.h"
#include "llvm/Support/Path.h"
using namespace clang::driver::toolchains;
using namespace llvm::opt;
+PPCLinuxToolChain::PPCLinuxToolChain(const Driver &D,
+ const llvm::Triple &Triple,
+ const llvm::opt::ArgList &Args)
+ : Linux(D, Triple, Args) {
+ if (D.CCCIsCXX() && (ToolChain::GetCXXStdlibType(Args) == CST_Libcxx ||
+ GCCInstallation.getVersion().isOlderThan(12, 1, 0))) {
+ if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) {
+ StringRef ABIName = A->getValue();
+ if (ABIName != "ibmlongdouble") {
+ D.Diag(diag::warn_drv_unsupported_float_abi_by_cxxlib) << ABIName;
+ }
+ }
+ }
+}
+
void PPCLinuxToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
ArgStringList &CC1Args) const {
if (!DriverArgs.hasArg(clang::driver::options::OPT_nostdinc) &&
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -384,6 +384,9 @@
"argument '%0' is deprecated, use '%1' instead">, InGroup<Deprecated>;
def warn_drv_assuming_mfloat_abi_is : Warning<
"unknown platform, assuming -mfloat-abi=%0">;
+def warn_drv_unsupported_float_abi_by_cxxlib : Warning<
+ "float ABI '%0' is not supported by current C++ stdlib">,
+ InGroup<DiagGroup<"unsupported-cxxlib">>;
def warn_ignoring_ftabstop_value : Warning<
"ignoring invalid -ftabstop value '%0', using default value %1">;
def warn_drv_overriding_flag_option : Warning<
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112906.398906.patch
Type: text/x-patch
Size: 3669 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220111/c9bbe4cf/attachment.bin>
More information about the cfe-commits
mailing list