diff mbox series

[4/4] lib/uuid: remove unneeded Windows UUID workaround

Message ID 20230128224651.59593-5-ebiggers@kernel.org
State Accepted
Headers show
Series e2fsprogs: a few more warning fixes | expand

Commit Message

Eric Biggers Jan. 28, 2023, 10:46 p.m. UTC
From: Eric Biggers <ebiggers@google.com>

Some .c files in lib/uuid/ contain the following:

	#ifdef _WIN32
	#define _WIN32_WINNT 0x0500
	#include <windows.h>
	#define UUID MYUUID
	#endif

This seems to have been intended to allow the use of a local "UUID" type
without colliding with "UUID" in the Windows API.  However, this is
unnecessary because there's no local "UUID" type -- there's only uuid_t.

None of these .c files need the include of windows.h, either.

Finally, the unconditional definition of _WIN32_WINNT causes a compiler
warning when the user defines _WIN32_WINNT themself.

Since this code is unnecessary and is causing problems, just remove it.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 lib/uuid/Android.bp  | 2 --
 lib/uuid/gen_uuid.c  | 5 -----
 lib/uuid/tst_uuid.c  | 6 ------
 lib/uuid/uuid_time.c | 6 ------
 4 files changed, 19 deletions(-)

Comments

Theodore Ts'o Jan. 30, 2023, 5:09 a.m. UTC | #1
On Sat, Jan 28, 2023 at 02:46:51PM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> Some .c files in lib/uuid/ contain the following:
> 
> 	#ifdef _WIN32
> 	#define _WIN32_WINNT 0x0500
> 	#include <windows.h>
> 	#define UUID MYUUID
> 	#endif
> 
> This seems to have been intended to allow the use of a local "UUID" type
> without colliding with "UUID" in the Windows API.  However, this is
> unnecessary because there's no local "UUID" type -- there's only uuid_t.
> 
> None of these .c files need the include of windows.h, either.
> 
> Finally, the unconditional definition of _WIN32_WINNT causes a compiler
> warning when the user defines _WIN32_WINNT themself.
> 
> Since this code is unnecessary and is causing problems, just remove it.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Thanks, applied to the maint branch.

					- Ted
diff mbox series

Patch

diff --git a/lib/uuid/Android.bp b/lib/uuid/Android.bp
index 67968dba3..daf30bb94 100644
--- a/lib/uuid/Android.bp
+++ b/lib/uuid/Android.bp
@@ -45,8 +45,6 @@  cc_library {
     ],
     target: {
         windows: {
-            // Cannot suppress the _WIN32_WINNT redefined warning.
-            cflags: ["-Wno-error"],
             include_dirs: [ "external/e2fsprogs/include/mingw" ],
             enabled: true
         },
diff --git a/lib/uuid/gen_uuid.c b/lib/uuid/gen_uuid.c
index a2225ccee..2f028867a 100644
--- a/lib/uuid/gen_uuid.c
+++ b/lib/uuid/gen_uuid.c
@@ -41,11 +41,6 @@ 
 
 #include "config.h"
 
-#ifdef _WIN32
-#define _WIN32_WINNT 0x0500
-#include <windows.h>
-#define UUID MYUUID
-#endif
 #include <stdio.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
diff --git a/lib/uuid/tst_uuid.c b/lib/uuid/tst_uuid.c
index 649bfbc05..c1c290158 100644
--- a/lib/uuid/tst_uuid.c
+++ b/lib/uuid/tst_uuid.c
@@ -34,12 +34,6 @@ 
 
 #include "config.h"
 
-#ifdef _WIN32
-#define _WIN32_WINNT 0x0500
-#include <windows.h>
-#define UUID MYUUID
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 
diff --git a/lib/uuid/uuid_time.c b/lib/uuid/uuid_time.c
index af837a2ca..b519d3c4b 100644
--- a/lib/uuid/uuid_time.c
+++ b/lib/uuid/uuid_time.c
@@ -36,12 +36,6 @@ 
 
 #include "config.h"
 
-#ifdef _WIN32
-#define _WIN32_WINNT 0x0500
-#include <windows.h>
-#define UUID MYUUID
-#endif
-
 #include <stdio.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>