From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id 76BDD3858D3C; Tue, 23 Jan 2024 14:05:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 76BDD3858D3C 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 76BDD3858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::329 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706018723; cv=none; b=OJPufEK5pr5asWA8mBjrKcxP4JPS0KZrNUL+pDYu8iHJCxca2J2pswf+nUwjEmZnalMksOD/zw9hLJC4hraldOJgCk0u5H76Xr1oeYTxN+G2yVPjCDjc1hMmG+UdRm3qaf+rXJhrEJiR8we81LJb8qh5qevPSbrSIsZvItnFznM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706018723; c=relaxed/simple; bh=iXlZn6AQLQabY3VQSK7e2zvdhHwGp+Dite6xEPHjoyA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=RFwGl0et8qKY99/c4+ExUJitwJ8FlQgcvOCJu7Z58jN2XONrSKecSfvuZPPKHwgWJSmwj0926/NgwqNFlbQusTuCK6hzTExWZU+ARf+GezbkUcpECe7qNfWwfwHFENf70BLMBzn6DBbZDKXY42oKXM8Ne/oLlQBC2ZZUFd+ljdA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-40eacb4bfa0so23388795e9.1; Tue, 23 Jan 2024 06:05:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706018711; x=1706623511; darn=gcc.gnu.org; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=HkLM1pY6yOAQ+oa+3/bCTd++ubjI21crv92jg6HPWzA=; b=Sf4WqXzzgkETruXS6tbuOeS2nbqSWs/HC3hlL5Te+CGzTau4XT/3WmmLgQBpj1l7OD pcINTmvXD5g8XkPye4gPUFv+O4sbBF2GuyndE+K781Z2XIf+42EDEYOptnny+tVBEwOi q5aoLXpuVa1Lau62tz/SNWNMXPLHS6qFOov/K2KS3s+F4IprCFT9UXdqeI/7kdxYj/oV s582cGEVgEh69HYZlCGfil3sMfsyHc+gzXNcZSC7zv4ATehPjkHO21CXieMSApo6KNRQ cRhF/fq/ozKUAT30wq6xCPfDr0PW+2SB2L6AdboFPirSb1ZPEUoGphyIYCR6dVvZxVej SgyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706018711; x=1706623511; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=HkLM1pY6yOAQ+oa+3/bCTd++ubjI21crv92jg6HPWzA=; b=rauW+6I4aXRglzPi/UAuQwzGZAPCQAJTqyCuchEIDwszF30mFO+fyuwCm7ILpz09Yp rbciPjxMSR6Zy2CYCsU9PO36cOqdsQ/8GC+Rq9O6EOQEkkYUVRwjyfet5iyHw88Pns2r L637qxtvhD4E3UePnX3ceK4IXD6MrZRzyG08i2CM7/J1/qY3BblW+W7s1BgtTTUIIVE1 ffoXq74f+ol/PN/VSyTkpP5RGDZCnjkKCUTMnQbWKftjAl8ibUkKqYeDJjVq3l+r+zXC Jow1XehIs9TexZECMkjCANRUfgut3xVKru/bP7ghJRiYkhLoltI1OpVlMgw90xcK7oG8 yTGA== X-Gm-Message-State: AOJu0Yw9hvZyc7jWgf02u3sE+EixZr8RUp9xuLJaLUnEFjLiD+PEctlw V8aOB8L1LJSHbvirfxvvh04KYKrgJlikGsd80VIm6fxMwy+2JJDBhuiVy2wL X-Google-Smtp-Source: AGHT+IGbnyI7dNNTXi3nnyEi4Vn3F5YsjBhW58vtOTT9j6Y9NPcFKTJ2lhMAlGdG68g+1yG3MZknHg== X-Received: by 2002:a05:600c:45cb:b0:40e:62ad:ffe2 with SMTP id s11-20020a05600c45cb00b0040e62adffe2mr171278wmo.114.1706018710916; Tue, 23 Jan 2024 06:05:10 -0800 (PST) Received: from lancelot ([82.153.116.109]) by smtp.gmail.com with ESMTPSA id h8-20020adfa4c8000000b00337d67a85c1sm13174830wrb.62.2024.01.23.06.05.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 06:05:10 -0800 (PST) Received: from gaius by lancelot with local (Exim 4.96) (envelope-from ) id 1rSHOn-00F3sp-1z; Tue, 23 Jan 2024 14:05:09 +0000 From: Gaius Mulley To: "H.J. Lu" Cc: gcc-patches@gcc.gnu.org, doko@gcc.gnu.org Subject: Re: [PATCH] m2: Use time_t in time and don't redefine alloca References: <20240123135507.158395-1-hjl.tools@gmail.com> Date: Tue, 23 Jan 2024 14:05:09 +0000 In-Reply-To: <20240123135507.158395-1-hjl.tools@gmail.com> (H. J. Lu's message of "Tue, 23 Jan 2024 05:55:07 -0800") Message-ID: <877ck0xi0a.fsf@localhost> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,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 List-Id: "H.J. Lu" writes: > 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'); many thanks - and lgtm, regards., Gaius