From owner-svn-src-all@FreeBSD.ORG Thu Sep 15 10:39:45 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07AEF106564A; Thu, 15 Sep 2011 10:39:45 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EAAB18FC0C; Thu, 15 Sep 2011 10:39:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8FAdicu069804; Thu, 15 Sep 2011 10:39:44 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8FAdivN069802; Thu, 15 Sep 2011 10:39:44 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201109151039.p8FAdivN069802@svn.freebsd.org> From: Andriy Gapon Date: Thu, 15 Sep 2011 10:39:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225578 - stable/8/cddl/contrib/opensolaris/lib/libdtrace/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2011 10:39:45 -0000 Author: avg Date: Thu Sep 15 10:39:44 2011 New Revision: 225578 URL: http://svn.freebsd.org/changeset/base/225578 Log: MFC r209305,209358: Do not allow EOF token to be put back into input buffer. PR: kern/159064 On behalf of: kan, marcel Modified: stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l Thu Sep 15 10:35:38 2011 (r225577) +++ stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l Thu Sep 15 10:39:44 2011 (r225578) @@ -44,7 +44,7 @@ #undef input #undef unput #else -/* +/* * Define YY_INPUT for flex since input() can't be re-defined. */ #define YY_INPUT(buf,result,max_size) \ @@ -59,6 +59,19 @@ buf[n] = *yypcb->pcb_strptr++; \ result = n; \ } +/* + * Do not EOF let tokens to be put back. This does not work with flex. + * On the other hand, leaving current buffer in same state it was when + * last EOF was received guarantees that input() will keep returning EOF + * for all subsequent invocations, which is the effect desired. + */ +#undef unput +#define unput(c) \ + do { \ + int _c = c; \ + if (_c != EOF) \ + yyunput(_c, yytext_ptr); \ + } while(0) #endif static int id_or_type(const char *); @@ -810,8 +823,7 @@ id_or_type(const char *s) longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM); } - if (c0 != EOF) - unput(c0); + unput(c0); return (ttok); }