[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix use of stringize in lexxer.l
From: |
Samuel Thibault |
Subject: |
Re: [PATCH] Fix use of stringize in lexxer.l |
Date: |
Mon, 4 Apr 2016 09:12:04 +0200 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Flavio Cruz, on Sun 03 Apr 2016 16:12:16 +0200, wrote:
> The fields instr and outstr should be set to a string and not to the
> stringified number represented by the string. This improves the readability of
> mig stubs code that creates mach_msg_type_t values for messages.
Indeed. That however duplicates code between TPRETURN and TRETURN, but
the benefice seems more important to me, so I applied it, thanks!
> * lexxer.l: Inline stringize in TPRETURN and TRETURN.
> ---
> lexxer.l | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/lexxer.l b/lexxer.l
> index bd7a718..9579522 100644
> --- a/lexxer.l
> +++ b/lexxer.l
> @@ -53,8 +53,6 @@ FileName ({QString}|{AString})
> /* We do not need the input function. */
> #define YY_NO_INPUT
>
> -#define stringize(x) #x
> -
> #ifdef LDEBUG
> #define RETURN(sym) \
> { \
> @@ -68,14 +66,22 @@ FileName ({QString}|{AString})
> #define TPRETURN(intype, outtype, tsize)
> \
> { \
> yylval.symtype.innumber = (intype);
> \
> - yylval.symtype.instr = stringize(intype);
> \
> + yylval.symtype.instr = #intype; \
> yylval.symtype.outnumber = (outtype); \
> - yylval.symtype.outstr = stringize(outtype);
> \
> + yylval.symtype.outstr = #outtype;
> \
> yylval.symtype.size = (tsize); \
> RETURN(sySymbolicType); \
> }
>
> -#define TRETURN(type, tsize) TPRETURN(type,type,tsize)
> +#define TRETURN(type, tsize)
> \
> +{ \
> + yylval.symtype.innumber = (type);
> \
> + yylval.symtype.instr = #type; \
> + yylval.symtype.outnumber = (type);
> \
> + yylval.symtype.outstr = #type; \
> + yylval.symtype.size = (tsize); \
> + RETURN(sySymbolicType); \
> +}
>
> #define FRETURN(val)
> \
> { \
> --
> 2.7.0
>
>
--
Samuel
/*
* [...] Note that 120 sec is defined in the protocol as the maximum
* possible RTT. I guess we'll have to use something other than TCP
* to talk to the University of Mars.
* PAWS allows us longer timeouts and large windows, so once implemented
* ftp to mars will work nicely.
*/
(from /usr/src/linux/net/inet/tcp.c, concerning RTT [retransmission timeout])