* 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, imagehlp.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/branches/releases/v1.0@4292 4407c894-4637-0410-b4f5-ada5f102cad1
diff --git a/mingw-w64-headers/include/ChangeLog b/mingw-w64-headers/include/ChangeLog
index 84ded3b..1ae28bb 100644
--- a/mingw-w64-headers/include/ChangeLog
+++ b/mingw-w64-headers/include/ChangeLog
@@ -1,5 +1,17 @@
 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, imagehlp.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.
+
+2011-07-23  Ozkan Sezer  <sezeroz@gmail.com>
+
 	* _mingw.h (__debugbreak): Add prototype before the inline as it
 	appears in intrin.h.
 	* winnt.h: Move the intrin.h include before the __faststorefence
diff --git a/mingw-w64-headers/include/crtdbg.h b/mingw-w64-headers/include/crtdbg.h
index f852abe..e864e0b 100644
--- a/mingw-w64-headers/include/crtdbg.h
+++ b/mingw-w64-headers/include/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/include/dbghelp.h b/mingw-w64-headers/include/dbghelp.h
index 00c561e..e328c50 100644
--- a/mingw-w64-headers/include/dbghelp.h
+++ b/mingw-w64-headers/include/dbghelp.h
@@ -12,10 +12,6 @@
 #endif
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #define IMAGEAPI DECLSPEC_IMPORT WINAPI
 #define DBHLP_DEPRECIATED __declspec(deprecated)
 
@@ -46,6 +42,10 @@
 
 #define MAX_SYM_NAME 2000
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
   typedef WINBOOL (CALLBACK *PFIND_DEBUG_FILE_CALLBACK)(HANDLE FileHandle,PCSTR FileName,PVOID CallerData);
   typedef WINBOOL (CALLBACK *PFINDFILEINPATHCALLBACK)(PCSTR filename,PVOID context);
   typedef WINBOOL (CALLBACK *PFIND_EXE_FILE_CALLBACK)(HANDLE FileHandle,PCSTR FileName,PVOID CallerData);
@@ -928,6 +928,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
@@ -1337,6 +1341,10 @@
     MiniDumpWithoutOptionalData              = 0x00000400
   } MINIDUMP_TYPE;
 
+#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 {
@@ -1354,4 +1362,5 @@
 #ifdef __cplusplus
 }
 #endif
+
 #endif
diff --git a/mingw-w64-headers/include/imagehlp.h b/mingw-w64-headers/include/imagehlp.h
index a5aed24..e2b0ddd 100644
--- a/mingw-w64-headers/include/imagehlp.h
+++ b/mingw-w64-headers/include/imagehlp.h
@@ -14,10 +14,6 @@
 
 #include <wintrust.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #ifndef WINAPI
 #define WINAPI __stdcall
 #endif
@@ -75,6 +71,10 @@
     BindForwarderNOT64
   } IMAGEHLP_STATUS_REASON;
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
   typedef WINBOOL (WINAPI *PIMAGEHLP_STATUS_ROUTINE)(IMAGEHLP_STATUS_REASON Reason,PCSTR ImageName,PCSTR DllName,ULONG_PTR Va,ULONG_PTR Parameter);
   typedef WINBOOL (WINAPI *PIMAGEHLP_STATUS_ROUTINE32)(IMAGEHLP_STATUS_REASON Reason,PCSTR ImageName,PCSTR DllName,ULONG Va,ULONG_PTR Parameter);
   typedef WINBOOL (WINAPI *PIMAGEHLP_STATUS_ROUTINE64)(IMAGEHLP_STATUS_REASON Reason,PCSTR ImageName,PCSTR DllName,ULONG64 Va,ULONG_PTR Parameter);
@@ -1019,6 +1019,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
@@ -1428,6 +1432,10 @@
     MiniDumpWithoutOptionalData              = 0x00000400
   } MINIDUMP_TYPE;
 
+#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 {
@@ -1445,4 +1453,5 @@
 #ifdef __cplusplus
 }
 #endif
+
 #endif
diff --git a/mingw-w64-headers/include/malloc.h b/mingw-w64-headers/include/malloc.h
index 19e8c3e..651cc5b 100644
--- a/mingw-w64-headers/include/malloc.h
+++ b/mingw-w64-headers/include/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/usbioctl.h b/mingw-w64-headers/include/usbioctl.h
index 4e1dd02..18167bb 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 666408d..c03ec66 100644
--- a/mingw-w64-headers/include/winnt.h
+++ b/mingw-w64-headers/include/winnt.h
@@ -79,7 +79,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>