From patchwork Tue Oct 18 14:10:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 59001 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 40840385801A for ; Tue, 18 Oct 2022 14:11:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 40840385801A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666102276; bh=6NmpjBYuWBtcIciMqQscGuMzkfCirz1jR5joq2i8ALk=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=IwjX24Lu2FecgZ0sH1CM6ZX0+0AekpxmgVVea8+O/l7bBB9h06f9PLTa4Zs2Ff4Et O89KTXtr6Bu0SEdqUGadV3hIkWWu954/8225ssAjJmdOhCXAtJoZW2rgGoiLVwiY1N 48ii/qc4JwrTlf9veNea4oUi2PSnaenN9DKhphRo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 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) To: gcc-patches@gcc.gnu.org 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 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Gcc-patches From: Florian Weimer Reply-To: Florian Weimer Cc: Jakub Jelinek Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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(-) base-commit: 1dc4488e091ae75bdd2c00a482db0f1b68229154 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;