From owner-svn-src-all@FreeBSD.ORG Mon Jun 21 18:30:15 2010 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 C40FA1065670; Mon, 21 Jun 2010 18:30:15 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id 573838FC0C; Mon, 21 Jun 2010 18:30:14 +0000 (UTC) Received: from c122-106-145-229.carlnfd1.nsw.optusnet.com.au (c122-106-145-229.carlnfd1.nsw.optusnet.com.au [122.106.145.229]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o5LIUCLP028476 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 22 Jun 2010 04:30:13 +1000 Date: Tue, 22 Jun 2010 04:30:12 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Alexander Kabaev In-Reply-To: <20100621133340.7501713b@kan.dnsalias.net> Message-ID: <20100622041935.J44301@delplex.bde.org> References: <201006200034.o5K0Y6xl041024@svn.freebsd.org> <20100622024652.C43995@delplex.bde.org> <20100621133340.7501713b@kan.dnsalias.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Marcel Moolenaar , src-committers@freebsd.org, Bruce Evans Subject: Re: svn commit: r209358 - head/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: Mon, 21 Jun 2010 18:30:15 -0000 On Mon, 21 Jun 2010, Alexander Kabaev wrote: > On Tue, 22 Jun 2010 03:22:40 +1000 (EST) > Bruce Evans wrote: > >> On Sun, 20 Jun 2010, Marcel Moolenaar wrote: >>> ... >>> #undef unput >>> -#define unput(c) \ >>> - if (c != EOF) yyunput( c, yytext_ptr ) >>> +#define unput(c) \ >>> + do { \ >>> + int _c = c; \ >>> + if (_c != EOF) \ >>> + yyunput(_c, yytext_ptr); \ >>> + } while(0) >>> #endif >> ... >> This problem is handled by ungetc() by always converting the value to >> unsigned char. Thus the value can never equal EOF, and the character >> set is effectively represented by unsigned char's, not the plain chars >> that stdio returns in some other interfaces (but not getc()). >> >> There seems to be no reason to break the warning about this instead of >> using the same approach as stdio. This depends on yyunput() not >> having similar bugs (it must take an arg of type int and convert to >> an unsigned cgar like ungetc()): >> >> #define unput(c) yyunput((unsigned char)(c), yytext_ptr) >> >> This also fixes the missing parantheses for 'c' and some style bugs. >> >> Bruce > > DTrace _does_ try to unput EOF though and apparently gets away with it > on Solaris, so while yor version is correct, it is also useless. Do you mean that it tries to unput EOF as an int (not obtained from a char), and that that must fail and not unput ((unsigned char)EOF)? Then the current version is still broken on platforms with chars signed, since when it tries to unput a char with value EOF, that will fail and not unput ((unsigned char)). Bruce