public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Florian Weimer <fw@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3364] libiberty: Fix C89-isms in configure tests Date: Tue, 18 Oct 2022 14:59:20 +0000 (GMT) [thread overview] Message-ID: <20221018145920.D42723858036@sourceware.org> (raw) https://gcc.gnu.org/g:885b6660c17fb91980b5682514ef54668e544b02 commit r13-3364-g885b6660c17fb91980b5682514ef54668e544b02 Author: Florian Weimer <fweimer@redhat.com> Date: Tue Oct 18 16:58:48 2022 +0200 libiberty: Fix C89-isms in configure tests libiberty/ * acinclude.m4 (ac_cv_func_strncmp_works): Add missing int return type and parameter list to the definition of main. Include <stdlib.h> and <string.h> for prototypes. (ac_cv_c_stack_direction): Add missing int return type and parameter list to the definitions of main, find_stack_direction. Include <stdlib.h> for exit prototype. * configure: Regenerate. Diff: --- libiberty/acinclude.m4 | 14 +++++++++++--- libiberty/configure | 14 +++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/libiberty/acinclude.m4 b/libiberty/acinclude.m4 index 6bd127e9826..6bb690597bf 100644 --- a/libiberty/acinclude.m4 +++ b/libiberty/acinclude.m4 @@ -24,6 +24,8 @@ AC_CACHE_CHECK([for working strncmp], ac_cv_func_strncmp_works, [AC_TRY_RUN([ /* Test by Jim Wilson and Kaveh Ghazi. Check whether strncmp reads past the end of its string parameters. */ +#include <stdlib.h> +#include <string.h> #include <sys/types.h> #ifdef HAVE_FCNTL_H @@ -51,7 +53,8 @@ AC_CACHE_CHECK([for working strncmp], ac_cv_func_strncmp_works, #define MAP_LEN 0x10000 -main () +int +main (void) { #if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE) char *p; @@ -157,7 +160,10 @@ if test $ac_cv_os_cray = yes; then fi AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, -[AC_TRY_RUN([find_stack_direction () +[AC_TRY_RUN([#include <stdlib.h> + +int +find_stack_direction (void) { static char *addr = 0; auto char dummy; @@ -169,7 +175,9 @@ AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, else return (&dummy > addr) ? 1 : -1; } -main () + +int +main (void) { exit (find_stack_direction() < 0); }], diff --git a/libiberty/configure b/libiberty/configure index 65fc5002002..860f981fa18 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -6784,7 +6784,10 @@ else else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -find_stack_direction () +#include <stdlib.h> + +int +find_stack_direction (void) { static char *addr = 0; auto char dummy; @@ -6796,7 +6799,9 @@ find_stack_direction () else return (&dummy > addr) ? 1 : -1; } -main () + +int +main (void) { exit (find_stack_direction() < 0); } @@ -7621,6 +7626,8 @@ else /* Test by Jim Wilson and Kaveh Ghazi. Check whether strncmp reads past the end of its string parameters. */ +#include <stdlib.h> +#include <string.h> #include <sys/types.h> #ifdef HAVE_FCNTL_H @@ -7648,7 +7655,8 @@ else #define MAP_LEN 0x10000 -main () +int +main (void) { #if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE) char *p;
reply other threads:[~2022-10-18 14:59 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=20221018145920.D42723858036@sourceware.org \ --to=fw@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).