Re: Broken ./configure checks for __cpuid() and __cpuidex()
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-07-29T03:07:01Z
Lists: pgsql-hackers
On Tue, Jul 29, 2025 at 11:36:35AM +0900, Michael Paquier wrote:
> On Tue, Jul 29, 2025 at 11:21:41AM +0900, Michael Paquier wrote:
> > The attached warrants a backpatch to me, thoughts?
>
> That's of course better with the patch.
So, the CI has accepted to run, and compilation fails with this
failure when attempting to use MinGW:
https://cirrus-ci.com/task/6401865375547392
[02:48:32.488] In file included from
/usr/share/mingw-w64/include/intrin.h:41,
[02:48:32.488] from pg_crc32c_sse42_choose.c:28:
[02:48:32.488]
/usr/share/mingw-w64/include/psdk_inc/intrin-impl.h:2013:42: error:
macro "__cpuid" requires 5 arguments, but only 2 given
[02:48:32.488] 2013 | void __cpuid(int CPUInfo[4], int InfoType);
[02:48:32.488] | ^
[02:48:32.489]In file included from pg_crc32c_sse42_choose.c:24:
[02:48:32.489]
/usr/lib/gcc/x86_64-w64-mingw32/12-win32/include/cpuid.h:223: note:
macro "__cpuid" defined here
[02:48:32.489] 223 | #define __cpuid(level, a, b, c, d) \
[02:48:32.489] |
[02:48:32.489]
/usr/share/mingw-w64/include/psdk_inc/intrin-impl.h:2016:42: error:
macro "__cpuid" requires 5 arguments, but only 2 given [02:48:32.489]
2016 | void __cpuid(int CPUInfo[4], int InfoType) {
[02:48:32.489] | ^
[02:48:32.489]
/usr/lib/gcc/x86_64-w64-mingw32/12-win32/include/cpuid.h:223: note:
macro "__cpuid" defined here
[02:48:32.489] 223 | #define __cpuid(level, a, b, c, d) \
[02:48:32.489] |
[02:48:32.489]
/usr/share/mingw-w64/include/psdk_inc/intrin-impl.h:2016:44: error:
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
[02:48:32.489] 2016 | void __cpuid(int CPUInfo[4], int InfoType) {
[02:48:32.489] |
How isn't that a bug in MinGW itself? I'm puzzled my the macro
definition of __cpuid() that reports a conflict. __cpuidex() and
__cpuid() are both detected by ./configure, the PG use of __cpuid() in
pg_crc32c_sse42_choose.c causes a failure.
Thoughts and comments are welcome.
--
Michael
Commits
-
Fix ./configure checks with __cpuidex() and __cpuid()
- 612f5b80620d 13.22 landed
- 60953d4cba7c 14.19 landed
- d6ffc43f95b2 15.14 landed
- c1984be23cdc 16.10 landed
- 8de56323c139 17.6 landed
- cd2d52cc6b39 18.0 landed
- 1a5212775e46 19 (unreleased) landed