Обсуждение: Re: [COMMITTERS] pgsql: Fix integer-overflow problems in intervalcomparison.

Поиск
Список
Период
Сортировка

Re: [COMMITTERS] pgsql: Fix integer-overflow problems in intervalcomparison.

От
Peter Eisentraut
Дата:
On 4/5/17 23:51, Tom Lane wrote:
> Fix integer-overflow problems in interval comparison.

> Branch
> ------
> REL9_4_STABLE
>
> Details
> -------
> http://git.postgresql.org/pg/commitdiff/8851bcf8813baa0ea393ef9d2894d15b3f13f957
>
> Modified Files
> --------------
> src/backend/utils/adt/timestamp.c      |  65 ++++++++--
> src/include/common/int128.h            | 231 +++++++++++++++++++++++++++++++++
> src/test/regress/expected/interval.out |  64 +++++++++
> src/test/regress/sql/interval.sql      |  27 ++++
> 4 files changed, 376 insertions(+), 11 deletions(-)

This is failing cpluspluscheck now because C++ does not have
_Static_assert, which is used in int128.h.

I suppose this header is not intended for public consumption, at least
in the back branches, so it would be OK to exclude it from the check.
Perhaps a different solution would be appropriate in master.

--
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Re: [COMMITTERS] pgsql: Fix integer-overflow problems in interval comparison.

От
Tom Lane
Дата:
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> On 4/5/17 23:51, Tom Lane wrote:
>> Fix integer-overflow problems in interval comparison.

> This is failing cpluspluscheck now because C++ does not have
> _Static_assert, which is used in int128.h.

Hmm.  We could drop that assert, or move it to some .c file, or
wrap it in "#ifndef __cplusplus" ... but really it seems like a
more generic solution would be appropriate.  This won't be the
last time somebody tries to do that, what with our increasing
use of inline functions.

Maybe the definition of StaticAssertStmt should be tweaked based on
__cplusplus?  Or maybe the problem is cpluspluscheck's test methodology,
ie you ought to run configure with CC=c++ before trying to compile the
headers?

            regards, tom lane


Re: [COMMITTERS] pgsql: Fix integer-overflow problems in intervalcomparison.

От
Andres Freund
Дата:
On 2017-04-17 13:04:31 -0400, Tom Lane wrote:
> Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> > On 4/5/17 23:51, Tom Lane wrote:
> >> Fix integer-overflow problems in interval comparison.
>
> > This is failing cpluspluscheck now because C++ does not have
> > _Static_assert, which is used in int128.h.
>
> Hmm.  We could drop that assert, or move it to some .c file, or
> wrap it in "#ifndef __cplusplus" ... but really it seems like a
> more generic solution would be appropriate.  This won't be the
> last time somebody tries to do that, what with our increasing
> use of inline functions.
>
> Maybe the definition of StaticAssertStmt should be tweaked based on
> __cplusplus?

That seems reasonable, possibly with a cplusplus version check and then
using static_assert()? Although I'd personally just mention that as a
todo for later.


> Or maybe the problem is cpluspluscheck's test methodology,
> ie you ought to run configure with CC=c++ before trying to compile the
> headers?

That seems unlikely to work well for the moment...

- Andres