Re: [PATCH] Suppress Clang 3.9 warnings

From: Noah Misch <noah(at)leadboat(dot)com>
To: Aleksander Alekseev <a(dot)alekseev(at)postgrespro(dot)ru>
Cc: David Steele <david(at)pgmasters(dot)net>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Suppress Clang 3.9 warnings
Date: 2017-03-15 02:25:38
Message-ID: 20170315022538.GA1723554@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2017-03-15 02:30:19 Re: Write Ahead Logging for Hash Indexes
Previous Message Amit Kapila 2017-03-15 02:22:15 Remove obsolete text from hash/README