pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Aleksander Alekseev <a.alekseev@postgrespro.ru>
To: Noah Misch <noah@leadboat.com>
Cc: David Steele <david@pgmasters.net>
Cc: PostgreSQL Developers <pgsql-hackers@postgresql.org>
Subject: Re: [PATCH] Suppress Clang 3.9 warnings
Date: Wed, 15 Mar 2017 12:04:11 +0300
Message-ID: <20170315090410.GA25568@e733.localdomain> (raw)
In-Reply-To: <20170315022538.GA1723554@tornado.leadboat.com>
References: <20170220141239.GD12278@e733.localdomain>
	<alpine.DEB.2.20.1702221532100.22403@lancre>
	<dc2a33c7-a498-c277-592e-30a9ad8c7926@pgmasters.net>
	<20170313153553.GB2564@e733.localdomain>
	<20170315022538.GA1723554@tornado.leadboat.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Hi Hoah.

Thanks a lot for a reply!

> This is wrong on platforms that do have strlcpy() in libc.

If it no too much trouble could you please explain what will happen
on such platforms? On what platform did you check it? I'm sure it
fixable. And I got a strong feeling that "wrong" could be a bit exaggerated.

> If I recall correctly, you can suppress the warnings in your own build by
> adding "ac_cv_func_strlcpy=no ac_cv_have_decl_strlcpy=no ac_cv_func_strlcat=no
> ac_cv_have_decl_strlcat=no" to the "configure" command line.

It's not exactly what I would call a solution. For instance on FreeBSD
Clang is a default compiler and many users build a software from source
code (FreeBSD ports). For some reason I doubt that many of them know
about these flags.

On Wed, Mar 15, 2017 at 02:25:38AM +0000, Noah Misch wrote:
> On Mon, Mar 13, 2017 at 06:35:53PM +0300, Aleksander Alekseev wrote:
> > --- a/src/include/port.h
> > +++ b/src/include/port.h
> > @@ -395,11 +395,22 @@ extern double rint(double x);
> >  extern int	inet_aton(const char *cp, struct in_addr * addr);
> >  #endif
> >  
> > -#if !HAVE_DECL_STRLCAT
> > +/*
> > + * Unfortunately in case of strlcat and strlcpy we can't trust tests
> > + * executed by Autotools if Clang > 3.6 is used. Clang manages to compile
> > + * a program that shouldn't compile which causes wrong values of
> > + * HAVE_DECL_STRLCAT and HAVE_DECL_STRLCPY. More details could be found here:
> > + *
> > + * http://lists.llvm.org/pipermail/cfe-dev/2016-March/048126.html
> > + *
> > + * This is no doubt a dirty hack but apparently alternative solutions are
> > + * not much better.
> > + */
> > +#if !HAVE_DECL_STRLCAT || defined(__clang__)
> >  extern size_t strlcat(char *dst, const char *src, size_t siz);
> >  #endif
> >  
> > -#if !HAVE_DECL_STRLCPY
> > +#if !HAVE_DECL_STRLCPY || defined(__clang__)
> >  extern size_t strlcpy(char *dst, const char *src, size_t siz);
> >  #endif
> 
> This is wrong on platforms that do have strlcpy() in libc.
> 
> If I recall correctly, you can suppress the warnings in your own build by
> adding "ac_cv_func_strlcpy=no ac_cv_have_decl_strlcpy=no ac_cv_func_strlcat=no
> ac_cv_have_decl_strlcat=no" to the "configure" command line.

-- 
Best regards,
Aleksander Alekseev

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (18+ messages)  latest in thread

Message-ID: <20170315090410.GA25568@e733.localdomain>
Permalink:  ../20170315090410.GA25568@e733.localdomain/
Also on:    postgresql.org/message-id/20170315090410.GA25568@e733.localdomain

 · 

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-hackers@postgresql.org
  Cc: a.alekseev@postgrespro.ru, noah@leadboat.com, david@pgmasters.net
  Subject: Re: [PATCH] Suppress Clang 3.9 warnings
  In-Reply-To: <20170315090410.GA25568@e733.localdomain>
  References: <20170220141239.GD12278@e733.localdomain> <alpine.DEB.2.20.1702221532100.22403@lancre> <dc2a33c7-a498-c277-592e-30a9ad8c7926@pgmasters.net> <20170313153553.GB2564@e733.localdomain> <20170315022538.GA1723554@tornado.leadboat.com> <20170315090410.GA25568@e733.localdomain>

* 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