Re: Fix most -Wundef warnings

Mark Dilger <hornschnorter@gmail.com>

From: Mark Dilger <hornschnorter@gmail.com>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, pgsql-hackers@postgresql.org
Date: 2019-10-14T15:12:29Z
Lists: pgsql-hackers

On 10/13/19 12:25 PM, Peter Eisentraut wrote:
> diff --git a/contrib/hstore/hstore_compat.c b/contrib/hstore/hstore_compat.c
> index 1d4e7484e4..d75e9cb23f 100644
> --- a/contrib/hstore/hstore_compat.c
> +++ b/contrib/hstore/hstore_compat.c
> @@ -299,7 +299,7 @@ hstoreUpgrade(Datum orig)
>   
>   	if (valid_new)
>   	{
> -#if HSTORE_IS_HSTORE_NEW
> +#ifdef HSTORE_IS_HSTORE_NEW
>   		elog(WARNING, "ambiguous hstore value resolved as hstore-new");

Checking the current sources, git history, and various older commits, I 
did not find where HSTORE_IS_HSTORE_NEW was ever defined.  I expect it 
was defined at some point, but I checked back as far as 9.0 (where the 
current contrib/hstore was originally committed) and did not see it. 
Where did you find this, and can we add a code comment?  This one #ifdef 
is the only line in the entire repository where this label is used, 
making it hard to check if changing from #if was the right decision.

The check on HSTORE_IS_HSTORE_NEW goes back at least as far as 2006, 
suggesting it was needed for migrating from some version pre-9.0, making 
me wonder if anybody would need this in the field.  Should we drop 
support for this?  I don't have a strong reason to advocate dropping 
support other than that this #define appears to be undocumented.

mark



Commits

  1. Fix most -Wundef warnings

  2. Remove some code for old unsupported versions of MSVC