From 6fe7de90b9e4e466a5c2baadafd5f72d3203651d Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 1 Apr 2021 14:37:34 -0700 Subject: [PATCH] [Driver] -nostdinc -nostdinc++: don't warn for -Wunused-command-line-argument --- clang/lib/Driver/ToolChains/Gnu.cpp | 5 ++--- clang/test/Driver/nostdincxx.cpp | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp index 4a8a11a..c08972f 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -2882,9 +2882,8 @@ void Generic_GCC::AddMultilibIncludeArgs(const ArgList &DriverArgs, void Generic_GCC::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, ArgStringList &CC1Args) const { - if (DriverArgs.hasArg(options::OPT_nostdinc) || - DriverArgs.hasArg(options::OPT_nostdincxx) || - DriverArgs.hasArg(options::OPT_nostdlibinc)) + if (DriverArgs.hasArg(options::OPT_nostdinc, options::OPT_nostdincxx, + options::OPT_nostdlibinc)) return; switch (GetCXXStdlibType(DriverArgs)) { diff --git a/clang/test/Driver/nostdincxx.cpp b/clang/test/Driver/nostdincxx.cpp index 3fc7a5e..c919c73 100644 --- a/clang/test/Driver/nostdincxx.cpp +++ b/clang/test/Driver/nostdincxx.cpp @@ -1,6 +1,7 @@ // RUN: not %clangxx -nostdinc %s 2>&1 | FileCheck %s // RUN: not %clangxx -nostdinc++ %s 2>&1 | FileCheck %s // RUN: not %clangxx -nostdlibinc %s 2>&1 | FileCheck %s +// RUN: not %clangxx -fsyntax-only -nostdinc -nostdinc++ %s 2>&1 | FileCheck /dev/null --implicit-check-not=-Wunused-command-line-argument // CHECK: file not found #include -- 2.7.4