From d1b3b1693bdec6472d72b085b1e2651866472162 Mon Sep 17 00:00:00 2001 From: Keith Marshall Date: Tue, 20 Jun 2017 22:41:37 +0100 Subject: [PATCH] Make header effectively self-contained. --- w32api/ChangeLog | 8 ++++++++ w32api/include/winnt.h | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/w32api/ChangeLog b/w32api/ChangeLog index 235e3ec..813be72 100644 --- a/w32api/ChangeLog +++ b/w32api/ChangeLog @@ -1,3 +1,11 @@ +2017-06-20 Keith Marshall + + Make header effectively self-contained. + + * include/winnt.h (_WINNT_H): Defer definition unless included via... + (windef.h): ...this; include it, to enforce inclusion order, then... + [_WINNT_H]: ...re-evaluate it, to avoid recursive inclusion loop. + 2017-06-12 Keith Marshall Consolidate version specific conditionals. diff --git a/w32api/include/winnt.h b/w32api/include/winnt.h index 4dc1101..ce1ad6d 100644 --- a/w32api/include/winnt.h +++ b/w32api/include/winnt.h @@ -31,6 +31,16 @@ */ #ifndef _WINNT_H #pragma GCC system_header + +/* For effective self-containment, requires to have + * been included, BEFORE defining the _WINNT_H repeat inclusion guard... + */ +#include +/* ...but this has the unfortunate side effect that may then + * recursively include ; retest the inclusion guard, to break + * out of any ensuing recursive inclusion loop. + */ +#ifndef _WINNT_H #define _WINNT_H #include @@ -4324,4 +4334,5 @@ static FORCEINLINE void MemoryBarrier (void) _END_C_DECLS #endif /* ! RC_INVOKED */ +#endif /* !_WINNT_H: internal recursion break */ #endif /* !_WINNT_H: $RCSfile$: end of file */ -- 2.11.0