Remove WIN32 conditional compilation from win32common.c

Started by Tristan Partinabout 2 years ago2 messages
#1Tristan Partin
tristan@neon.tech
1 attachment(s)

The file is only referenced in Meson and MSVC scripts from what I can
tell, and the Meson reference is protected by a Windows check.

--
Tristan Partin
Neon (https://neon.tech)

Attachments:

v1-0001-Remove-WIN32-conditional-compilation-from-win32co.patchtext/x-patch; charset=utf-8; name=v1-0001-Remove-WIN32-conditional-compilation-from-win32co.patchDownload
From bc9ffc7b0b141959a4c2a3f8b731f457ff5825c1 Mon Sep 17 00:00:00 2001
From: Tristan Partin <tristan@neon.tech>
Date: Tue, 5 Dec 2023 10:18:37 -0600
Subject: [PATCH v1] Remove WIN32 conditional compilation from win32common.c

This file is only compiled when WIN32 is defined, so the #ifdef was
not needed.
---
 src/port/win32common.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/src/port/win32common.c b/src/port/win32common.c
index 2fd78f7f93..a075d01209 100644
--- a/src/port/win32common.c
+++ b/src/port/win32common.c
@@ -19,8 +19,6 @@
 #include "postgres.h"
 #endif
 
-#ifdef WIN32
-
 /*
  * pgwin32_get_file_type
  *
@@ -64,5 +62,3 @@ pgwin32_get_file_type(HANDLE hFile)
 
 	return fileType;
 }
-
-#endif							/* WIN32 */
-- 
Tristan Partin
Neon (https://neon.tech)

#2Heikki Linnakangas
hlinnaka@iki.fi
In reply to: Tristan Partin (#1)
Re: Remove WIN32 conditional compilation from win32common.c

On 05/12/2023 20:37, Tristan Partin wrote:

The file is only referenced in Meson and MSVC scripts from what I can
tell, and the Meson reference is protected by a Windows check.

There are a bunch of files like win32common.c:

$ ls src/port/win32*.c
src/port/win32common.c
src/port/win32dlopen.c
src/port/win32env.c
src/port/win32error.c
src/port/win32fdatasync.c
src/port/win32fseek.c
src/port/win32gai_strerror.c
src/port/win32getrusage.c
src/port/win32gettimeofday.c
src/port/win32link.c
src/port/win32ntdll.c
src/port/win32pread.c
src/port/win32pwrite.c
src/port/win32security.c
src/port/win32setlocale.c
src/port/win32stat.c

Of these, win32stat.c and win32fseek.c also contain "#ifdef WIN32", but
others don't. So I concur that the most common pattern in these files is
to not use #ifdef WIN32, and +1 for making them consistent.

I removed those from win32stat.c and win32fseek.c, too, and committed.
Thanks!

--
Heikki Linnakangas
Neon (https://neon.tech)