Re: Refactoring backend fork+exec code

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, reid(dot)thompson(at)crunchydata(dot)com, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Tristan Partin <tristan(at)neon(dot)tech>
Subject: Re: Refactoring backend fork+exec code
Date: 2024-03-20 07:16:13
Message-ID: 273098e3-9cf6-4019-a9e9-fff2f8c4ef28@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 20/03/2024 07:37, Tom Lane wrote:
> A couple of buildfarm animals don't like these tests:
>
> Assert(child_type >= 0 && child_type < lengthof(child_process_kinds));
>
> for example
>
> ayu | 2024-03-19 13:08:05 | launch_backend.c:211:39: warning: comparison of constant 16 with expression of type 'BackendType' (aka 'enum BackendType') is always true [-Wtautological-constant-out-of-range-compare]
> ayu | 2024-03-19 13:08:05 | launch_backend.c:233:39: warning: comparison of constant 16 with expression of type 'BackendType' (aka 'enum BackendType') is always true [-Wtautological-constant-out-of-range-compare]
>
> I'm not real sure why it's moaning about the "<" check but not the
> ">= 0" check, which ought to be equally tautological given the
> assumption that the input is a valid member of the enum. But
> in any case, exactly how much value do these assertions carry?
> If you're intent on keeping them, perhaps casting child_type to
> int here would suppress the warnings. But personally I think
> I'd lose the Asserts.

Yeah, it's not a very valuable assertion. Removed, thanks!

--
Heikki Linnakangas
Neon (https://neon.tech)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2024-03-20 07:16:14 Re: Regression tests fail with musl libc because libpq.so can't be loaded
Previous Message John Naylor 2024-03-20 06:57:54 Re: add AVX2 support to simd.h