From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2178) id B3B683858C2B; Wed, 4 Jan 2023 12:53:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B3B683858C2B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672836780; bh=rqUShlAhJCRE8dtOyZr3LYIJtuJAe25068hxELeVknM=; h=From:To:Subject:Date:From; b=ovqr5ZoBgEmJUO8h/mlO8eW3ncIHFqG7rInsnlFjC+RNnXaoljT3pgo50ezFK7Jsu VuurgOMNJfiHiBc+Ym1SPjtqa2AOF9WYwfNHsPFJikjSIc7QYnqvi+RsZpCknBz0KR kkoi2bfWEf+q6pDEFasygwVOyI74ZKRLV/Bvqkd4= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Florian Weimer To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-9026] libiberty: Fix C89-isms in configure tests X-Act-Checkin: gcc X-Git-Author: Florian Weimer X-Git-Refname: refs/heads/releases/gcc-12 X-Git-Oldrev: 7d7146102365f708a37401c902fce2f4024b546a X-Git-Newrev: 63f3eae53683e857818c4bd3d1de719e1310e22a Message-Id: <20230104125300.B3B683858C2B@sourceware.org> Date: Wed, 4 Jan 2023 12:53:00 +0000 (GMT) List-Id: https://gcc.gnu.org/g:63f3eae53683e857818c4bd3d1de719e1310e22a commit r12-9026-g63f3eae53683e857818c4bd3d1de719e1310e22a Author: Florian Weimer 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 and for prototypes. (ac_cv_c_stack_direction): Add missing int return type and parameter list to the definitions of main, find_stack_direction. Include for exit prototype. * configure: Regenerate. (cherry picked from commit 885b6660c17fb91980b5682514ef54668e544b02) 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 +#include #include #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 + +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 0a797255c70..ca83f89da6d 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -6780,7 +6780,10 @@ else else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -find_stack_direction () +#include + +int +find_stack_direction (void) { static char *addr = 0; auto char dummy; @@ -6792,7 +6795,9 @@ find_stack_direction () else return (&dummy > addr) ? 1 : -1; } -main () + +int +main (void) { exit (find_stack_direction() < 0); } @@ -7617,6 +7622,8 @@ else /* Test by Jim Wilson and Kaveh Ghazi. Check whether strncmp reads past the end of its string parameters. */ +#include +#include #include #ifdef HAVE_FCNTL_H @@ -7644,7 +7651,8 @@ else #define MAP_LEN 0x10000 -main () +int +main (void) { #if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE) char *p;