Skip to content

Commit a912f89

Browse files
committed
[PSDK] Improve the DECLSPEC_NOINITALL definition (reactos#8438)
Addendum to commit 73b54ce. Conditionally define it on the `_MSC_VER >= 1915, and add the other `MIDL_PASS` and co. guard checks as in the official Windows PSDK. Additionally, no-op the define for Clang to silence the following warnings: ``` sdk\include\ddk\ntddk.h(2050,35): warning: __declspec attribute 'no_init_all' is not supported [-Wignored-attributes] sdk\include\psdk\ntdef.h(40,95): note: expanded from macro 'DECLSPEC_NOINITALL' ``` Granted, this may be due to the fact our GitHub actions currently use Clang 13.0.1: ``` -- The C compiler identification is Clang 13.0.1 with MSVC-like command-line -- The CXX compiler identification is Clang 13.0.1 with MSVC-like command-line ``` while support for `no_init_all` may have been added for Clang 22.0.0, if https://clang.llvm.org/docs/AttributeReference.html#no-init-all is correct. (See PR llvm/llvm-project#116847 )
1 parent 3000d45 commit a912f89

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

sdk/include/xdk/ntdef.template.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ extern "C" {
3939
#endif
4040

4141
#ifndef DECLSPEC_NOINITALL
42-
#if defined(_MSC_VER)
42+
#if defined(_MSC_VER) && (!defined(__clang__) || (__clang_major__ >= 22)) && \
43+
(_MSC_VER >= 1915) && !defined(MIDL_PASS) && !defined(SORTPP_PASS) && !defined(RC_INVOKED)
4344
#define DECLSPEC_NOINITALL __pragma(warning(push)) __pragma(warning(disable:4845)) __declspec(no_init_all) __pragma(warning(pop))
4445
#else
4546
#define DECLSPEC_NOINITALL

sdk/include/xdk/winnt.template.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
#endif
5858

5959
#ifndef DECLSPEC_NOINITALL
60-
#if defined(_MSC_VER)
60+
#if defined(_MSC_VER) && (!defined(__clang__) || (__clang_major__ >= 22)) && \
61+
(_MSC_VER >= 1915) && !defined(MIDL_PASS) && !defined(SORTPP_PASS) && !defined(RC_INVOKED)
6162
#define DECLSPEC_NOINITALL __pragma(warning(push)) __pragma(warning(disable:4845)) __declspec(no_init_all) __pragma(warning(pop))
6263
#else
6364
#define DECLSPEC_NOINITALL

0 commit comments

Comments
 (0)