* winnt.h (C_ASSERT): Revert the EXTERN_C change from rev.4285/4286.
* usbioctl.h: Remove the extern "C" {} from the header completely.
There are no functions or variables are declared, only data types,
therefore it is not needed.
* dbghelp.h, psdk_inc/_dbg_common.h: move the extern "C" braces so
that the C_ASSERTs are not contained within them. (bug #3373905.)
* crtdbg.h, malloc.h (_STATIC_ASSERT): Restrict the typedef variant
of the macro to MSVC. Add an extern declaration variant for gcc,
similar to C_ASSERT.

git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@4293 4407c894-4637-0410-b4f5-ada5f102cad1
diff --git a/mingw-w64-headers/crt/ChangeLog b/mingw-w64-headers/crt/ChangeLog
index d0c881f..175561c 100644
--- a/mingw-w64-headers/crt/ChangeLog
+++ b/mingw-w64-headers/crt/ChangeLog
@@ -1,5 +1,11 @@
 2011-07-23  Ozkan Sezer  <sezeroz@gmail.com>
 
+	* crtdbg.h, malloc.h (_STATIC_ASSERT): Restrict the typedef variant
+	of the macro to MSVC. Add an extern declaration variant for gcc,
+	similar to C_ASSERT.
+
+2011-07-23  Ozkan Sezer  <sezeroz@gmail.com>
+
 	* _mingw.h (__debugbreak): Add prototype before the inline as it
 	appears in intrin.h.
 
diff --git a/mingw-w64-headers/crt/crtdbg.h b/mingw-w64-headers/crt/crtdbg.h
index f852abe..e864e0b 100644
--- a/mingw-w64-headers/crt/crtdbg.h
+++ b/mingw-w64-headers/crt/crtdbg.h
@@ -94,7 +94,11 @@
   } _CrtMemState;
 
 #ifndef _STATIC_ASSERT
+#if defined(_MSC_VER)
 #define _STATIC_ASSERT(expr) typedef char __static_assert_t[(expr)]
+#else
+#define _STATIC_ASSERT(expr) extern void __static_assert_t(int [(expr)?1:-1])
+#endif
 #endif
 
 #ifndef _ASSERT
diff --git a/mingw-w64-headers/crt/malloc.h b/mingw-w64-headers/crt/malloc.h
index 909c16f..7883266 100644
--- a/mingw-w64-headers/crt/malloc.h
+++ b/mingw-w64-headers/crt/malloc.h
@@ -21,7 +21,11 @@
 #endif
 
 #ifndef _STATIC_ASSERT
+#if defined(_MSC_VER)
 #define _STATIC_ASSERT(expr) typedef char __static_assert_t[(expr)]
+#else
+#define _STATIC_ASSERT(expr) extern void __static_assert_t(int [(expr)?1:-1])
+#endif
 #endif
 
 /* Return codes for _heapwalk()  */
diff --git a/mingw-w64-headers/include/ChangeLog b/mingw-w64-headers/include/ChangeLog
index c1c6a14..2a95552 100644
--- a/mingw-w64-headers/include/ChangeLog
+++ b/mingw-w64-headers/include/ChangeLog
@@ -1,5 +1,14 @@
 2011-07-23  Ozkan Sezer  <sezeroz@gmail.com>
 
+	* winnt.h (C_ASSERT): Revert the EXTERN_C change from rev.4285/4286.
+	* usbioctl.h: Remove the extern "C" {} from the header completely.
+	There are no functions or variables are declared, only data types,
+	therefore it is not needed.
+	* dbghelp.h, psdk_inc/_dbg_common.h: move the extern "C" braces so
+	that the C_ASSERTs are not contained within them. (bug #3373905.)
+
+2011-07-23  Ozkan Sezer  <sezeroz@gmail.com>
+
 	* winnt.h: Move the intrin.h include before the __faststorefence
 	inline. Remove the redundant prototype for _m_prefetchw() which
 	is already in intrin.h.
diff --git a/mingw-w64-headers/include/dbghelp.h b/mingw-w64-headers/include/dbghelp.h
index 97bfcd6..188b4d9 100644
--- a/mingw-w64-headers/include/dbghelp.h
+++ b/mingw-w64-headers/include/dbghelp.h
@@ -14,13 +14,7 @@
 #endif
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
 #include <psdk_inc/_dbg_LOAD_IMAGE.h>
 #include <psdk_inc/_dbg_common.h>
 
-#ifdef __cplusplus
-}
-#endif
 #endif
