Subject: [PATCH v1 1/3] Don't define FRONTEND for initdb

From: Andres Freund <[email-masked]>
Date: Sat, 20 Aug 2022 12:13:42 -0700

No headers requiring FRONTED to be defined are included as of af1a949109d.

Since this is the last user of (frontend|contrib)_defines in Mkvcbuild.pm,
remove that. For commit the file should be perltidy'ed, but as that causes
more changes I thought it'd be easer like this for review.
---
 src/bin/initdb/Makefile     |  2 +-
 src/tools/msvc/Mkvcbuild.pm | 14 ++------------
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/src/bin/initdb/Makefile b/src/bin/initdb/Makefile
index b0dd13dfbdf..6737938c3f8 100644
--- a/src/bin/initdb/Makefile
+++ b/src/bin/initdb/Makefile
@@ -16,7 +16,7 @@ subdir = src/bin/initdb
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
-override CPPFLAGS := -DFRONTEND -I$(libpq_srcdir) -I$(top_srcdir)/src/timezone $(CPPFLAGS)
+override CPPFLAGS := -I$(libpq_srcdir) -I$(top_srcdir)/src/timezone $(CPPFLAGS)
 
 # Note: it's important that we link to encnames.o from libpgcommon, not
 # from libpq, else we have risks of version skew if we run with a libpq
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index ee963d85f30..ac863418442 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -35,7 +35,6 @@ my $libpq;
 my @unlink_on_exit;
 
 # Set of variables for modules in contrib/ and src/test/modules/
-my $contrib_defines        = {};
 my @contrib_uselibpq       = ();
 my @contrib_uselibpgport   = ();
 my @contrib_uselibpgcommon = ();
@@ -53,7 +52,6 @@ my @contrib_excludes       = (
 	'unsafe_tests');
 
 # Set of variables for frontend modules
-my $frontend_defines = { 'initdb' => 'FRONTEND' };
 my @frontend_uselibpq =
   ('pg_amcheck', 'pg_ctl', 'pg_upgrade', 'pgbench', 'psql', 'initdb');
 my @frontend_uselibpgport = (
@@ -1126,7 +1124,7 @@ sub AdjustContribProj
 {
 	my $proj = shift;
 	AdjustModule(
-		$proj,                    $contrib_defines,
+		$proj,
 		\@contrib_uselibpq,       \@contrib_uselibpgport,
 		\@contrib_uselibpgcommon, $contrib_extralibs,
 		$contrib_extrasource,     $contrib_extraincludes);
@@ -1137,7 +1135,7 @@ sub AdjustFrontendProj
 {
 	my $proj = shift;
 	AdjustModule(
-		$proj,                     $frontend_defines,
+		$proj,
 		\@frontend_uselibpq,       \@frontend_uselibpgport,
 		\@frontend_uselibpgcommon, $frontend_extralibs,
 		$frontend_extrasource,     $frontend_extraincludes);
@@ -1147,7 +1145,6 @@ sub AdjustFrontendProj
 sub AdjustModule
 {
 	my $proj                  = shift;
-	my $module_defines        = shift;
 	my $module_uselibpq       = shift;
 	my $module_uselibpgport   = shift;
 	my $module_uselibpgcommon = shift;
@@ -1156,13 +1153,6 @@ sub AdjustModule
 	my $module_extraincludes  = shift;
 	my $n                     = $proj->{name};
 
-	if ($module_defines->{$n})
-	{
-		foreach my $d ($module_defines->{$n})
-		{
-			$proj->AddDefine($d);
-		}
-	}
 	if (grep { /^$n$/ } @{$module_uselibpq})
 	{
 		$proj->AddIncludeDir('src\interfaces\libpq');
-- 
2.37.0.3.g30cc8d0f14

--6cdqp334ngfj3pun
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
	filename="v1-0002-Don-t-define-FRONTEND-for-ecpg-libraries.patch"