From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id F29513858C83 for ; Tue, 18 Oct 2022 14:10:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F29513858C83 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666102246; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=6NmpjBYuWBtcIciMqQscGuMzkfCirz1jR5joq2i8ALk=; b=DglVQ1vyPGCNz/lmI758z5vHyZnPcsQs8uhtDb0rMmX6lNUlv5wcqsJ8v+QJ9gNXmt7NKM zQo3aE2habSy8xkjO5vdbGKlVh1TXJ3X5cbl47vyvY7wFCp1jr0zoqbfeb6NVsetfR9vSC E86oEFAv6Kwh4ccWRedR7MOZ7xLN0gk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-314-fHFtgvo7Pym5kh3HPWhq_g-1; Tue, 18 Oct 2022 10:10:45 -0400 X-MC-Unique: fHFtgvo7Pym5kh3HPWhq_g-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4BD9485A5A6 for ; Tue, 18 Oct 2022 14:10:45 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CFFCE492B0A; Tue, 18 Oct 2022 14:10:44 +0000 (UTC) From: Florian Weimer To: gcc-patches@gcc.gnu.org Cc: Jakub Jelinek Subject: [PATCH v2] libiberty: Fix C89-isms in configure tests Date: Tue, 18 Oct 2022 16:10:43 +0200 Message-ID: <87v8ohi5ng.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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. --- 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; base-commit: 1dc4488e091ae75bdd2c00a482db0f1b68229154