[Openmp-commits] [PATCH] D96581: [OpenMP] Only use #pragma comment(lib, ...) in MSVC build configurations

Martin Storsjö via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Feb 12 01:50:26 PST 2021


mstorsjo created this revision.
mstorsjo added reviewers: hbae, AndreyChurbanov.
Herald added subscribers: guansong, yaxunl.
mstorsjo requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.
Herald added a project: OpenMP.

MinGW build configurations don't support this pragma (unless compiling with clang, with -fms-extensions, and linking with lld), and at least clang warns about it.

This library does end up linked by the cmake files anyway (as long as the check works properly).

(I guess this could be made to be handled by cmake as well, by generalizing the existing code for mingw?)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96581

Files:
  openmp/runtime/src/z_Windows_NT_util.cpp


Index: openmp/runtime/src/z_Windows_NT_util.cpp
===================================================================
--- openmp/runtime/src/z_Windows_NT_util.cpp
+++ openmp/runtime/src/z_Windows_NT_util.cpp
@@ -24,7 +24,9 @@
 #include <ntsecapi.h> // UNICODE_STRING
 #include <ntstatus.h>
 #include <psapi.h>
+#ifdef _MSC_VER
 #pragma comment(lib, "psapi.lib")
+#endif
 
 enum SYSTEM_INFORMATION_CLASS {
   SystemProcessInformation = 5


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96581.323252.patch
Type: text/x-patch
Size: 435 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210212/6e5d430f/attachment.bin>


More information about the Openmp-commits mailing list