From patchwork Fri Jun 29 21:34:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 28161 Received: (qmail 76516 invoked by alias); 29 Jun 2018 21:34:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 76013 invoked by uid 89); 29 Jun 2018 21:34:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.2 spammy=literally, Hx-languages-length:2899 X-HELO: sesbmg22.ericsson.net Received: from sesbmg22.ericsson.net (HELO sesbmg22.ericsson.net) (193.180.251.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 29 Jun 2018 21:34:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1530308091; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=loeIN1HVHgzA49+COAYdpxOBu+zay7CYNezE+un22lg=; b=d4L7VH9GIRT0k+ao9Hyjps4dsScY+Zvx+ZGy+VdkgjH+AfM331nLauQSNrRsKFW9 JmzU6Zf3nu7Vvls/Xa+toid9zkQrRMtk3hbx5DVmYmiZtbOhgGA97XsaCdJbqUzp X1BK19WJ7wOVpYKi6pKhDmzWXpIbfylV9f+Hs9vd9Ew=; Received: from ESESBMB505.ericsson.se (Unknown_Domain [153.88.183.118]) by sesbmg22.ericsson.net (Symantec Mail Security) with SMTP id C8.F6.02679.BF5A63B5; Fri, 29 Jun 2018 23:34:51 +0200 (CEST) Received: from ESESBMB505.ericsson.se (153.88.183.172) by ESESBMB505.ericsson.se (153.88.183.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 29 Jun 2018 23:34:50 +0200 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (153.88.183.157) by ESESBMB505.ericsson.se (153.88.183.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3 via Frontend Transport; Fri, 29 Jun 2018 23:34:50 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=McEZy9AFXvqhIQX0HASraHjVgKKaMIgRrbpDwU8mae0=; b=ZgRxILdaNPvtCsoCP77tciAPZ0fvvI0U+NcVP1F1duBc6Q+WK/ABTLGzx1J5uHSULvAmyNbA8C80tgGOxPm2kZuL64j6r97oRGuNksCyhDAB8ThvO36d0/mSk7iAA+RZ9S1KQHEeJ9ioYVB49pKnr5C5/aQTYxLxUVeBthWERxc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; Received: from [142.133.60.250] (192.75.88.130) by DM6PR15MB2395.namprd15.prod.outlook.com (2603:10b6:5:8d::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.20; Fri, 29 Jun 2018 21:34:48 +0000 Subject: Re: [RFA] Make macOS build warning-free To: Tom Tromey , References: <20180629165453.22888-1-tom@tromey.com> From: Simon Marchi Message-ID: Date: Fri, 29 Jun 2018 17:34:40 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180629165453.22888-1-tom@tromey.com> Return-Path: simon.marchi@ericsson.com Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-IsSubscribed: yes 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 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 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); }