From patchwork Tue Oct 18 10:05:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 4065 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1870561wrs; Tue, 18 Oct 2022 03:06:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6OtBJhT1R0csgc0Util7+7sqcZ/rNqJ5BqXwIJX2Rb/4tDaYjjnQmCzITueRksZwIgHeqZ X-Received: by 2002:a17:907:75dc:b0:783:9c71:5e20 with SMTP id jl28-20020a17090775dc00b007839c715e20mr1747736ejc.125.1666087597329; Tue, 18 Oct 2022 03:06:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666087597; cv=none; d=google.com; s=arc-20160816; b=zupmRH5OF00B/rEhnf16HdR/+tPJ8d/4v9NETDluVlKBT554zuz2i+ueQhLLqd5X0v kiFSUTMmo9gbYoEjmIHzX1nRGhGqOohvfKYIskODl+HjzmTxw/RJVn46mdfJW4nNCoGz NAqK0TTGHAcfSRqNbWrbYnNafeWN+rM0KXAwCyo2dbJKYm/fEtBfGF3KIQtAa8CvjNxv Sv3UmdNZciFJXIuztFu7TxA6wUP0O+G90fNgtMaRilKK/RPt4p/RQKxyF0yT5AviA43h BGcPfZqspi1s3hQdRcQxGyuwsn7pkzsaerYdp5xgLvI/PYozYrsQZ+CvkMY9x3BlRHao 3kFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:mime-version :user-agent:message-id:date:subject:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=pMa1ceXA9Gqc3bzyseNdVIxulOvqMFEpXUvyHCHiNo0=; b=hW17QmfOTeVGq4tIseNA1/qdEJMAWwfm6F0DYUpaGA23t0ZUE2vCQ6HSgWe+U+XT56 mo4bpBe+sJYqvAf7RDj0fEouv65J33ieDYz65zxlRc12J4Bj0GyYLahEdfPam91NCZNg fF2XhtEMrIWCO2A86dgD+sxTGIZS/1kB2vbPpKn89LtLEEfR00I/HVWdz+7JVPe1PlME ZEXZJ18ILF6EpGTdh2/ADPhtKvkqON+9wqU3npyr1BX5SwuJuYoDLB3eL7ojfLNnzpwR G7RovqIxVub6HXPRnVx+EUOsJsYmdA8eryO/q9JOofOXJZXQJtywiuOcqr/viTyEwBvE SSjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=rbshSjfy; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id go8-20020a1709070d8800b0078153dd2836si13852706ejc.505.2022.10.18.03.06.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Oct 2022 03:06:37 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=rbshSjfy; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4DF8B3858036 for ; Tue, 18 Oct 2022 10:06:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4DF8B3858036 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666087596; bh=pMa1ceXA9Gqc3bzyseNdVIxulOvqMFEpXUvyHCHiNo0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=rbshSjfyl2x/RyLAZRYuBqx2RwQO1SlXKMx9fjwgavQIP8rAwZugmmyn8yd4ZiMBt iuWSW0931I/zZANpF0Cy6iHpCmzVwMzXrqHKh51I07C88xCtrFF1cDFM6qy2Bp7yeP osof0eStwClCGTghyubWHhGKSaKYc5MtCK1WUpcQ= 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.129.124]) by sourceware.org (Postfix) with ESMTPS id 88E763858C83 for ; Tue, 18 Oct 2022 10:05:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 88E763858C83 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-393-0wafA8LOMQWenFB5CFl5LQ-1; Tue, 18 Oct 2022 06:05:51 -0400 X-MC-Unique: 0wafA8LOMQWenFB5CFl5LQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A428B3C3C966 for ; Tue, 18 Oct 2022 10:05:51 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4CED3C23F6A for ; Tue, 18 Oct 2022 10:05:51 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [PATCH] libiberty: Fix C89-isms in configure tests Date: Tue, 18 Oct 2022 12:05:49 +0200 Message-ID: <87h701jvk2.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.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.3 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 Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747019468536228413?= X-GMAIL-MSGID: =?utf-8?q?1747019468536228413?= libiberty/ * acinclude.m4 (check for working strncmp): Add missing int return type and parameter list to the definition of main. Include for string functions. Avoid calling undeclared exit function. (stack direction for C alloca): Avoid calling undeclared exit function. * configure: Regenerate. --- libiberty/acinclude.m4 | 12 +++++++----- libiberty/configure | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) base-commit: 54b316ff0d4f3bd823ad0b4d0011900948c5d40e diff --git a/libiberty/acinclude.m4 b/libiberty/acinclude.m4 index 6bd127e9826..6e23ae906fc 100644 --- a/libiberty/acinclude.m4 +++ b/libiberty/acinclude.m4 @@ -24,6 +24,7 @@ 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 #ifdef HAVE_FCNTL_H @@ -51,7 +52,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; @@ -59,7 +61,7 @@ main () dev_zero = open ("/dev/zero", O_RDONLY); if (dev_zero < 0) - exit (1); + return 1; p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, dev_zero, 0); @@ -67,7 +69,7 @@ main () p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0); if (p == (char *)-1) - exit (2); + return 2; else { char *string = "__si_type_info"; @@ -79,7 +81,7 @@ main () strncmp (r, q, 14); } #endif /* HAVE_MMAP || HAVE_MMAP_ANYWHERE */ - exit (0); + return 0; } ], ac_cv_func_strncmp_works=yes, ac_cv_func_strncmp_works=no, ac_cv_func_strncmp_works=yes) @@ -171,7 +173,7 @@ AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, } main () { - exit (find_stack_direction() < 0); + return find_stack_direction() < 0; }], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1, diff --git a/libiberty/configure b/libiberty/configure index 65fc5002002..c871cc559ca 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -6798,7 +6798,7 @@ find_stack_direction () } main () { - exit (find_stack_direction() < 0); + return find_stack_direction() < 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : @@ -7621,6 +7621,7 @@ else /* Test by Jim Wilson and Kaveh Ghazi. Check whether strncmp reads past the end of its string parameters. */ +#include #include #ifdef HAVE_FCNTL_H @@ -7648,7 +7649,8 @@ else #define MAP_LEN 0x10000 -main () +int +main (void) { #if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE) char *p; @@ -7656,7 +7658,7 @@ main () dev_zero = open ("/dev/zero", O_RDONLY); if (dev_zero < 0) - exit (1); + return 1; p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, dev_zero, 0); @@ -7664,7 +7666,7 @@ main () p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0); if (p == (char *)-1) - exit (2); + return 2; else { char *string = "__si_type_info"; @@ -7676,7 +7678,7 @@ main () strncmp (r, q, 14); } #endif /* HAVE_MMAP || HAVE_MMAP_ANYWHERE */ - exit (0); + return 0; } _ACEOF