From patchwork Tue Jan 23 13:55:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 1889703 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=PJxaJZk8; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TK7s40PB1z23g0 for ; Wed, 24 Jan 2024 00:55:34 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C45573858420 for ; Tue, 23 Jan 2024 13:55:32 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by sourceware.org (Postfix) with ESMTPS id 248B43858C50; Tue, 23 Jan 2024 13:55:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 248B43858C50 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 248B43858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::102b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706018111; cv=none; b=WmXsswPY5xerJm2QcYDGBv5h72bCmYgOIBfQuyuXoqtS+/qGb8t6cJWOUA/ZSNYUuZk8dQgJIykkRwIhgPhZDOCbf9cTWl1mkP+SpcB0/hfMWsZJgcReyPr1kedeG6fEh1v9hR6YFUPNz0m/8M3tPeGQLknbdcdfwWy2HqZrfSs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706018111; c=relaxed/simple; bh=D9eO61zhxQWWfmlRhlbbwkoCxWNCu9N9znKAjKMuMU4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=gc2eDvgtfBEhkb7U+ZTQ+6rSFUjoDNAd6rvZZ51kCHWUc00b7sYD7EgXbryFAchZPYWEw9n/sBjH92Rw1+vGHoCTLZuoGwd/PiZhFCkxiiVVUVV8UUqgodl1oYFOf1DZCkfhlsSl5n0d4+HZUvi5OdJkVKOsRMsodXofO4+eNG8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-28bec6ae0ffso2115049a91.3; Tue, 23 Jan 2024 05:55:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706018109; x=1706622909; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=KM7kTiYPvcnDadSXXfsxV7112NsBr11Sq1dUkIilzJ8=; b=PJxaJZk8Y0J4Wh3Fnu5jlniCLWkcqi2C9A3feQPCcLRDzgWl4JnsffFyyac0o9zLMa 2BiQ2aoJ5vL8rDEEVpEmG5rF4KH7xVaywHUjQ/o65Btq0YkqxnslaN2GRgd0xXLajg52 BiU1tnYWSKp2PPJbiB+xwz4yW7Temc373UEzdU7aE66f3ZD5yriVt+B3J7WIkt8Uyl+D Q1RsmmjlbM/LpoMhc/Q1eGGFDiIcBtdaePlu7WhUBN7aIQBA/PnWkodicUrNghQnrk15 Q34fkX7rws5QDKLX9C0unwBqQZNV6jteN908eXHm/YGfT5TjQIGer5PQyOEnRWT4hkvT PydQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706018109; x=1706622909; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KM7kTiYPvcnDadSXXfsxV7112NsBr11Sq1dUkIilzJ8=; b=SMR1wl0CxXPdnZkATSKKBundhU6pXb8GCyto2y9GfV+aHk6BVVJW7CikK6xVdlqie1 LtzYJpudvYo2o3xTyJI8GTxFiwdKNdwOFHh4cXkHmX86k2LeNQp54ORawMCBJ4bYlO7i 5HIVoC7104BHeYJfPzPdZ7+v48gkfnjsb+uuP4NZlZzxUB7nH1ArdiWokT9h0waNr/EA XQErcnbGqO+G2myrNCzui8XSA2zNx335pCM++5eB9R4tiGo2AFX6Yv94unXt1UqRCjJf 9SvCUqp9QOfWz5rKtmVhgsEZZy0fTNnVXngDkGfBDvpxHFPXv9FWZtPtMsKnf3YDk6B5 CFkQ== X-Gm-Message-State: AOJu0Yz6T51Hc8NYY5exs3xVt9MBP3t7z2H0dep4zutFbipaaV+xmD8x G4z4NZJ863FZu5v7msdfrMa1hq0Vmno5LvjiID7Q8psZb8G0hmxwqeJ9bJ9q X-Google-Smtp-Source: AGHT+IF13sbhSRFEl7o1PXnSEBmS0DnhtFykv6lAh0IOS218PiFkirCQFC/jUr+He7s3RaYpqtvsxg== X-Received: by 2002:a17:90a:24e:b0:28c:64:b171 with SMTP id t14-20020a17090a024e00b0028c0064b171mr2423053pje.57.1706018108723; Tue, 23 Jan 2024 05:55:08 -0800 (PST) Received: from gnu-cfl-3.localdomain ([172.56.168.9]) by smtp.gmail.com with ESMTPSA id qc12-20020a17090b288c00b00290a26531f5sm4338620pjb.7.2024.01.23.05.55.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 05:55:08 -0800 (PST) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id 3708A740139; Tue, 23 Jan 2024 05:55:07 -0800 (PST) From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Cc: doko@gcc.gnu.org, gaiusmod2@gmail.com Subject: [PATCH] m2: Use time_t in time and don't redefine alloca Date: Tue, 23 Jan 2024 05:55:07 -0800 Message-ID: <20240123135507.158395-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-3024.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Fix the m2 build warning and error: [...] ../../src/gcc/m2/mc/mc.flex:32:9: warning: "alloca" redefined 32 | #define alloca __builtin_alloca | ^~~~~~ In file included from /usr/include/stdlib.h:587, from :22: /usr/include/alloca.h:35:10: note: this is the location of the previous definition 35 | # define alloca(size) __builtin_alloca (size) | ^~~~~~ ../../src/gcc/m2/mc/mc.flex: In function 'handleDate': ../../src/gcc/m2/mc/mc.flex:333:25: error: passing argument 1 of 'time' from incompatible point er type [-Wincompatible-pointer-types] 333 | time_t clock = time ((long *)0); | ^~~~~~~~~ | | | long int * In file included from ../../src/gcc/m2/mc/mc.flex:28: /usr/include/time.h:76:29: note: expected 'time_t *' {aka 'long long int *'} but argument is of type 'long int *' 76 | extern time_t time (time_t *__timer) __THROW; PR bootstrap/113554 * mc/mc.flex (alloca): Don't redefine. (handleDate): Replace (long *)0 with (time_t *)0 when calling time. --- gcc/m2/mc/mc.flex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/m2/mc/mc.flex b/gcc/m2/mc/mc.flex index bd37d5ad100..7c841bf8d63 100644 --- a/gcc/m2/mc/mc.flex +++ b/gcc/m2/mc/mc.flex @@ -28,9 +28,11 @@ along with GNU Modula-2; see the file COPYING3. If not see #include #include +#ifndef alloca #ifdef __GNUC__ #define alloca __builtin_alloca #endif +#endif #if !defined(TRUE) # define TRUE (1==1) @@ -330,7 +332,7 @@ handleColumn (void) static void handleDate (void) { - time_t clock = time ((long *)0); + time_t clock = time ((time_t *)0); char *sdate = ctime (&clock); char *s = (char *)alloca (strlen (sdate)+2+1); char *p = strchr(sdate, '\n');