Re: Centralised architecture detection - Mailing list pgsql-hackers

From Dagfinn Ilmari Mannsåker
Subject Re: Centralised architecture detection
Date
Msg-id 87pl482zr1.fsf@wibble.ilmari.org
Whole thread Raw
In response to Centralised architecture detection  (Thomas Munro <thomas.munro@gmail.com>)
List pgsql-hackers
Thomas Munro <thomas.munro@gmail.com> writes:

> Instead of repeating compilers' architecture macros throughout the tree
> and sometimes getting it wrong, let's detect them in one central place,
> and define our own macros of the form:
>
>   PG_ARCH_{ARM,LOONGARCH,MIPS,PPC,RISCV,S390,SPARC,X86}
>   PG_ARCH_{ARM,LOONGARCH,MIPS,PPC,RISCV,S390,SPARC,X86}_{32,64}
[...]
> diff --git a/contrib/pgcrypto/crypt-blowfish.c b/contrib/pgcrypto/crypt-blowfish.c
> index 5a1b1e10091..9c4e02e428b 100644
> --- a/contrib/pgcrypto/crypt-blowfish.c
> +++ b/contrib/pgcrypto/crypt-blowfish.c
> @@ -38,10 +38,10 @@
>  #include "px-crypt.h"
>  #include "px.h"
>  
> -#ifdef __i386__
> +#if defined(PG_ARCH_X86_32)
>  #define BF_ASM                0    /* 1 */
>  #define BF_SCALE            1
> -#elif defined(__x86_64__)
> +#elif defined(PG_ARCH_X86_64)
>  #define BF_ASM                0
>  #define BF_SCALE            1
>  #else

These could be combined into a single #ifdef PG_ARCH_X86.  Also, BF_ASM
has never been defined to anything but 0 since this file was added in
2001, and the _BF_body_r function it would call in that case has never
existed, so we could get rid of it (but that would be for a separate
patch).

- ilmari



pgsql-hackers by date:

Previous
From: Chao Li
Date:
Subject: Re: Eliminating SPI / SQL from some RI triggers - take 3
Next
From: Peter Eisentraut
Date:
Subject: Re: [[deprecated("don't call this, call that")]]