meson: Fix missing name arguments of cc.compiles() calls
I noticed a few cc.compiles() checks in meson.build don't show up in the
"meson setup" output, because they don't have a "name" argument. Also,
the "typeof" test doesn't show the name of the symbol that is currently
being tested. All this makes remote debugging a bit harder. This patch
fixes it.
While analyzing the fixed output, I also noticed that the test for
decltype as an alternative to typeof never actually worked and was just
forgotten to be removed. This is also fixed here.
Attachments:
0001-meson-Fix-missing-name-arguments-of-cc.compiles-call.patchtext/plain; charset=UTF-8; name=0001-meson-Fix-missing-name-arguments-of-cc.compiles-call.patchDownload
From c43a418850e6d5c23eb6fb1ed83935e688c1d261 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Sun, 29 Dec 2024 13:43:38 +0100
Subject: [PATCH 1/2] meson: Fix missing name arguments of cc.compiles() calls
Without it, the check won't show up in the meson setup/configure
output.
---
meson.build | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index e5ce437a5c7..cb642b1f2fb 100644
--- a/meson.build
+++ b/meson.build
@@ -1727,6 +1727,7 @@ if cc.compiles('''
my_label:
return 1;
}''',
+ name: 'computed goto',
args: test_c_args)
cdata.set('HAVE_COMPUTED_GOTO', 1)
endif
@@ -1743,6 +1744,7 @@ if cc.compiles('''
({ _Static_assert(1, "foo"); });
}
''',
+ name: '_Static_assert',
args: test_c_args)
cdata.set('HAVE__STATIC_ASSERT', 1)
endif
@@ -2359,6 +2361,7 @@ elif host_cpu == 'ppc' or host_cpu == 'ppc64'
}
int test_adds(int x) { return addi(3, x) + addi(x, 5); }
''',
+ name: '@0@: "i"(x) when __builtin_constant_p(x)'.format(host_cpu),
args: test_c_args)
cdata.set('HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P', 1)
endif
@@ -2547,7 +2550,7 @@ int main(void)
return y;
}
'''.format(kw),
- name: 'typeof()',
+ name: kw,
args: test_c_args, include_directories: postgres_inc)
cdata.set('HAVE_TYPEOF', 1)
base-commit: d85ce012f99f63249bb45a78fcecb7a2383920b1
--
2.47.1
0002-Remove-useless-configure-check.patchtext/plain; charset=UTF-8; name=0002-Remove-useless-configure-check.patchDownload
From a1eb3feba6ebb687cf19a14156f5debf536fbccb Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Sun, 29 Dec 2024 14:40:04 +0100
Subject: [PATCH 2/2] Remove useless configure check
The test for "decltype" as variant of "typeof" apparently never worked
(see commit 3582b223d49), so remove it.
---
config/c-compiler.m4 | 2 +-
configure | 2 +-
meson.build | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/config/c-compiler.m4 b/config/c-compiler.m4
index e112fd45d48..8534cc54c13 100644
--- a/config/c-compiler.m4
+++ b/config/c-compiler.m4
@@ -142,7 +142,7 @@ fi])# PGAC_C_STATIC_ASSERT
AC_DEFUN([PGAC_C_TYPEOF],
[AC_CACHE_CHECK(for typeof, pgac_cv_c_typeof,
[pgac_cv_c_typeof=no
-for pgac_kw in typeof __typeof__ decltype; do
+for pgac_kw in typeof __typeof__; do
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[int x = 0;
$pgac_kw(x) y;
diff --git a/configure b/configure
index 518c33b73a9..cfe62e80ba8 100755
--- a/configure
+++ b/configure
@@ -14344,7 +14344,7 @@ if ${pgac_cv_c_typeof+:} false; then :
$as_echo_n "(cached) " >&6
else
pgac_cv_c_typeof=no
-for pgac_kw in typeof __typeof__ decltype; do
+for pgac_kw in typeof __typeof__; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
diff --git a/meson.build b/meson.build
index cb642b1f2fb..045ce800667 100644
--- a/meson.build
+++ b/meson.build
@@ -2540,7 +2540,7 @@ endif
# Check if the C compiler understands typeof or a variant. Define
# HAVE_TYPEOF if so, and define 'typeof' to the actual key word.
-foreach kw : ['typeof', '__typeof__', 'decltype']
+foreach kw : ['typeof', '__typeof__']
if cc.compiles('''
int main(void)
{
--
2.47.1
On 29.12.24 15:13, Peter Eisentraut wrote:
I noticed a few cc.compiles() checks in meson.build don't show up in the
"meson setup" output, because they don't have a "name" argument. Also,
the "typeof" test doesn't show the name of the symbol that is currently
being tested. All this makes remote debugging a bit harder. This patch
fixes it.While analyzing the fixed output, I also noticed that the test for
decltype as an alternative to typeof never actually worked and was just
forgotten to be removed. This is also fixed here.
committed