summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathon Penix <107437988+jonathonpenix@users.noreply.github.com>2024-01-05 13:55:50 -0800
committerGitHub <noreply@github.com>2024-01-05 13:55:50 -0800
commitf1d75d08adb9841dd9cebad63b76d4823ec2bdac (patch)
treebaefe77adbd6141083c721e4d9b88275e76876ea
parent853b13342a131e06d61293ec6e840642054c6c85 (diff)
[clang][Driver] Don't warn when -nostdinc and -nostdinc++ are both specified (#77130)
When -nostdinc and -nostdinc++ are both specified and the Baremetal toolchain is used, an unused command line argument warning for -nostdinc++ is produced. This doesn't seem particularly meaningful as -nostdinc++ would have been claimed/used had the check in AddClangCXXStdlibIncludeArgs not short-circuited. So, just claim all arguments in this check. I believe this is consistent with what was done for the GNU toolchain (see 6fe7de90b9e4e466a5c2baadafd5f72d3203651d), so hopefully this is appropriate here as well.
-rw-r--r--clang/lib/Driver/ToolChains/BareMetal.cpp5
-rw-r--r--clang/test/Driver/nostdincxx.cpp1
2 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Driver/ToolChains/BareMetal.cpp b/clang/lib/Driver/ToolChains/BareMetal.cpp
index 42c8336e626c..391c47f88bde 100644
--- a/clang/lib/Driver/ToolChains/BareMetal.cpp
+++ b/clang/lib/Driver/ToolChains/BareMetal.cpp
@@ -293,9 +293,8 @@ void BareMetal::addClangTargetOptions(const ArgList &DriverArgs,
void BareMetal::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
ArgStringList &CC1Args) const {
- if (DriverArgs.hasArg(options::OPT_nostdinc) ||
- DriverArgs.hasArg(options::OPT_nostdlibinc) ||
- DriverArgs.hasArg(options::OPT_nostdincxx))
+ if (DriverArgs.hasArg(options::OPT_nostdinc, options::OPT_nostdlibinc,
+ options::OPT_nostdincxx))
return;
const Driver &D = getDriver();
diff --git a/clang/test/Driver/nostdincxx.cpp b/clang/test/Driver/nostdincxx.cpp
index ef5702a19c03..94d74f230eb1 100644
--- a/clang/test/Driver/nostdincxx.cpp
+++ b/clang/test/Driver/nostdincxx.cpp
@@ -2,6 +2,7 @@
// RUN: not %clangxx -nostdinc++ %s 2>&1 | FileCheck %s
// RUN: not %clangxx -nostdlibinc %s 2>&1 | FileCheck %s
// RUN: not %clangxx --target=x86_64-unknown-unknown-gnu -fsyntax-only -nostdinc -nostdinc++ %s 2>&1 | FileCheck /dev/null --implicit-check-not=-Wunused-command-line-argument
+// RUN: not %clangxx --target=riscv64-unknown-elf -fsyntax-only -nostdinc -nostdinc++ %s 2>&1 | FileCheck /dev/null --implicit-check-not=-Wunused-command-line-argument
// CHECK: 'vector' file not found
#include <vector>