From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1039) id 313A13858CDA; Tue, 23 Jan 2024 14:10:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 313A13858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706019023; bh=brs+7aye01VvMAfdoOKxB2RnCwAGyfhcDdA+v5SH/yU=; h=From:To:Subject:Date:From; b=jSYxmurSV6mDAfNyWAhtd2uh9tf+RpbVK7PihS9ja8fueAOAlFX7TvLmv+Fpk9Gb1 dUa5zHhrNu4JPs2gCLBJftni6rEi3wFbxkWNvYwowha6w678774h75ww5W3cjDqFWS xFYHcFQkhg8muJGZ/MZFEAACiWpuNDUvPsLRFti4= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: H.J. Lu To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-8362] m2: Use time_t in time and don't redefine alloca X-Act-Checkin: gcc X-Git-Author: H.J. Lu X-Git-Refname: refs/heads/master X-Git-Oldrev: ef86659da9de59896fb0128eef418224299267e9 X-Git-Newrev: 2bdf138a0d0141065fa9a8efa2ff86f211888a59 Message-Id: <20240123141023.313A13858CDA@sourceware.org> Date: Tue, 23 Jan 2024 14:10:23 +0000 (GMT) List-Id: https://gcc.gnu.org/g:2bdf138a0d0141065fa9a8efa2ff86f211888a59 commit r14-8362-g2bdf138a0d0141065fa9a8efa2ff86f211888a59 Author: H.J. Lu Date: Tue Jan 23 05:55:07 2024 -0800 m2: Use time_t in time and don't redefine alloca 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. Diff: --- 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');