From owner-freebsd-current@FreeBSD.ORG Wed Mar 1 04:42:09 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5A99216A420 for ; Wed, 1 Mar 2006 04:42:09 +0000 (GMT) (envelope-from kientzle@freebsd.org) Received: from kientzle.com (h-66-166-149-50.snvacaid.covad.net [66.166.149.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0C50543D46 for ; Wed, 1 Mar 2006 04:42:06 +0000 (GMT) (envelope-from kientzle@freebsd.org) Received: from freebsd.org (p54.kientzle.com [66.166.149.54]) by kientzle.com (8.12.9/8.12.9) with ESMTP id k214g6OZ051840 for ; Tue, 28 Feb 2006 20:42:06 -0800 (PST) (envelope-from kientzle@freebsd.org) Message-ID: <4405261D.2060101@freebsd.org> Date: Tue, 28 Feb 2006 20:42:05 -0800 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.4) Gecko/20031006 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "'freebsd-current@freebsd.org'" Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: m4 include() broken? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Mar 2006 04:42:09 -0000 I'm still a little new to M4, so I may have gotten this wrong, but it looks like the BSD M4 implementation bombs on include(): $ echo AAA > input $ m4 define(`SYM',include(`input')) m4: unexpected end of input, unclosed parenthesis: stdin at line 1 I tried this on MacOS 10.4.4 and it reports no errors (GNU M4 1.4.2). On FreeBSD-CURRENT and 5.3, it bombs with the above error. Tracing through main.c, it looks like the scanner is explicitly forbidding include() as an argument to another macro by requiring that any include() close all parens: usr.bin/m4/main.c, around line 380: } else if (t == EOF) { if (sp > -1) { warnx( "unexpected end of input, unclosed parenthesis:"); dump_stack(paren, PARLEV); exit(1); } if (ilevel <= 0) break; /* all done thanks.. */ To verify this, note that the following does not generate an error: $ echo 'AAA)' > input $ m4 define(`SYM',include(`input') SYM() AAA Can anyone who knows M4 better than me confirm that the current handling of include() is wrong? Tim