public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Iain D Sandoe <iains@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r10-10785] libiberty, configure, Darwin: Avoid detecting deprecated sbrk. Date: Sun, 29 May 2022 19:07:42 +0000 (GMT) [thread overview] Message-ID: <20220529190742.143723829BD4@sourceware.org> (raw) https://gcc.gnu.org/g:1f459833392b4520d5edfeeadd33150b71061b7a commit r10-10785-g1f459833392b4520d5edfeeadd33150b71061b7a Author: Iain Sandoe <iain@sandoe.co.uk> Date: Mon Aug 23 17:27:25 2021 +0100 libiberty, configure, Darwin: Avoid detecting deprecated sbrk. Darwin provides an implementation of sbrk, which is detected by the configuration process. However, it is deprecated which leads to build warnings. The malloc-based implementation is more suitable. This patch removes sbrk from the functions searched for Darwin. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> libiberty/ChangeLog: * configure: Regenerate. * configure.ac: Do not search for sbrk on Darwin. * xmalloc.c: Do not declare sbrk unless it has been found by configure. (cherry picked from commit fbb334a6acc5cc5d8944712daeda8089ef1d7fd2) Diff: --- libiberty/configure | 17 ++++++++++++++--- libiberty/configure.ac | 15 +++++++++++++-- libiberty/xmalloc.c | 2 ++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/libiberty/configure b/libiberty/configure index 3f82c5bb865..7bc8b571531 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -5977,9 +5977,16 @@ vars="sys_errlist sys_nerr sys_siglist" checkfuncs="__fsetlocking canonicalize_file_name dup3 getrlimit getrusage \ getsysinfo gettimeofday on_exit pipe2 psignal pstat_getdynamic pstat_getstatic \ - realpath setrlimit sbrk spawnve spawnvpe strerror strsignal sysconf sysctl \ + realpath setrlimit spawnve spawnvpe strerror strsignal sysconf sysctl \ sysmp table times wait3 wait4" +# Darwin has sbrk, but it is deprecated and that produces build-time warnings +# so do not check for it. +case "${host}" in + *-*-darwin*) ;; + *) checkfuncs="$checkfuncs sbrk" +esac + # These are neither executed nor required, but they help keep # autoheader happy without adding a bunch of text to acconfig.h. if test "x" = "y"; then @@ -7192,7 +7199,10 @@ fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_REALLOC $ac_have_decl _ACEOF -ac_fn_c_check_decl "$LINENO" "sbrk" "ac_cv_have_decl_sbrk" "$ac_includes_default" + + case "${host}" in + *-*-darwin*) ;; # Darwin's sbrk implementation is deprecated. + *) ac_fn_c_check_decl "$LINENO" "sbrk" "ac_cv_have_decl_sbrk" "$ac_includes_default" if test "x$ac_cv_have_decl_sbrk" = xyes; then : ac_have_decl=1 else @@ -7202,7 +7212,8 @@ fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_SBRK $ac_have_decl _ACEOF - +;; + esac ac_fn_c_check_decl "$LINENO" "strtol" "ac_cv_have_decl_strtol" "$ac_includes_default" if test "x$ac_cv_have_decl_strtol" = xyes; then : ac_have_decl=1 diff --git a/libiberty/configure.ac b/libiberty/configure.ac index 4e2599c14a8..9b9ec236c3d 100644 --- a/libiberty/configure.ac +++ b/libiberty/configure.ac @@ -394,9 +394,16 @@ vars="sys_errlist sys_nerr sys_siglist" checkfuncs="__fsetlocking canonicalize_file_name dup3 getrlimit getrusage \ getsysinfo gettimeofday on_exit pipe2 psignal pstat_getdynamic pstat_getstatic \ - realpath setrlimit sbrk spawnve spawnvpe strerror strsignal sysconf sysctl \ + realpath setrlimit spawnve spawnvpe strerror strsignal sysconf sysctl \ sysmp table times wait3 wait4" +# Darwin has sbrk, but it is deprecated and that produces build-time warnings +# so do not check for it. +case "${host}" in + *-*-darwin*) ;; + *) checkfuncs="$checkfuncs sbrk" +esac + # These are neither executed nor required, but they help keep # autoheader happy without adding a bunch of text to acconfig.h. if test "x" = "y"; then @@ -688,7 +695,11 @@ if test -z "${setobjs}"; then AC_CHECK_FUNCS($checkfuncs) AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, vsnprintf]) - AC_CHECK_DECLS([calloc, getenv, getopt, malloc, realloc, sbrk]) + AC_CHECK_DECLS([calloc, getenv, getopt, malloc, realloc]) + case "${host}" in + *-*-darwin*) ;; # Darwin's sbrk implementation is deprecated. + *) AC_CHECK_DECLS([sbrk]);; + esac AC_CHECK_DECLS([strtol, strtoul, strtoll, strtoull]) AC_CHECK_DECLS([strverscmp]) AC_CHECK_DECLS([strnlen]) diff --git a/libiberty/xmalloc.c b/libiberty/xmalloc.c index 96d51b57780..40b6eea62c9 100644 --- a/libiberty/xmalloc.c +++ b/libiberty/xmalloc.c @@ -87,7 +87,9 @@ extern "C" { void *malloc (size_t); void *realloc (void *, size_t); void *calloc (size_t, size_t); +#ifdef HAVE_SBRK void *sbrk (ptrdiff_t); +#endif # ifdef __cplusplus } # endif /* __cplusplus */
reply other threads:[~2022-05-29 19:07 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220529190742.143723829BD4@sourceware.org \ --to=iains@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.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: linkBe 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; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).