From patchwork Mon Dec 4 10:26:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 81271 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 36AA2385829A for ; Mon, 4 Dec 2023 10:27:08 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp.CeBiTec.Uni-Bielefeld.DE (smtp.CeBiTec.Uni-Bielefeld.DE [129.70.160.84]) by sourceware.org (Postfix) with ESMTPS id B140D3858C35 for ; Mon, 4 Dec 2023 10:26:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B140D3858C35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=CeBiTec.Uni-Bielefeld.DE Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cebitec.uni-bielefeld.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B140D3858C35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=129.70.160.84 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701685612; cv=none; b=c8r9iiXVgf+pVoMuqEqVA/f7FNC8Y9q5lWAHWI9kLpgCBKGN/I8fGebc37Eb7ZcXJUCcNUY7VBkXgj8/2FuxgbT+XMX8VHGBUgs/4dCC9i/GMv+pYWewOkmNjCOhTrWVFHbPrtW19mM0zmFdKRFR3flmA4KH9rLkdvrvNBJuGXE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701685612; c=relaxed/simple; bh=WDRTyqOa6mGLAE1sr96my9cqb+BlTh9AotZRCuxoqks=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=GsphGUrFlL8ZY3LLaGJ5baks2p6lMGxbehFJ/Qof6Z54oXxjZEBvXtuzy+vcaIrObh/h6dXFBNUZ+vnrmdsYPtSS+mNy0mzx8eMq/VQv63/wHiN29L46TDgJBX8gyKb5AEPpkhf+yvE0D63DtETfYEB1NzCnvWbHe+j4gaZI2qE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost (localhost [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 87341CFE22; Mon, 4 Dec 2023 11:26:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= cebitec.uni-bielefeld.de; h=content-type:content-type :mime-version:user-agent:message-id:date:date:subject:subject :from:from:received:received; s=20200306; t=1701685610; bh=WDRTy qOa6mGLAE1sr96my9cqb+BlTh9AotZRCuxoqks=; b=REopyzHgiTW8Via1pG4sP g+C294Bw+vhX+KZQLgT2Fi4F7wM8qRRXx1fKD9eQYCBHuj54CpvVKrLmDZvN2Dut X9/D2GLbF1+HHy2YdKPnmNIBViz77FX5l7FNn5Owf2kawez/sn6aVu2Iqov7MJqC +yRtriA0ltXCkdsuSjxVyOsBAjs8PRj8Ili5G3CPiqHZMKUzl4l8dFnSrX/D79hu knaTx7K/+gKhxIQ9ox3hfnDk+UAU5VBsXlZ3OkxYKvuRPm1xLZpcXsQCyVMriEnO w7jPUlNaGj8gjSwINsXtChNUn8dAntZkEzL6E+MAvbc61+uoZwlblpw0f1V24l0g g== X-Virus-Scanned: amavisd-new at cebitec.uni-bielefeld.de Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (smtp.cebitec.uni-bielefeld.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id h1P5-8HskPdk; Mon, 4 Dec 2023 11:26:50 +0100 (CET) Received: from manam.CeBiTec.Uni-Bielefeld.DE (p4fddb508.dip0.t-ipconnect.de [79.221.181.8]) (Authenticated sender: ro) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPSA id 067E5CFE21; Mon, 4 Dec 2023 11:26:50 +0100 (CET) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: Gaius Mulley Subject: [PATCH] gm2: Fix mc/mc.flex compilation on Solaris Date: Mon, 04 Dec 2023 11:26:49 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1.90 (usg-unix-v) MIME-Version: 1.0 X-Spam-Status: No, score=-3791.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, 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+patchwork=sourceware.org@gcc.gnu.org The recent warning changes broke gm2 bootstrap on Solaris: /vol/gcc/src/hg/master/local/gcc/m2/mc/mc.flex: In function 'handleFile': /vol/gcc/src/hg/master/local/gcc/m2/mc/mc.flex:297:21: error: implicit declaration of function 'alloca' [-Wimplicit-function-declaration] 297 | char *s = (char *)alloca (strlen (filename) + 2 + 1); | ^~~~~~ alloca needs on Solaris, which isn't universally available. Since mc.flex doesn't include any config header, I chose to switch to __builtin_alloca instead. /vol/gcc/src/hg/master/local/gcc/m2/mc/mc.flex:332:19: error: implicit declaration of function 'index' [-Wimplicit-function-declaration] 332 | char *p = index(sdate, '\n'); | ^~~~~ index is declared in on Solaris, again not a standard header. I simply switched to using strchr to avoid that issue. Bootstrapped without regressions on i386-pc-solaris2.11, sparc-sun-solaris2.11, x86_64-pc-linux-gnu, and x86_64-apple-darwin23.1.0. Ok for trunk? Rainer # HG changeset patch # Parent 76246607bf26a4639355410e36af4cbf08c04f99 gm2: Fix mc/mc.flex compilation on Solaris diff --git a/gcc/m2/mc/mc.flex b/gcc/m2/mc/mc.flex --- a/gcc/m2/mc/mc.flex +++ b/gcc/m2/mc/mc.flex @@ -28,6 +28,10 @@ along with GNU Modula-2; see the file CO #include #include +#ifdef __GNUC__ +#define alloca __builtin_alloca +#endif + #if !defined(TRUE) # define TRUE (1==1) #endif @@ -329,7 +333,7 @@ handleDate (void) time_t clock = time ((long *)0); char *sdate = ctime (&clock); char *s = (char *)alloca (strlen (sdate)+2+1); - char *p = index(sdate, '\n'); + char *p = strchr(sdate, '\n'); if (p != NULL) { *p = (char) 0;