Re: Centralised architecture detection

Greg Burd <greg@burd.me>

From: "Greg Burd" <greg@burd.me>
To: "Tom Lane" <tgl@sss.pgh.pa.us>
Cc: "Thomas Munro" <thomas.munro@gmail.com>, Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>, "PostgreSQL Hackers" <pgsql-hackers@lists.postgresql.org>, "Andres Freund" <andres@anarazel.de>, "Lukas Fittl" <lukas@fittl.com>, "John Naylor" <johncnaylorls@gmail.com>, "Bryan Green" <dbryan.green@gmail.com>
Date: 2026-07-01T11:39:40Z
Lists: pgsql-hackers

Attachments

On Tue, Jun 30, 2026, at 5:31 PM, Tom Lane wrote:
> I wrote:
>> Pushed.  I shall now watch the buildfarm from a safe distance.
>
> Sure enough, greenfly is not happy:

That's a good thing, and the reason it exists. :)

> ccache /scratch/opt/llvm-22/bin/clang -Isrc/port/libpgport_srv.a.p 
> -Isrc/include -I../pgsql/src/include -fdiagnostics-color=always 
> -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O2 -g -fno-strict-aliasing 
> -fwrapv -fexcess-precision=standard -D_GNU_SOURCE -Wpointer-arith 
> -Werror=vla -Werror=unguarded-availability-new 
> -Wmissing-format-attribute -Wcast-function-type -Wformat-security 
> -Wmissing-prototypes -Wold-style-definition -Wstrict-prototypes 
> -Wimplicit-fallthrough -Wdeclaration-after-statement 
> -Wmissing-variable-declarations -Wno-unused-command-line-argument 
> -Wno-compound-token-split-by-macro -Wno-format-truncation 
> -Wno-cast-function-type-strict -march=rv64gcv -fPIC -DBUILDING_DLL -MD 
> -MQ src/port/libpgport_srv.a.p/bsearch_arg.c.o -MF 
> src/port/libpgport_srv.a.p/bsearch_arg.c.o.d -o 
> src/port/libpgport_srv.a.p/bsearch_arg.c.o -c 
> ../pgsql/src/port/bsearch_arg.c
> In file included from ../pgsql/src/port/bsearch_arg.c:36:
> ../pgsql/src/include/c.h:162:2: error: "cannot identify target 
> architecture"
>   162 | #error "cannot identify target architecture"
>       |  ^
> 1 error generated.
>
> So I was wrong to guess that every riscv64 platform predefines
> __riscv64__.  Greg, could you check what predefined architecture
> symbols that compiler does supply?  I'm tempted to blindly guess
> that __riscv64 will work, but I'd rather not guess.
>
> To save you having to look it up, something like this should
> do the trick:
>
> clang -dM -E - </dev/null | sort >clang-predefined-macros

Attached, happy to help out.

> 			regards, tom lane

best.

-greg

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix CPU-identification macros for RISC-V.

  2. Clean up inconsistencies in CPU-identification macros.