office-gobmx/external/nss/clang-cl.patch.0
Stephan Bergmann 2f39a7b8f9 external/nss: More -Werror,-Wunknown-pragmas with clang-cl
> In file included from C:/lo-clang/core/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx:28:
> In file included from C:/lo-clang/core/workdir/UnpackedTarball/nss/dist/public/nss\pk11pub.h:12:
> In file included from C:/lo-clang/core/workdir/UnpackedTarball/nss/dist/public/nss/pk11hpke.h:8:
> C:/lo-clang/core/workdir/UnpackedTarball/nss/dist/public/nss/blapit.h(66,9): error: unknown pragma ignored [-Werror,-Wunknown-pragmas]
> #pragma deprecated(DSA_SUBPRIME_LEN, DSA_SIGNATURE_LEN, DSA_QBITS)
>         ^

Change-Id: If84d8640d770ed20a6492678a9bc7fe4f4a547f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124407
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-29 13:25:53 +02:00

122 lines
4.1 KiB
Text

# "#pragma deprecated" and "#pragma intrinsic" not (yet?) handled in the "if
# (LangOpts.MicrosoftExt)" block in Preprocessor::RegisterBuiltinPragmas in
# Clang's lib/Lex/Pragma.cpp:
--- nspr/pr/include/pratom.h
+++ nspr/pr/include/pratom.h
@@ -83,7 +83,7 @@
#include <intrin.h>
-#ifdef _MSC_VER
+#if defined _WIN32 && !defined __clang__
#pragma intrinsic(_InterlockedIncrement)
#pragma intrinsic(_InterlockedDecrement)
#pragma intrinsic(_InterlockedExchange)
--- nspr/pr/include/prbit.h
+++ nspr/pr/include/prbit.h
@@ -14,7 +14,7 @@
*/
#if defined(_WIN32) && (_MSC_VER >= 1300) && \
(defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM) || \
- defined(_M_ARM64))
+ defined(_M_ARM64)) && !defined __clang__
# include <intrin.h>
# pragma intrinsic(_BitScanForward,_BitScanReverse)
__forceinline static int __prBitScanForward32(unsigned int val)
@@ -32,7 +32,7 @@
# define pr_bitscan_ctz32(val) __prBitScanForward32(val)
# define pr_bitscan_clz32(val) __prBitScanReverse32(val)
# define PR_HAVE_BUILTIN_BITSCAN32
-#elif ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) && \
+#elif defined __GNUC__ && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) && \
(defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
defined(__aarch64__))
# define pr_bitscan_ctz32(val) __builtin_ctz(val)
@@ -136,7 +136,7 @@
*/
#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64) || \
- defined(_M_X64) || defined(_M_ARM) || defined(_M_ARM64))
+ defined(_M_X64) || defined(_M_ARM) || defined(_M_ARM64)) && !defined __clang__
#include <stdlib.h>
#pragma intrinsic(_rotl, _rotr)
#define PR_ROTATE_LEFT32(a, bits) _rotl(a, bits)
--- nss/lib/certdb/certdb.h
+++ nss/lib/certdb/certdb.h
@@ -21,7 +21,7 @@
/* On Windows, Mac, and Linux (and other gcc platforms), we can give compile
* time deprecation warnings when applications use the old CERTDB_VALID_PEER
* define */
-#if __GNUC__ > 3
+#if defined __GNUC__ && __GNUC__ > 3
#if (__GNUC__ == 4) && (__GNUC_MINOR__ < 5)
typedef unsigned int __CERTDB_VALID_PEER __attribute__((deprecated));
#else
@@ -30,7 +30,7 @@
#endif
#define CERTDB_VALID_PEER ((__CERTDB_VALID_PEER)CERTDB_TERMINAL_RECORD)
#else
-#ifdef _WIN32
+#if defined _WIN32 && !defined __clang__
#pragma deprecated(CERTDB_VALID_PEER)
#endif
#define CERTDB_VALID_PEER CERTDB_TERMINAL_RECORD
--- nss/lib/freebl/blapit.h
+++ nss/lib/freebl/blapit.h
@@ -53,7 +53,7 @@
* Mark the old defines as deprecated. This will warn code that expected
* DSA1 only that they need to change if the are to support DSA2.
*/
-#if defined(__GNUC__) && (__GNUC__ > 3)
+#if defined(__GNUC__) && (__GNUC__ > 3) || defined __clang__
/* make GCC warn when we use these #defines */
typedef int __BLAPI_DEPRECATED __attribute__((deprecated));
#define DSA_SUBPRIME_LEN ((__BLAPI_DEPRECATED)DSA1_SUBPRIME_LEN)
--- nss/lib/util/pkcs11n.h
+++ nss/lib/util/pkcs11n.h
@@ -426,7 +426,7 @@
/* keep the old value for compatibility reasons*/
#define CKT_NSS_MUST_VERIFY ((__CKT_NSS_MUST_VERIFY)(CKT_NSS + 4))
#else
-#ifdef _WIN32
+#if defined _WIN32 && !defined __clang__
/* This magic gets the windows compiler to give us a deprecation
* warning */
#pragma deprecated(CKT_NSS_UNTRUSTED, CKT_NSS_MUST_VERIFY, CKT_NSS_VALID)
# While MSVC uses
# #pragma warning(disable : 4103)
# in the inner pkcs11p.h, clang-cl wants
# #pragma clang diagnostic ignored "-Wpragma-pack"
# in the outer pkcs11t.h:
--- nss/lib/util/pkcs11t.h
+++ nss/lib/util/pkcs11t.h
@@ -72,7 +72,14 @@
#define CK_INVALID_HANDLE 0
/* pack */
+#if defined __clang__ && defined _MSC_VER
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpragma-pack"
+#endif
#include "pkcs11p.h"
+#if defined __clang__ && defined _MSC_VER
+#pragma clang diagnostic pop
+#endif
typedef struct CK_VERSION {
CK_BYTE major; /* integer portion of version number */
@@ -1795,6 +1802,13 @@
#include "pkcs11n.h"
/* undo packing */
+#if defined __clang__ && defined _MSC_VER
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpragma-pack"
+#endif
#include "pkcs11u.h"
+#if defined __clang__ && defined _MSC_VER
+#pragma clang diagnostic pop
+#endif
#endif