]> granicus.if.org Git - clang/commitdiff
Add support to -Wa,-W in clang
authorJian Cai <caij2003@gmail.com>
Mon, 14 Oct 2019 22:28:03 +0000 (22:28 +0000)
committerJian Cai <caij2003@gmail.com>
Mon, 14 Oct 2019 22:28:03 +0000 (22:28 +0000)
Summary:
Currently clang does not support -Wa,-W, which suppresses warning
messages in GNU assembler. Add this option for gcc compatibility.
https://bugs.llvm.org/show_bug.cgi?id=43651. Reland with differential
information.

Reviewers: bcain

Reviewed By: bcain

Subscribers: george.burgess.iv, gbiv, llozano, manojgupta, nickdesaulniers, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D68884

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374834 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains/Clang.cpp
test/Driver/as-w-option.c [new file with mode: 0644]

index 52fe20c3a90ec810c3d96449edba4b0fd11db1de..dfb3f336086fff7261d55f16d45f905f2b37eb7d 100644 (file)
@@ -2140,7 +2140,7 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
         CmdArgs.push_back("-msave-temp-labels");
       } else if (Value == "--fatal-warnings") {
         CmdArgs.push_back("-massembler-fatal-warnings");
-      } else if (Value == "--no-warn") {
+      } else if (Value == "--no-warn" || Value == "-W") {
         CmdArgs.push_back("-massembler-no-warn");
       } else if (Value == "--noexecstack") {
         UseNoExecStack = true;
diff --git a/test/Driver/as-w-option.c b/test/Driver/as-w-option.c
new file mode 100644 (file)
index 0000000..afaf1cf
--- /dev/null
@@ -0,0 +1,14 @@
+// RUN: %clang -### %s -c -o tmp.o -fno-integrated-as -Wa,-W 2>&1 | FileCheck -check-prefix=CHECK-NOIAS %s
+// RUN: %clang -### %s -c -o tmp.o -integrated-as -Wa,-W 2>&1 | FileCheck -check-prefix=CHECK-IAS %s
+// RUN: %clang %s -c -o %t.o -integrated-as -Wa,-W 2>&1 | FileCheck -allow-empty --check-prefix=CHECK-AS-NOWARN %s
+// RUN: %clang %s -c -o %t.o -fno-integrated-as -Wa,-W 2>&1 | FileCheck -allow-empty --check-prefix=CHECK-AS-NOWARN %s
+// RUN: not %clang %s -c -o %t.o -integrated-as -Wa,--fatal-warnings 2>&1 | FileCheck --check-prefix=CHECK-AS-FATAL %s
+// RUN: not %clang %s -c -o %t.o -fno-integrated-as -Wa,--fatal-warnings 2>&1 | FileCheck --check-prefix=CHECK-AS-FATAL %s
+
+// CHECK-IAS: "-cc1" {{.*}} "-massembler-no-warn"
+// CHECK-NOIAS: "-W"
+// CHECK-AS-NOWARN-NOT: warning:
+// CHECK-AS-FATAL-NOT: warning:
+// CHECK-AS-FATAL: error
+
+__asm(".warning");