From 33ae3dfefd5c64ac9a737b19482f048bfe02dfe0 Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Sun, 20 Jun 2010 00:34:06 +0000 Subject: [PATCH] Unbreak platforms with char unsigned by default. Oddly enough, GCC isn't satisfied with a simple cast to int in the check against EOF, so the fix is a bit involved by actually having to go through a temporary variable. --- cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l index 5c17e9270ed..0c0938f060b 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l @@ -67,8 +67,12 @@ * for all subsequent invocations, which is the effect desired. */ #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 static int id_or_type(const char *);