Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/debug/daccess/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#define USE_COM_CONTEXT_DEF

#include <stddef.h>
#include <stdint.h>
#include <windows.h>

Expand Down
26 changes: 0 additions & 26 deletions src/gc/env/volatile.h
Original file line number Diff line number Diff line change
Expand Up @@ -448,32 +448,6 @@ class VolatilePtr : public Volatile<P>
}
};


//
// 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 <stddef.h>
#ifdef _MSC_VER
#undef offsetof
#ifdef _WIN64
#define offsetof(s,m) (size_t)( (ptrdiff_t)&reinterpret_cast<const char&>((((s *)0)->m)) )
#else
#define offsetof(s,m) (size_t)&reinterpret_cast<const char&>((((s *)0)->m))
#endif //_WIN64

// These also use volatile, so we'll include them here.
//#include <intrin.h>
//#include <memory>

#endif //_MSC_VER

#define VOLATILE(T) Volatile<T>

#endif //_VOLATILE_H_
3 changes: 0 additions & 3 deletions src/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -1944,9 +1944,6 @@ struct DelegateCtorArgs

// use offsetof to get the offset of the fields above
#include <stddef.h> // 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;
Expand Down
3 changes: 0 additions & 3 deletions src/inc/corpriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions src/inc/gcinfotypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,6 @@ inline const char *ReturnKindToString(ReturnKind returnKind)

// we use offsetof to get the offset of a field
#include <stddef.h> // offsetof
#ifndef offsetof
#define offsetof(s,m) ((size_t)&(((s *)0)->m))
#endif

enum infoHdrAdjustConstants {
// Constants
Expand Down
8 changes: 4 additions & 4 deletions src/inc/slist.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<TADDR>(pLink) - offset);
#else
return (T*)__PTR(dac_cast<TADDR>(pLink) - offsetof(T, *LinkPtr));
#endif // __GNUC__
return (T*)__PTR(dac_cast<TADDR>(pLink) - offsetof(T, *LinkPtr));
#endif
}
}

Expand Down
26 changes: 0 additions & 26 deletions src/inc/volatile.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,32 +474,6 @@ class VolatilePtr : public Volatile<P>
}
};


//
// 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 <stddef.h>
#ifdef _MSC_VER
#undef offsetof
#ifdef _WIN64
#define offsetof(s,m) (size_t)( (ptrdiff_t)&reinterpret_cast<const char&>((((s *)0)->m)) )
#else
#define offsetof(s,m) (size_t)&reinterpret_cast<const char&>((((s *)0)->m))
#endif //_WIN64

// These also use volatile, so we'll include them here.
//#include <intrin.h>
//#include <memory>

#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.
Expand Down
1 change: 1 addition & 0 deletions src/pal/src/map/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Module Name:
#include "pal/file.hpp"
#include "pal/malloc.hpp"

#include <stddef.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/mman.h>
Expand Down
1 change: 1 addition & 0 deletions src/vm/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@


#include <stdint.h>
#include <stddef.h>
#include <winwrap.h>


Expand Down
2 changes: 1 addition & 1 deletion src/zap/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
#define __COMMON_H__

#include <stdint.h>
#include <stddef.h>
#include <winwrap.h>
#include <windows.h>
#include <stdlib.h>
#include <objbase.h>
#include <stddef.h>
#include <float.h>
#include <limits.h>

Expand Down