diff --git a/src/debug/daccess/stdafx.h b/src/debug/daccess/stdafx.h index 1c19ebff10a2..93a5d23bf37b 100644 --- a/src/debug/daccess/stdafx.h +++ b/src/debug/daccess/stdafx.h @@ -21,6 +21,7 @@ #define USE_COM_CONTEXT_DEF +#include #include #include diff --git a/src/gc/env/volatile.h b/src/gc/env/volatile.h index 782b6eff4177..311e12663f54 100644 --- a/src/gc/env/volatile.h +++ b/src/gc/env/volatile.h @@ -448,32 +448,6 @@ class VolatilePtr : public Volatile

} }; - -// -// Warning: workaround -// -// At the bottom of this file, we are going to #define the "volatile" keyword such that it is illegal -// to use it. Unfortunately, VC++ uses the volatile keyword in stddef.h, in the definition of "offsetof". -// GCC does not use volatile in its definition. -// -// To get around this, we include stddef.h here (even if we're on GCC, for consistency). We then need -// to redefine offsetof such that it does not use volatile, if we're building with VC++. -// -#include -#ifdef _MSC_VER -#undef offsetof -#ifdef _WIN64 -#define offsetof(s,m) (size_t)( (ptrdiff_t)&reinterpret_cast((((s *)0)->m)) ) -#else -#define offsetof(s,m) (size_t)&reinterpret_cast((((s *)0)->m)) -#endif //_WIN64 - -// These also use volatile, so we'll include them here. -//#include -//#include - -#endif //_MSC_VER - #define VOLATILE(T) Volatile #endif //_VOLATILE_H_ diff --git a/src/inc/corinfo.h b/src/inc/corinfo.h index d430412f3bc5..2b36ff96201f 100644 --- a/src/inc/corinfo.h +++ b/src/inc/corinfo.h @@ -1944,9 +1944,6 @@ struct DelegateCtorArgs // use offsetof to get the offset of the fields above #include // offsetof -#ifndef offsetof -#define offsetof(s,m) ((size_t)&(((s *)0)->m)) -#endif // Guard-stack cookie for preventing against stack buffer overruns typedef SIZE_T GSCookie; diff --git a/src/inc/corpriv.h b/src/inc/corpriv.h index edd55e911103..9641b05644bb 100644 --- a/src/inc/corpriv.h +++ b/src/inc/corpriv.h @@ -309,9 +309,6 @@ typedef enum CorOpenFlagsInternal #endif // %%Classes: ---------------------------------------------------------------- -#ifndef offsetof -#define offsetof(s,f) ((ULONG)(&((s*)0)->f)) -#endif #ifndef lengthof #define lengthof(rg) (sizeof(rg)/sizeof(rg[0])) #endif diff --git a/src/inc/gcinfotypes.h b/src/inc/gcinfotypes.h index c802d97ec689..ac82dfb2fce9 100644 --- a/src/inc/gcinfotypes.h +++ b/src/inc/gcinfotypes.h @@ -331,9 +331,6 @@ inline const char *ReturnKindToString(ReturnKind returnKind) // we use offsetof to get the offset of a field #include // offsetof -#ifndef offsetof -#define offsetof(s,m) ((size_t)&(((s *)0)->m)) -#endif enum infoHdrAdjustConstants { // Constants diff --git a/src/inc/slist.h b/src/inc/slist.h index 2b81f9ba902b..9a75e1d6d535 100644 --- a/src/inc/slist.h +++ b/src/inc/slist.h @@ -136,14 +136,14 @@ class SList } else { -#ifdef __GNUC__ - // GCC defines offsetof to be __builtin_offsetof, which doesn't use the +#if 1 + // Newer compilers define offsetof to be __builtin_offsetof, which doesn't use the // old-school memory model trick to determine offset. const UINT_PTR offset = (((UINT_PTR)&(((T *)0x1000)->*LinkPtr))-0x1000); return (T*)__PTR(dac_cast(pLink) - offset); #else - return (T*)__PTR(dac_cast(pLink) - offsetof(T, *LinkPtr)); -#endif // __GNUC__ + return (T*)__PTR(dac_cast(pLink) - offsetof(T, *LinkPtr)); +#endif } } diff --git a/src/inc/volatile.h b/src/inc/volatile.h index ecf9ffe42789..fa756ef05191 100644 --- a/src/inc/volatile.h +++ b/src/inc/volatile.h @@ -474,32 +474,6 @@ class VolatilePtr : public Volatile

} }; - -// -// Warning: workaround -// -// At the bottom of this file, we are going to #define the "volatile" keyword such that it is illegal -// to use it. Unfortunately, VC++ uses the volatile keyword in stddef.h, in the definition of "offsetof". -// GCC does not use volatile in its definition. -// -// To get around this, we include stddef.h here (even if we're on GCC, for consistency). We then need -// to redefine offsetof such that it does not use volatile, if we're building with VC++. -// -#include -#ifdef _MSC_VER -#undef offsetof -#ifdef _WIN64 -#define offsetof(s,m) (size_t)( (ptrdiff_t)&reinterpret_cast((((s *)0)->m)) ) -#else -#define offsetof(s,m) (size_t)&reinterpret_cast((((s *)0)->m)) -#endif //_WIN64 - -// These also use volatile, so we'll include them here. -//#include -//#include - -#endif //_MSC_VER - // // From here on out, we ban the use of the "volatile" keyword. If you found this while trying to define // a volatile variable, go to the top of this file and start reading. diff --git a/src/pal/src/map/map.cpp b/src/pal/src/map/map.cpp index 4a435f8cefc7..d25bd928a958 100644 --- a/src/pal/src/map/map.cpp +++ b/src/pal/src/map/map.cpp @@ -31,6 +31,7 @@ Module Name: #include "pal/file.hpp" #include "pal/malloc.hpp" +#include #include #include #include diff --git a/src/vm/common.h b/src/vm/common.h index 1008533dddad..082343adb06c 100644 --- a/src/vm/common.h +++ b/src/vm/common.h @@ -66,6 +66,7 @@ #include +#include #include diff --git a/src/zap/common.h b/src/zap/common.h index 0abb2ce7515e..2722e73b72a0 100644 --- a/src/zap/common.h +++ b/src/zap/common.h @@ -13,11 +13,11 @@ #define __COMMON_H__ #include +#include #include #include #include #include -#include #include #include