From: Simon Marchi <simon.marchi@ericsson.com>
To: Tom Tromey <tom@tromey.com>, <gdb-patches@sourceware.org>
Subject: Re: [RFA] Make macOS build warning-free
Date: Fri, 29 Jun 2018 21:34:00 -0000 [thread overview]
Message-ID: <ee30b149-6a2b-d7e4-4d2f-28428d266087@ericsson.com> (raw)
In-Reply-To: <20180629165453.22888-1-tom@tromey.com>
On 2018-06-29 12:54 PM, Tom Tromey wrote:
> diff --git a/gdb/warning.m4 b/gdb/warning.m4
> index 632cc214ac0..17afc5455a1 100644
> --- a/gdb/warning.m4
> +++ b/gdb/warning.m4
> @@ -58,6 +58,17 @@ case "${host}" in
> build_warnings="$build_warnings -Wno-unknown-pragmas"
> # Solaris 11 <unistd.h> marks vfork deprecated.
> build_warnings="$build_warnings -Wno-deprecated-declarations" ;;
> + *-*-darwin*)
> + # macOS deprecates syscall (needed by darwin-nat.c) and
> + # sbrk (used only for some maint commands).
> + build_warnings="$build_warnings -Wno-deprecated-declarations"
> + # -Wformat-nonliteral doesn't work properly on macOS -- apparently
> + # it does not interact properly with the format_arg attribute.
> + # (libgnuintl.h disables this attribute for macOS, but re-enabling
> + # it there did not work.)
> + build_warnings="$build_warnings -Wno-format-nonliteral"
> + build_warnings="$build_warnings -Wno-format-security"
> + ;;
> *) build_warnings="$build_warnings -Wformat-nonliteral" ;;
> esac
About the gettext / non-literal warning, this is the patch I carry. I tried
to dig up why gettext doesn't define _INTL_MAY_RETURN_STRING_ARG for __APPLE_CC__
but couldn't find it. My guess is that in a distant past, the Apple compiler
did not know about that attribute. You need another change to get rid of the warning
though. Either:
1. Apply _INTL_MAY_RETURN_STRING_ARG to the gettext function (see patch below)
2. Remove the other __APPLE_CC__ guard that protects the _INTL_REDIRECT_ASM definition.
It will make it so the used gettext declaration will be the one at line 138, which
already has _INTL_MAY_RETURN_STRING_ARG.
Here's the diff I've been carrying for a while:
From c40fdef23fb3c85e94454bb2e3e9559df02cb43c Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@polymtl.ca>
Date: Fri, 29 Jun 2018 17:20:06 -0400
Subject: [PATCH 1/2] Fix gettext warnings
---
intl/libgnuintl.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/intl/libgnuintl.h b/intl/libgnuintl.h
index acc9093a9d..aae7947b84 100644
--- a/intl/libgnuintl.h
+++ b/intl/libgnuintl.h
@@ -115,7 +115,7 @@ extern "C" {
/* _INTL_MAY_RETURN_STRING_ARG(n) declares that the given function may return
its n-th argument literally. This enables GCC to warn for example about
printf (gettext ("foo %y")). */
-#if __GNUC__ >= 3 && !(__APPLE_CC__ > 1 && defined __cplusplus)
+#if __GNUC__ >= 3
# define _INTL_MAY_RETURN_STRING_ARG(n) __attribute__ ((__format_arg__ (n)))
#else
# define _INTL_MAY_RETURN_STRING_ARG(n)
@@ -127,7 +127,7 @@ extern "C" {
#ifdef _INTL_REDIRECT_INLINE
extern char *libintl_gettext (const char *__msgid)
_INTL_MAY_RETURN_STRING_ARG (1);
-static inline char *gettext (const char *__msgid)
+static inline _INTL_MAY_RETURN_STRING_ARG (1) char *gettext (const char *__msgid)
{
return libintl_gettext (__msgid);
}
--
2.13.1
Simon
next prev parent reply other threads:[~2018-06-29 21:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-29 16:55 Tom Tromey
2018-06-29 21:34 ` Simon Marchi [this message]
2018-07-02 14:58 ` Tom Tromey
2018-07-02 16:53 ` Simon Marchi
2018-07-03 13:17 ` Tom Tromey
2018-07-03 15:58 ` Simon Marchi
2018-07-03 17:43 ` Tom Tromey
2018-07-13 17:16 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ee30b149-6a2b-d7e4-4d2f-28428d266087@ericsson.com \
--to=simon.marchi@ericsson.com \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox