OSDN Git Service

Make <wincon.h> header effectively self-contained.
authorKeith Marshall <keith@users.osdn.me>
Wed, 24 Oct 2018 20:41:19 +0000 (21:41 +0100)
committerKeith Marshall <keith@users.osdn.me>
Wed, 24 Oct 2018 20:41:19 +0000 (21:41 +0100)
w32api/ChangeLog
w32api/include/wincon.h

index 65f4301..470878f 100644 (file)
@@ -1,3 +1,13 @@
+2018-10-24  Keith Marshall  <keith@users.osdn.me>
+
+       Make <wincon.h> header effectively self-contained.
+
+       * include/wincon.h [_WIN32_WINNT < 0x0600]: Include <windef.h>...
+       [_WIN32_WINNT >= 0x0600]: ...but, Vista and later need <wingdi.h>
+       [__GNUC__ >= 3]: Remove condition; used only in association with...
+       (#pragma GCC system_header): ...this, it is redundant in this context.
+       [_BEGIN_C_DECLS, _END_C_DECLS]: Use them as appropriate.
+
 2018-10-24  David Gressett  <texasgaidheal@users.osdn.me>
 
        Improve WinXP/Vista console I/O support.
index f49d994..5fbe429 100644 (file)
@@ -1,13 +1,21 @@
 #ifndef _WINCON_H
 #define _WINCON_H
-#if __GNUC__ >= 3
 #pragma GCC system_header
-#endif
 
-#ifdef __cplusplus
-extern "C" {
+#if _WIN32_WINNT < 0x0600
+/* For effective self-containment, <wincon.h> is dependent on the core set
+ * of Windows' custom type definitions; prior to Vista, it suffices to...
+ */
+# include <windef.h>
+#else
+/* ...but Vista and later introduce additional dependencies on <wingdi.h>;
+ * this will indirectly include <windef.h> anyway, so it suffices to...
+ */
+# include <wingdi.h>
 #endif
 
+_BEGIN_C_DECLS
+
 #define FOREGROUND_BLUE        1
 #define FOREGROUND_GREEN       2
 #define FOREGROUND_RED 4
@@ -355,7 +363,6 @@ BOOL WINAPI WriteConsoleOutputCharacterW(HANDLE,LPCWSTR,DWORD,COORD,PDWORD);
 #define WriteConsoleOutputCharacter WriteConsoleOutputCharacterA
 #endif
 
-#ifdef __cplusplus
-}
-#endif
+_END_C_DECLS
+
 #endif