pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael.paquier@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-committers@postgresql.org
Subject: Re: pgsql: Centralize definition of integer limits.
Date: Mon, 30 Mar 2015 14:01:25 +0900
Message-ID: <CAB7nPqRqce4hd7UXRw08TGaDsDz04DbecNiU3c0O_7S4YrAdaQ@mail.gmail.com> (raw)
In-Reply-To: <E1YatAv-0007cu-KW@gemulon.postgresql.org>
References: <E1YatAv-0007cu-KW@gemulon.postgresql.org>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

On Thu, Mar 26, 2015 at 6:49 AM, Andres Freund <andres@anarazel.de> wrote:
> Centralize definition of integer limits.
>
> Several submitted and even committed patches have run into the problem
> that C89, our baseline, does not provide minimum/maximum values for
> various integer datatypes. C99's stdint.h does, but we can't rely on
> it.
>
> Several parts of the code defined limits locally, so instead centralize
> the definitions to c.h.
>
> This patch also changes the more obvious usages of literal limit values;
> there's more places that could be changed, but it's less clear whether
> it's beneficial to change those.

My OSX dev box is generating a couple of warnings since this commit:
pg_dump.c:14548:45: warning: format specifies type 'long' but the argument
has type 'long long' [-Wformat]
        snprintf(bufm, sizeof(bufm), INT64_FORMAT, SEQ_MINVALUE);
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
../../../src/include/pg_config_manual.h:52:22: note: expanded from macro
'SEQ_MINVALUE'
#define SEQ_MINVALUE    (-SEQ_MAXVALUE)
                        ^
/usr/include/secure/_stdio.h:56:62: note: expanded from macro 'snprintf'
  __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
                                                             ^
pg_dump.c:14549:45: warning: format specifies type 'long' but the argument
has type 'long long' [-Wformat]
        snprintf(bufx, sizeof(bufx), INT64_FORMAT, SEQ_MAXVALUE);
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
../../../src/include/pg_config_manual.h:51:22: note: expanded from macro
'SEQ_MAXVALUE'
#define SEQ_MAXVALUE    INT64_MAX
                        ^~~~~~~~~
/usr/include/stdint.h:122:26: note: expanded from macro 'INT64_MAX'
#define INT64_MAX        9223372036854775807LL
                         ^~~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_stdio.h:56:62: note: expanded from macro 'snprintf'
  __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)

Thoughts?
-- 
Michael

view thread (14+ messages)  latest in thread

Message-ID: <CAB7nPqRqce4hd7UXRw08TGaDsDz04DbecNiU3c0O_7S4YrAdaQ@mail.gmail.com>
Permalink:  ../CAB7nPqRqce4hd7UXRw08TGaDsDz04DbecNiU3c0O_7S4YrAdaQ@mail.gmail.com/
Also on:    postgresql.org/message-id/CAB7nPqRqce4hd7UXRw08TGaDsDz04DbecNiU3c0O_7S4YrAdaQ@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael.paquier@gmail.com, andres@anarazel.de
  Subject: Re: pgsql: Centralize definition of integer limits.
  In-Reply-To: <CAB7nPqRqce4hd7UXRw08TGaDsDz04DbecNiU3c0O_7S4YrAdaQ@mail.gmail.com>
  References: <E1YatAv-0007cu-KW@gemulon.postgresql.org> <CAB7nPqRqce4hd7UXRw08TGaDsDz04DbecNiU3c0O_7S4YrAdaQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox