Re: Fix compiler warnings on 64-bit Windows

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix compiler warnings on 64-bit Windows
Date: 2020-02-13 15:19:50
Message-ID: 23439.1581607190@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2020-02-13 15:35:01 Re: LOCK TABLE and DROP TABLE on temp tables of other sessions
Previous Message Pavel Stehule 2020-02-13 15:16:46 Re: Optimize update of tables with generated columns