[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:
Katayama Hirofumi MZ 2021-04-25 13:38:22 +09:00 committed by GitHub
parent 8bf471105e
commit 66f6abfc4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 3 deletions

View file

@ -147,7 +147,11 @@ extern "C" {
#define NM_THEMECHANGED (NM_FIRST-22)
#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))
#endif
#endif
typedef struct tagNMTOOLTIPSCREATED {