OSDN Git Service

Make <winnt.h> header effectively self-contained.
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Tue, 20 Jun 2017 21:41:37 +0000 (22:41 +0100)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Tue, 20 Jun 2017 21:41:37 +0000 (22:41 +0100)
w32api/ChangeLog
w32api/include/winnt.h

index 235e3ec..813be72 100644 (file)
@@ -1,3 +1,11 @@
+2017-06-20  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
+       Make <winnt.h> 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  <keithmarshall@users.sourceforge.net>
 
        Consolidate <winuser.h> version specific conditionals.
index 4dc1101..ce1ad6d 100644 (file)
  */
 #ifndef _WINNT_H
 #pragma GCC system_header
+
+/* For effective self-containment, <winnt.h> requires <windef.h> to have
+ * been included, BEFORE defining the _WINNT_H repeat inclusion guard...
+ */
+#include <windef.h>
+/* ...but this has the unfortunate side effect that <windef.h> may then
+ * recursively include <winnt.h>; retest the inclusion guard, to break
+ * out of any ensuing recursive inclusion loop.
+ */
+#ifndef _WINNT_H
 #define _WINNT_H
 
 #include <winerror.h>
@@ -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 */