use #pragma comment(lib) with _MSC_VER only
authorViktor Szakats <commit@vsz.me>
Sun, 3 Jul 2022 22:30:06 +0000 (22:30 +0000)
committerTomas Mraz <tomas@openssl.org>
Mon, 11 Jul 2022 08:37:28 +0000 (10:37 +0200)
Avoid this warning when compiled with llvm/gcc + mingw-w64 and
`USE_BCRYPTGENRANDOM` enabled:

```
../providers/implementations/rands/seeding/rand_win.c:31:11: warning: unknown pragma ignored [-Wunknown-pragmas]
          ^
1 warning generated.
```

CLA: trivial

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18709)

(cherry picked from commit 695cb63c744bab090144a86949b68324ee3094d6)

crypto/rand/rand_win.c

index 903654600858744256de930376f3b6a9ef68cb69..75ed90bd384c4381675eb6293f5592b7c4ab6596 100644 (file)
@@ -26,7 +26,9 @@
 
 # ifdef USE_BCRYPTGENRANDOM
 #  include <bcrypt.h>
-#  pragma comment(lib, "bcrypt.lib")
+#  ifdef _MSC_VER
+#   pragma comment(lib, "bcrypt.lib")
+#  endif
 #  ifndef STATUS_SUCCESS
 #   define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
 #  endif