MSVC Warning 4116

Francois Gouget fgouget at free.fr
Mon Sep 6 07:41:07 CDT 2004


When compiling the generated tests with the Windows headers, winnt.h
defines TYPE_ALIGNMENT() as follows:

#define TYPE_ALIGNMENT( t ) \
    FIELD_OFFSET( struct { char x; t test; }, test )

This causes the MSVC compiler to complain that we are defining a type in
parentheses:

H:\wine\dlls\ntdll\tests\generated.c(466) : warning C4116: unnamed type definition in parentheses

This warning is issued literally hundreds of times which makes it really
annoying, especially as it's not even our fault: it's Microsoft's macro
that causes the warning. In fact it's so annoying that windows.h even
disables this warning. But many of our tests (e.g. ntdll) don't include
windows.h.

So this patch adds a statement to disable this warning if the compiler
is MSVC and the proper conditions are met.


Changelog:

 * tools/winapi/winapi_test
   dlls/gdi/tests/generated.c
   dlls/kernel/tests/generated.c
   dlls/ntdll/tests/generated.c
   dlls/shell32/tests/generated.c
   dlls/shlwapi/tests/generated.c
   dlls/user/tests/generated.c
   dlls/wininet/tests/generated.c

   Disable MSVC warning 4116 to avoid the 'unnamed type definition in
parentheses' warning caused by TYPE_ALIGNMENT().


-- 
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
            Before you criticize someone, walk a mile in his shoes.
       That way, if he gets angry, he'll be a mile away - and barefoot.
-------------- next part --------------
Index: tools/winapi/winapi_test
===================================================================
RCS file: /var/cvs/wine/tools/winapi/winapi_test,v
retrieving revision 1.18
diff -u -r1.18 winapi_test
--- tools/winapi/winapi_test	1 Sep 2004 04:53:22 -0000	1.18
+++ tools/winapi/winapi_test	6 Sep 2004 12:32:12 -0000
@@ -523,6 +523,10 @@
     print OUT " */\n";
     print OUT "#endif\n";
     print OUT "\n";
+    print OUT "#if defined(TYPE_ALIGNMENT) && defined(_MSC_VER) && _MSC_VER >= 800 && !defined(__cplusplus)\n";
+    print OUT "#pragma warning(disable:4116)\n";
+    print OUT "#endif\n";
+    print OUT "\n";
     print OUT "#if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT)\n";
     print OUT "# define TYPE_ALIGNMENT _TYPE_ALIGNMENT\n";
     print OUT "#endif\n";
Index: dlls/gdi/tests/generated.c
===================================================================
RCS file: /var/cvs/wine/dlls/gdi/tests/generated.c,v
retrieving revision 1.12
diff -u -r1.12 generated.c
--- dlls/gdi/tests/generated.c	25 Aug 2004 00:42:51 -0000	1.12
+++ dlls/gdi/tests/generated.c	6 Sep 2004 12:33:12 -0000
@@ -47,6 +47,10 @@
  */
 #endif
 
+#if defined(TYPE_ALIGNMENT) && defined(_MSC_VER) && _MSC_VER >= 800 && !defined(__cplusplus)
+#pragma warning(disable:4116)
+#endif
+
 #if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT)
 # define TYPE_ALIGNMENT _TYPE_ALIGNMENT
 #endif
Index: dlls/kernel/tests/generated.c
===================================================================
RCS file: /var/cvs/wine/dlls/kernel/tests/generated.c,v
retrieving revision 1.13
diff -u -r1.13 generated.c
--- dlls/kernel/tests/generated.c	25 Aug 2004 00:42:51 -0000	1.13
+++ dlls/kernel/tests/generated.c	6 Sep 2004 12:33:12 -0000
@@ -47,6 +47,10 @@
  */
 #endif
 
+#if defined(TYPE_ALIGNMENT) && defined(_MSC_VER) && _MSC_VER >= 800 && !defined(__cplusplus)
+#pragma warning(disable:4116)
+#endif
+
 #if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT)
 # define TYPE_ALIGNMENT _TYPE_ALIGNMENT
 #endif
Index: dlls/ntdll/tests/generated.c
===================================================================
RCS file: /var/cvs/wine/dlls/ntdll/tests/generated.c,v
retrieving revision 1.19
diff -u -r1.19 generated.c
--- dlls/ntdll/tests/generated.c	1 Sep 2004 04:53:36 -0000	1.19
+++ dlls/ntdll/tests/generated.c	6 Sep 2004 12:33:12 -0000
@@ -47,6 +47,10 @@
  */
 #endif
 
