From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69836 invoked by alias); 1 Aug 2018 14:59:18 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 69819 invoked by uid 89); 1 Aug 2018 14:59:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3 autolearn=ham version=3.3.2 spammy= X-HELO: sesbmg23.ericsson.net Received: from sesbmg23.ericsson.net (HELO sesbmg23.ericsson.net) (193.180.251.37) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 01 Aug 2018 14:59:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1533135552; 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=GzZT8pnmOyru0Oa9Lw30dGQosxPCkdRENQZdbzGIetQ=; b=cLtKl+1SyYlarYc408cgpR2BwkNDyS40lu0i6DXu05opy3L6UNJnSSXTlJLuyFGh 9CkLuJZOU0VQoPSSjJT4NWNfzaUGtWvqI77zRmPjPYcenQtC0qEkR3Bh0PlpCIWS 28k49wwqL8Ozxgf0a8kPQhhaxN8u6q0Rbs3usz7n3Ic=; Received: from ESESBMB503.ericsson.se (Unknown_Domain [153.88.183.116]) by sesbmg23.ericsson.net (Symantec Mail Security) with SMTP id 6C.A4.27833.0CAC16B5; Wed, 1 Aug 2018 16:59:12 +0200 (CEST) Received: from ESESSMB505.ericsson.se (153.88.183.166) by ESESBMB503.ericsson.se (153.88.183.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Wed, 1 Aug 2018 16:59:12 +0200 Received: from NAM05-BY2-obe.outbound.protection.outlook.com (153.88.183.157) by ESESSMB505.ericsson.se (153.88.183.166) 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; Wed, 1 Aug 2018 16:59:12 +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=EEgtv+++8xtIr72DFSuZwq4tr8irVwm5gU3CuYh049Y=; b=cnE907gnzS57gMppQGnSBbZTfXf3AfA73Qm4pBt+uSA7XNQkFi+J9LrFLX33MdQ7qd6SayY/Uc9wtLucbSpwT79zK5xIrchHjlSjH1wKvFkHgxkAYdjlUVqffYqTwMU9Ru/vwRs/GoLKjXeDORfFJzerGRfUj+hN4399VTEhGQg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; Received: from localhost.localdomain (192.222.164.54) by BN7PR15MB2388.namprd15.prod.outlook.com (2603:10b6:406:8c::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.19; Wed, 1 Aug 2018 14:59:08 +0000 From: Simon Marchi To: , , CC: Simon Marchi Subject: [PATCH] Backport gettext fixes to get rid of warnings on macOS Date: Wed, 01 Aug 2018 14:59:00 -0000 Message-Id: <1533135533-16471-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain Return-Path: simon.marchi@ericsson.com Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-IsSubscribed: yes X-SW-Source: 2018-08/txt/msg00013.txt.bz2 This patch was tested to build binutils-gdb on GNU/Linux and macOS. It can be applied to the gcc repo too, after fixing some trivial merge conflicts (someone else will need to do it, as I don't have push access to gcc). Although I think it is relatively low-risk, building gcc on macOS was not tested with this patch, so if somebody that has already a macOS build can do it, it would be appreciated. Two fixes were committed recently to the gettext repo in order to make gdb build warning-free on macOS. This patch backports them both: - Make the format_arg attribute effective also in the case _INTL_REDIRECT_INLINE. 113893dce80358a4ae0d9463ce73c5670c81cf0c http://git.savannah.gnu.org/cgit/gettext.git/commit/?id=113893dce80358a4ae0d9463ce73c5670c81cf0c - Enable the format_arg attribute also on clang on Mac OS X. bd6a52241c7c83c90e043ace2082a2508d273f55 http://git.savannah.gnu.org/cgit/gettext.git/commit/?id=bd6a52241c7c83c90e043ace2082a2508d273f55 intl/ChangeLog: * libgnuintl.h (_INTL_MAY_RETURN_STRING_ARG, gettext, dgettext, dcgettext, ngettext, dngettext, dcngettext): Backport changes from upstream gettext. --- intl/libgnuintl.h | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/intl/libgnuintl.h b/intl/libgnuintl.h index acc9093..7616d6f 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 defined __GNUC__ && __GNUC__ >= 3 && !(defined __APPLE_CC__ && __APPLE_CC__ > 1 && !(defined __clang__ && __clang__ && __clang_major__ >= 3) && defined __cplusplus) # define _INTL_MAY_RETURN_STRING_ARG(n) __attribute__ ((__format_arg__ (n))) #else # define _INTL_MAY_RETURN_STRING_ARG(n) @@ -127,7 +127,9 @@ 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); } @@ -145,7 +147,9 @@ extern char *gettext _INTL_PARAMS ((const char *__msgid)) #ifdef _INTL_REDIRECT_INLINE extern char *libintl_dgettext (const char *__domainname, const char *__msgid) _INTL_MAY_RETURN_STRING_ARG (2); -static inline char *dgettext (const char *__domainname, const char *__msgid) +static inline +_INTL_MAY_RETURN_STRING_ARG (2) +char *dgettext (const char *__domainname, const char *__msgid) { return libintl_dgettext (__domainname, __msgid); } @@ -165,8 +169,9 @@ extern char *dgettext _INTL_PARAMS ((const char *__domainname, extern char *libintl_dcgettext (const char *__domainname, const char *__msgid, int __category) _INTL_MAY_RETURN_STRING_ARG (2); -static inline char *dcgettext (const char *__domainname, const char *__msgid, - int __category) +static inline +_INTL_MAY_RETURN_STRING_ARG (2) +char *dcgettext (const char *__domainname, const char *__msgid, int __category) { return libintl_dcgettext (__domainname, __msgid, __category); } @@ -188,8 +193,10 @@ extern char *dcgettext _INTL_PARAMS ((const char *__domainname, extern char *libintl_ngettext (const char *__msgid1, const char *__msgid2, unsigned long int __n) _INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2); -static inline char *ngettext (const char *__msgid1, const char *__msgid2, - unsigned long int __n) +static inline +_INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2) +char *ngettext (const char *__msgid1, const char *__msgid2, + unsigned long int __n) { return libintl_ngettext (__msgid1, __msgid2, __n); } @@ -210,8 +217,10 @@ extern char *ngettext _INTL_PARAMS ((const char *__msgid1, extern char *libintl_dngettext (const char *__domainname, const char *__msgid1, const char *__msgid2, unsigned long int __n) _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3); -static inline char *dngettext (const char *__domainname, const char *__msgid1, - const char *__msgid2, unsigned long int __n) +static inline +_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3) +char *dngettext (const char *__domainname, const char *__msgid1, + const char *__msgid2, unsigned long int __n) { return libintl_dngettext (__domainname, __msgid1, __msgid2, __n); } @@ -234,9 +243,11 @@ extern char *libintl_dcngettext (const char *__domainname, const char *__msgid1, const char *__msgid2, unsigned long int __n, int __category) _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3); -static inline char *dcngettext (const char *__domainname, - const char *__msgid1, const char *__msgid2, - unsigned long int __n, int __category) +static inline +_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3) +char *dcngettext (const char *__domainname, + const char *__msgid1, const char *__msgid2, + unsigned long int __n, int __category) { return libintl_dcngettext (__domainname, __msgid1, __msgid2, __n, __category); } -- 2.7.4