Re: Centralised architecture detection

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Nico Williams <nico(at)cryptonector(dot)com>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Lukas Fittl <lukas(at)fittl(dot)com>, John Naylor <johncnaylorls(at)gmail(dot)com>, Bryan Green <dbryan(dot)green(at)gmail(dot)com>
Subject: Re: Centralised architecture detection
Date: 2026-06-03 21:27:22
Message-ID: 3130017.1780522042@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Nico Williams <nico(at)cryptonector(dot)com> writes:
> On Wed, Jun 03, 2026 at 05:08:55PM -0400, Tom Lane wrote:
>> Concretely, I'm imagining that we'd do more or less the attached in
>> c.h, and then the rest of the work would just be to remove the
>> not-very-large number of references to the alternative CPU symbols.

> Can a pre-processor make it an error for users to define __ macros?

I don't believe so. We have done similar things elsewhere, eg
before 25f36066d we had this in solaris.h:

/*
* Sort this out for all operating systems some time. The __xxx
* symbols are defined on both GCC and Solaris CC, although GCC
* doesn't document them. The __xxx__ symbols are only on GCC.
*/
#if defined(__i386) && !defined(__i386__)
#define __i386__
#endif

#if defined(__amd64) && !defined(__amd64__)
#define __amd64__
#endif

#if defined(__x86_64) && !defined(__x86_64__)
#define __x86_64__
#endif

#if defined(__sparc) && !defined(__sparc__)
#define __sparc__
#endif

Of course that only proves that Sun Studio didn't complain.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2026-06-03 21:36:34 Re: future of PQfn()
Previous Message Andrew Dunstan 2026-06-03 21:23:30 Re: BackgroundPsql swallowing errors on windows