diff --git a/mingw-w64-headers/include/psdk_inc/_dbg_common.h b/mingw-w64-headers/include/psdk_inc/_dbg_common.h
index 8368d66..18c66bb 100644
--- a/mingw-w64-headers/include/psdk_inc/_dbg_common.h
+++ b/mingw-w64-headers/include/psdk_inc/_dbg_common.h
@@ -5,6 +5,10 @@
  */
 #pragma once
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
   typedef WINBOOL (CALLBACK *PFIND_DEBUG_FILE_CALLBACK)(HANDLE FileHandle,PCSTR FileName,PVOID CallerData);
   typedef WINBOOL (CALLBACK *PFIND_DEBUG_FILE_CALLBACKW)(HANDLE FileHandle,PCWSTR FileName,PVOID CallerData);
   typedef WINBOOL (CALLBACK *PFINDFILEINPATHCALLBACK)(PCSTR filename,PVOID context);
@@ -1031,6 +1035,10 @@
   DBHLP_DEPRECIATED WINBOOL IMAGEAPI FindFileInSearchPath(HANDLE hprocess,PCSTR SearchPath,PCSTR FileName,DWORD one,DWORD two,DWORD three,PSTR FilePath);
   DBHLP_DEPRECIATED WINBOOL IMAGEAPI SymEnumSym(HANDLE hProcess,ULONG64 BaseOfDll,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext);
 
+#ifdef __cplusplus
+}
+#endif
+
 #define SYMF_OMAP_GENERATED 0x00000001
 #define SYMF_OMAP_MODIFIED 0x00000002
 #define SYMF_REGISTER 0x00000008
@@ -1535,6 +1543,10 @@
   ULONG   NumberOfEntries; /* FIXME: msdn says ULONG64 */
 } MINIDUMP_THREAD_INFO_LIST, *PMINIDUMP_THREAD_INFO_LIST;
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
   typedef WINBOOL (WINAPI *MINIDUMP_CALLBACK_ROUTINE)(PVOID CallbackParam,CONST PMINIDUMP_CALLBACK_INPUT CallbackInput,PMINIDUMP_CALLBACK_OUTPUT CallbackOutput);
 
   typedef struct _MINIDUMP_CALLBACK_INFORMATION {
@@ -1544,8 +1556,7 @@
 
 #define RVA_TO_ADDR(Mapping,Rva) ((PVOID)(((ULONG_PTR) (Mapping)) + (Rva)))
 
-  WINBOOL WINAPI MiniDumpWriteDump(HANDLE hProcess,DWORD ProcessId,HANDLE hFile,MINIDUMP_TYPE DumpType,CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,CONST PMINIDUMP_CALLBACK_INFORMATION 
-CallbackParam);
+  WINBOOL WINAPI MiniDumpWriteDump(HANDLE hProcess,DWORD ProcessId,HANDLE hFile,MINIDUMP_TYPE DumpType,CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam);
   WINBOOL WINAPI MiniDumpReadDumpStream(PVOID BaseOfDump,ULONG StreamNumber,PMINIDUMP_DIRECTORY *Dir,PVOID *StreamPointer,ULONG *StreamSize);
 
 WINBOOL WINAPI EnumerateLoadedModulesEx(
@@ -1971,6 +1982,9 @@
 #define SymSrvDeltaName SymSrvDeltaNameW
 #endif
 
-
 #include <poppack.h>
 
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/mingw-w64-headers/include/usbioctl.h b/mingw-w64-headers/include/usbioctl.h
index 50385c8..201df10 100644
--- a/mingw-w64-headers/include/usbioctl.h
+++ b/mingw-w64-headers/include/usbioctl.h
@@ -25,10 +25,6 @@
 #include "usb100.h"
 #include "usbiodef.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #define IOCTL_INTERNAL_USB_SUBMIT_URB  \
   CTL_CODE(FILE_DEVICE_USB, USB_SUBMIT_URB, METHOD_NEITHER, FILE_ANY_ACCESS)
 
@@ -667,7 +663,3 @@
 
 #endif /* USB_KERNEL_IOCTL */
 
-#ifdef __cplusplus
-}
-#endif
-
diff --git a/mingw-w64-headers/include/winnt.h b/mingw-w64-headers/include/winnt.h
index ff481d7..dc03dac 100644
--- a/mingw-w64-headers/include/winnt.h
+++ b/mingw-w64-headers/include/winnt.h
@@ -81,7 +81,7 @@
 #if defined(_MSC_VER)
 # define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
 #else
-# define C_ASSERT(e) EXTERN_C void __C_ASSERT__(int [(e)?1:-1])
+# define C_ASSERT(e) extern void __C_ASSERT__(int [(e)?1:-1])
 #endif
 
 #include <basetsd.h>