Re: Convert *GetDatum() and DatumGet*() macros to inline functions - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: Convert *GetDatum() and DatumGet*() macros to inline functions
Date
Msg-id CAJ7c6TO+m5BXoU_5Z1Ud6YHXDAg3dAjWWEDVurJLamvyf5XFxA@mail.gmail.com
Whole thread Raw
In response to Re: Convert *GetDatum() and DatumGet*() macros to inline functions  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Responses Re: Convert *GetDatum() and DatumGet*() macros to inline functions
List pgsql-hackers
Hi Peter,

> Which compiler is that, by the way?

The warnings were reported by cfbot during the "clang_warning" step.
According to the logs:

```
using compiler=Debian clang version 11.0.1-2
```

Personally I use Clang 14 on MacOS and I don't get these warnings.

> I think to resolve that we could either
>
> 1. Not define PointerGetDatum() with a const argument, and just sprinkle
> in a few unconstify calls where necessary.
>
> 2. Maybe add a NonconstPointerGetDatum() for those few cases where
> pointer arguments are used for return values.
>
> 3. Go with your patch and just fix up the warnings about uninitialized
> variables.  But that seems the least principled to me.

IMO the 3rd option is the lesser evil. Initializing four bools/ints in
order to make Clang 11 happy doesn't strike me as such a big deal. At
least until somebody reports a bottleneck for this particular reason.
We can optimize the code when and if this will happen.

-- 
Best regards,
Aleksander Alekseev



pgsql-hackers by date:

Previous
From: Ajin Cherian
Date:
Subject: Re: Support logical replication of DDLs
Next
From: Nikita Malakhov
Date:
Subject: Re: Table AM modifications to accept column projection lists