[clang] 5a6352b - Tidy up `pragma comment lib` handling and testing
Paul Robinson via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 2 07:52:35 PDT 2022
Author: Paul Robinson
Date: 2022-06-02T07:52:26-07:00
New Revision: 5a6352bc70fb0f309de22ea75ef132f32d8be9b4
URL: https://github.com/llvm/llvm-project/commit/5a6352bc70fb0f309de22ea75ef132f32d8be9b4
DIFF: https://github.com/llvm/llvm-project/commit/5a6352bc70fb0f309de22ea75ef132f32d8be9b4.diff
LOG: Tidy up `pragma comment lib` handling and testing
A bit of historical research shows that over the years:
Commit 99efc036 added `pragma comment lib` support for PS4.
Commit fd4db533 added `pragma comment lib` support for all ELF targets.
Commit 1d16515f reworked dependent-library support for all ELF targets.
The upshot is that some PS4-specific code became dead, and the
testing became somewhat fragmented. I've removed the dead code and
combined the previous PS4-specific and linux-specific tests for the
diagnostics into one generic ELF test.
Also added a couple of PS5 runs while I was in there.
Added:
clang/test/Preprocessor/pragma-comment-elf.c
Modified:
clang/lib/Parse/ParsePragma.cpp
clang/test/CodeGen/pragma-comment.c
Removed:
clang/test/Preprocessor/pragma-comment-linux.c
clang/test/Preprocessor/pragma_ps4.c
################################################################################
diff --git a/clang/lib/Parse/ParsePragma.cpp b/clang/lib/Parse/ParsePragma.cpp
index f8e311c7c35ad..c94640c31c500 100644
--- a/clang/lib/Parse/ParsePragma.cpp
+++ b/clang/lib/Parse/ParsePragma.cpp
@@ -3027,14 +3027,6 @@ void PragmaCommentHandler::HandlePragma(Preprocessor &PP,
return;
}
- // On PS4, issue a warning about any pragma comments other than
- // #pragma comment lib.
- if (PP.getTargetInfo().getTriple().isPS4() && Kind != PCK_Lib) {
- PP.Diag(Tok.getLocation(), diag::warn_pragma_comment_ignored)
- << II->getName();
- return;
- }
-
// Read the optional string if present.
PP.Lex(Tok);
std::string ArgumentString;
diff --git a/clang/test/CodeGen/pragma-comment.c b/clang/test/CodeGen/pragma-comment.c
index 25675d94c5a4d..a4746f5c47bf6 100644
--- a/clang/test/CodeGen/pragma-comment.c
+++ b/clang/test/CodeGen/pragma-comment.c
@@ -4,6 +4,7 @@
// RUN: %clang_cc1 %s -triple thumbv7-linux-gnueabihf -fms-extensions -emit-llvm -o - | FileCheck -check-prefix ELF %s --implicit-check-not llvm.linker.options
// RUN: %clang_cc1 %s -triple i686-pc-linux -fms-extensions -emit-llvm -o - | FileCheck -check-prefix ELF %s --implicit-check-not llvm.linker.options
// RUN: %clang_cc1 %s -triple x86_64-scei-ps4 -fms-extensions -emit-llvm -o - | FileCheck -check-prefix ELF %s --implicit-check-not llvm.linker.options
+// RUN: %clang_cc1 %s -triple x86_64-sie-ps5 -fms-extensions -emit-llvm -o - | FileCheck -check-prefix ELF %s --implicit-check-not llvm.linker.options
// RUN: %clang_cc1 %s -triple aarch64-windows-msvc -fms-extensions -emit-llvm -o - | FileCheck %s
#pragma comment(lib, "msvcrt.lib")
diff --git a/clang/test/Preprocessor/pragma_ps4.c b/clang/test/Preprocessor/pragma-comment-elf.c
similarity index 79%
rename from clang/test/Preprocessor/pragma_ps4.c
rename to clang/test/Preprocessor/pragma-comment-elf.c
index 63651b6a96fb1..7b84aba51a0da 100644
--- a/clang/test/Preprocessor/pragma_ps4.c
+++ b/clang/test/Preprocessor/pragma-comment-elf.c
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 %s -triple x86_64-scei-ps4 -fsyntax-only -verify -fms-extensions
+// RUN: %clang_cc1 %s -fsyntax-only -verify -fms-extensions -triple x86_64-scei-ps4
+// RUN: %clang_cc1 %s -fsyntax-only -verify -fms-extensions -triple x86_64-sie-ps5
+// RUN: %clang_cc1 %s -fsyntax-only -verify -fms-extensions -triple i686-unknown-linux-gnu
-// On PS4, issue a diagnostic that pragma comments are ignored except:
+// On ELF targets, issue a diagnostic that pragma comments are ignored except:
// #pragma comment lib
#pragma comment(lib)
diff --git a/clang/test/Preprocessor/pragma-comment-linux.c b/clang/test/Preprocessor/pragma-comment-linux.c
deleted file mode 100644
index fcac049f46e83..0000000000000
--- a/clang/test/Preprocessor/pragma-comment-linux.c
+++ /dev/null
@@ -1,5 +0,0 @@
-// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fsyntax-only -verify %s -Wunknown-pragmas
-
-#pragma comment(linker, "")
-// expected-warning at -1 {{'#pragma comment linker' ignored}}
-
More information about the cfe-commits
mailing list