Re: Fix compiler warnings on 64-bit Windows - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Fix compiler warnings on 64-bit Windows
Date
Msg-id 23439.1581607190@sss.pgh.pa.us
Whole thread Raw
In response to Fix compiler warnings on 64-bit Windows  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: Fix compiler warnings on 64-bit Windows
List pgsql-hackers
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> GCC reports various instances of
>      warning: cast to pointer from integer of different size 
> [-Wint-to-pointer-cast]
>      warning: cast from pointer to integer of different size 
> [-Wpointer-to-int-cast]
> in ECPG test files.  This is because void* and long are cast back and
> forth, but on 64-bit Windows, these have different sizes.  Fix by
> using intptr_t instead.

Hm.  Silencing the warnings is a laudable goal, but I'm very dubious
of allowing these test files to depend on pg_config.h.  That doesn't
correspond to real-world ECPG usage, so it seems likely that it could
come back to bite us some day.

According to C99 and POSIX, intptr_t should be provided by <stdint.h> ...
now that we're requiring C99, can we get away with just #include'ing
that directly in these test files?

            regards, tom lane



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Optimize update of tables with generated columns
Next
From: Ashutosh Bapat
Date:
Subject: Re: LOCK TABLE and DROP TABLE on temp tables of other sessions