mirror of
https://github.com/reactos/reactos.git
synced 2025-06-20 07:36:05 +00:00
[SDK][INCLUDE] Fix offsetof and CCSIZEOF_STRUCT for Clang-CL build (#3624)
Clang-CL was failing with "error: function declaration cannot have variably modified type". This PR will fix the Clang-CL build. CORE-17547
This commit is contained in:
parent
8bf471105e
commit
66f6abfc4a
2 changed files with 19 additions and 3 deletions
|
@ -377,11 +377,23 @@ typedef __WCHAR_TYPE__ wchar_t;
|
||||||
#ifndef offsetof
|
#ifndef offsetof
|
||||||
|
|
||||||
/* Offset of member MEMBER in a struct of type TYPE. */
|
/* Offset of member MEMBER in a struct of type TYPE. */
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__) || defined(__clang__) || defined(_CRT_USE_BUILTIN_OFFSETOF)
|
||||||
# define offsetof(TYPE,MEMBER) __builtin_offsetof(TYPE,MEMBER)
|
# define offsetof(TYPE,MEMBER) __builtin_offsetof(TYPE,MEMBER)
|
||||||
#else
|
#else
|
||||||
|
# ifdef __cplusplus
|
||||||
|
# ifdef _WIN64
|
||||||
|
# define offsetof(TYPE,MEMBER) ((::size_t)(ptrdiff_t)&reinterpret_cast<const volatile char&>((((TYPE*)0)->MEMBER)))
|
||||||
|
# else
|
||||||
|
# define offsetof(TYPE,MEMBER) ((::size_t)&reinterpret_cast<const volatile char&>((((TYPE*)0)->MEMBER)))
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# ifdef _WIN64
|
||||||
|
# define offsetof(TYPE,MEMBER) ((size_t)(ptrdiff_t)&(((TYPE*)0)->MEMBER))
|
||||||
|
# else
|
||||||
# define offsetof(TYPE,MEMBER) ((size_t)&(((TYPE*)0)->MEMBER))
|
# define offsetof(TYPE,MEMBER) ((size_t)&(((TYPE*)0)->MEMBER))
|
||||||
# endif
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* !offsetof */
|
#endif /* !offsetof */
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,11 @@ extern "C" {
|
||||||
#define NM_THEMECHANGED (NM_FIRST-22)
|
#define NM_THEMECHANGED (NM_FIRST-22)
|
||||||
|
|
||||||
#ifndef CCSIZEOF_STRUCT
|
#ifndef CCSIZEOF_STRUCT
|
||||||
|
#if defined(__clang__) /* Clang-CL fails without this workaround. See CORE-17547 */
|
||||||
|
#define CCSIZEOF_STRUCT(structname,member) (__builtin_offsetof(structname,member) + sizeof(((structname*)0)->member))
|
||||||
|
#else
|
||||||
#define CCSIZEOF_STRUCT(structname,member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0))))+sizeof(((structname*)0)->member))
|
#define CCSIZEOF_STRUCT(structname,member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0))))+sizeof(((structname*)0)->member))
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct tagNMTOOLTIPSCREATED {
|
typedef struct tagNMTOOLTIPSCREATED {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue