This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] binutils/nm.c: Skip sbrk() under Darwin when _POSIX_C_SOURCE not defined
- From: Chen Gang <gang dot chen dot 5i5j at gmail dot com>
- To: amodra at gmail dot com, binutils at sourceware dot org, markus at trippelsdorf dot de, nickc at redhat dot com
- Date: Mon, 15 Sep 2014 21:20:34 +0800
- Subject: [PATCH] binutils/nm.c: Skip sbrk() under Darwin when _POSIX_C_SOURCE not defined
- Authentication-results: sourceware.org; auth=none
Need skip it, or will cause compiling break, the related error:
gcc -DHAVE_CONFIG_H -I. -I../../binutils-gdb/binutils -I. -I../../binutils-gdb/binutils -I../bfd -I../../binutils-gdb/binutils/../bfd -I../../binutils-gdb/binutils/../include -I./../intl -DLOCALEDIR="\"/usr/local/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT
nm.o -MD -MP -MF .deps/nm.Tpo -c -o nm.o ../../binutils-gdb/binutils/nm.c
../../binutils-gdb/binutils/nm.c:1703:28: error: 'sbrk' is deprecated [-Werror,-Wdeprecated-declarations]
char *lim = (char *) sbrk (0);
^
/usr/include/unistd.h:582:7: note: 'sbrk' declared here
void *sbrk(int);
^
1 error generated.
2014-09-15 Chen Gang <gang.chen.5i5j@gmail.com>
* nm.c (main): Skip sbrk() under Darwin when _POSIX_C_SOURCE not
defined.
---
binutils/nm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/binutils/nm.c b/binutils/nm.c
index ecd147e..431e983 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -1698,6 +1698,7 @@ main (int argc, char **argv)
END_PROGRESS (program_name);
#ifdef HAVE_SBRK
+#if !defined (__DARWIN_C_LEVEL) || defined (_POSIX_C_SOURCE)
if (show_stats)
{
char *lim = (char *) sbrk (0);
@@ -1705,6 +1706,7 @@ main (int argc, char **argv)
non_fatal (_("data size %ld"), (long) (lim - (char *) &environ));
}
#endif
+#endif
exit (retval);
return retval;
--
1.8.5.2 (Apple Git-48)