From patchwork Fri Jun 29 16:54:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 28156 Received: (qmail 65280 invoked by alias); 29 Jun 2018 16:55:13 -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 65226 invoked by uid 89); 29 Jun 2018 16:55:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=maint X-HELO: gateway20.websitewelcome.com Received: from gateway20.websitewelcome.com (HELO gateway20.websitewelcome.com) (192.185.53.25) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 29 Jun 2018 16:55:08 +0000 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway20.websitewelcome.com (Postfix) with ESMTP id 40B29400CD688 for ; Fri, 29 Jun 2018 11:54:55 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id Ywfff67T6RPojYwfffhdnG; Fri, 29 Jun 2018 11:54:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: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=doLEjuKPA2Jf9awfCgNCm/PdiSD0OD+9fpKml6tp+OM=; b=XOFFRKt0IRBFp0uioLnXZw+QkD 34sWpwgGXKPNO5o4kAS6oC9Nn+UDpjgM2UeoAGhcFOArG6V29gnWos0jQC0j8+17kp+EkEV84cUlx cM88YSheSuAC6lNKtreDtBgSD; Received: from 75-166-79-120.hlrn.qwest.net ([75.166.79.120]:60216 helo=pokyo.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fYwff-000Oyn-0i; Fri, 29 Jun 2018 11:54:55 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA] Make macOS build warning-free Date: Fri, 29 Jun 2018 10:54:53 -0600 Message-Id: <20180629165453.22888-1-tom@tromey.com> I noticed thousands of warnings, mostly from the _() macro, when building on macOS. This patch makes the macOS build be warning-free, without requiring --disable-nls. The warning.m4 change should be self-explanatory. The symfile.c change fixes a clang warning coming from -Wmissing-braces. Tested by rebuilding on macOS and on x86-64 Fedora 28. gdb/ChangeLog 2018-06-29 Tom Tromey * symfile.c (set_objfile_default_section_offset): Use extra braces around initializer. * warning.m4 (AM_GDB_WARNINGS): Use -Wno-deprecated-declarations, -Wno-format-nonliteral, and -Wno-format-security on *-*-darwin*. * configure: Rebuild. --- gdb/ChangeLog | 8 ++++++++ gdb/configure | 11 +++++++++++ gdb/symfile.c | 2 +- gdb/warning.m4 | 11 +++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4c04d0ba728..df573d35394 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2018-06-29 Tom Tromey + + * symfile.c (set_objfile_default_section_offset): Use extra braces + around initializer. + * warning.m4 (AM_GDB_WARNINGS): Use -Wno-deprecated-declarations, + -Wno-format-nonliteral, and -Wno-format-security on *-*-darwin*. + * configure: Rebuild. + 2018-06-28 Tom Tromey * NEWS: Mention --enable-codesign. diff --git a/gdb/configure b/gdb/configure index 28756ed9826..a4d0d0a6cda 100755 --- a/gdb/configure +++ b/gdb/configure @@ -15488,6 +15488,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 diff --git a/gdb/symfile.c b/gdb/symfile.c index 48eca5cc0ea..62b38bd6182 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2088,7 +2088,7 @@ set_objfile_default_section_offset (struct objfile *objf, { /* Add OFFSET to all sections by default. */ std::vector offsets (objf->num_sections, - { offset }); + { { offset } }); /* Create sorted lists of all sections in ADDRS as well as all sections in OBJF. */ 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