Residual cpluspluscheck issues

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Residual cpluspluscheck issues
Date: 2019-06-02 16:53:14
Message-ID: 20518.1559494394@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

cpluspluscheck's expanded coverage is now passing cleanly for me on
the macOS laptop I was testing it with at PGCon. But on returning
home, I find there's still some issues on some other boxes:

* On Linux (at least Fedora and RHEL), I get variants of this:

/usr/include/arpa/inet.h:84: error: declaration of 'char* inet_net_ntop(int, const void*, int, char*, size_t) throw ()' throws different exceptions
/home/postgres/pgsql/src/include/port.h:506: error: from previous declaration 'char* inet_net_ntop(int, const void*, int, char*, size_t)'

That's because /usr/include/arpa/inet.h declares it as

extern char *inet_net_ntop (int __af, const void *__cp, int __bits,
char *__buf, size_t __len) __THROW;

and of course when a C++ compiler reads that, __THROW will expand as
something nonempty.

One possible fix for that is to teach configure to test whether
arpa/inet.h provides a declaration, and not compile our own declaration
when it does. This would require being sure that we include arpa/inet.h
anywhere we use that function, but there are few enough callers that
that's not much of a hardship.

Alternatively, we could rename our function to pg_inet_net_ntop to
dodge the conflict. This might be a good idea anyway to avoid
confusion, since our function doesn't necessarily recognize the same
address-family codes that libc would.

* On FreeBSD 12, I get

/home/tgl/pgsql/src/include/utils/hashutils.h:23:23: warning: 'register' storage
class specifier is deprecated and incompatible with C++17
[-Wdeprecated-register]
extern Datum hash_any(register const unsigned char *k, register int keylen);
^~~~~~~~~
/home/tgl/pgsql/src/include/utils/hashutils.h:23:56: warning: 'register' storage
class specifier is deprecated and incompatible with C++17
[-Wdeprecated-register]
extern Datum hash_any(register const unsigned char *k, register int keylen);
^~~~~~~~~
/home/tgl/pgsql/src/include/utils/hashutils.h:24:32: warning: 'register' storage
class specifier is deprecated and incompatible with C++17
[-Wdeprecated-register]
extern Datum hash_any_extended(register const unsigned char *k,
^~~~~~~~~
/home/tgl/pgsql/src/include/utils/hashutils.h:25:11: warning: 'register' storage
class specifier is deprecated and incompatible with C++17
[-Wdeprecated-register]
register int ...
^~~~~~~~~

which I'm inclined to think means we should drop those register keywords.

(The FreeBSD box shows another couple of complaints too, but I think
the fixes for those are uncontroversial.)

Comments?

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2019-06-02 18:37:24 unused_oids script should advertise reserved OID range
Previous Message Binguo Bao 2019-06-02 14:48:34 Optimize partial TOAST decompression