+#if defined(TYPE_ALIGNMENT) && defined(_MSC_VER) && _MSC_VER >= 800 && !defined(__cplusplus)
+#pragma warning(disable:4116)
+#endif
+
 #if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT)
 # define TYPE_ALIGNMENT _TYPE_ALIGNMENT
 #endif
Index: dlls/shell32/tests/generated.c
===================================================================
RCS file: /var/cvs/wine/dlls/shell32/tests/generated.c,v
retrieving revision 1.11
diff -u -r1.11 generated.c
--- dlls/shell32/tests/generated.c	25 Aug 2004 00:42:51 -0000	1.11
+++ dlls/shell32/tests/generated.c	6 Sep 2004 12:33:13 -0000
@@ -54,6 +54,10 @@
  */
 #endif
 
+#if defined(TYPE_ALIGNMENT) && defined(_MSC_VER) && _MSC_VER >= 800 && !defined(__cplusplus)
+#pragma warning(disable:4116)
+#endif
+
 #if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT)
 # define TYPE_ALIGNMENT _TYPE_ALIGNMENT
 #endif
Index: dlls/shlwapi/tests/generated.c
===================================================================
RCS file: /var/cvs/wine/dlls/shlwapi/tests/generated.c,v
retrieving revision 1.6
diff -u -r1.6 generated.c
--- dlls/shlwapi/tests/generated.c	19 Aug 2004 19:59:41 -0000	1.6
+++ dlls/shlwapi/tests/generated.c	6 Sep 2004 12:33:13 -0000
@@ -52,6 +52,10 @@
  */
 #endif
 
+#if defined(TYPE_ALIGNMENT) && defined(_MSC_VER) && _MSC_VER >= 800 && !defined(__cplusplus)
+#pragma warning(disable:4116)
+#endif
+
 #if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT)
 # define TYPE_ALIGNMENT _TYPE_ALIGNMENT
 #endif
Index: dlls/urlmon/tests/generated.c
===================================================================
RCS file: /var/cvs/wine/dlls/urlmon/tests/generated.c,v
retrieving revision 1.5
diff -u -r1.5 generated.c
--- dlls/urlmon/tests/generated.c	4 May 2004 00:41:11 -0000	1.5
+++ dlls/urlmon/tests/generated.c	6 Sep 2004 12:33:13 -0000
@@ -50,6 +50,10 @@
  */
 #endif
 
+#if defined(TYPE_ALIGNMENT) && defined(_MSC_VER) && _MSC_VER >= 800 && !defined(__cplusplus)
+#pragma warning(disable:4116)
+#endif
+
 #if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT)
 # define TYPE_ALIGNMENT _TYPE_ALIGNMENT
 #endif
Index: dlls/user/tests/generated.c
===================================================================
RCS file: /var/cvs/wine/dlls/user/tests/generated.c,v
retrieving revision 1.13
diff -u -r1.13 generated.c
--- dlls/user/tests/generated.c	25 Aug 2004 00:44:35 -0000	1.13
+++ dlls/user/tests/generated.c	6 Sep 2004 12:33:13 -0000
@@ -47,6 +47,10 @@
  */
 #endif
 
+#if defined(TYPE_ALIGNMENT) && defined(_MSC_VER) && _MSC_VER >= 800 && !defined(__cplusplus)
+#pragma warning(disable:4116)
+#endif
+
 #if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT)
 # define TYPE_ALIGNMENT _TYPE_ALIGNMENT
 #endif
Index: dlls/wininet/tests/generated.c
===================================================================
RCS file: /var/cvs/wine/dlls/wininet/tests/generated.c,v
retrieving revision 1.6
diff -u -r1.6 generated.c
--- dlls/wininet/tests/generated.c	25 Aug 2004 00:42:51 -0000	1.6
+++ dlls/wininet/tests/generated.c	6 Sep 2004 12:33:13 -0000
@@ -51,6 +51,10 @@
  */
 #endif
 
+#if defined(TYPE_ALIGNMENT) && defined(_MSC_VER) && _MSC_VER >= 800 && !defined(__cplusplus)
+#pragma warning(disable:4116)
+#endif
+
 #if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT)
 # define TYPE_ALIGNMENT _TYPE_ALIGNMENT
 #endif


More information about the wine-patches mailing list