From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA] Make macOS build warning-free
Date: Fri, 29 Jun 2018 16:55:00 -0000 [thread overview]
Message-ID: <20180629165453.22888-1-tom@tromey.com> (raw)
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 <tom@tromey.com>
* 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 <tom@tromey.com>
+
+ * 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 <tom@tromey.com>
* 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 <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
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<struct section_offsets> 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 <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
--
2.17.1
next reply other threads:[~2018-06-29 16:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-29 16:55 Tom Tromey [this message]
2018-06-29 21:34 ` Simon Marchi
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=20180629165453.22888-1-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/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