]> Cypherpunks repositories - gostls13.git/commit
cmd/asm: fix handling of nested #if[n]defs
authorMichael Hudson-Doyle <michael.hudson@canonical.com>
Thu, 3 Sep 2015 10:49:18 +0000 (22:49 +1200)
committerMichael Hudson-Doyle <michael.hudson@canonical.com>
Fri, 4 Sep 2015 05:23:28 +0000 (05:23 +0000)
commiteaea5ade2b5f60c6dfd72a08c9243e1651778332
tree0dc3e00df2e555dc22d84a336da188777b69413b
parent13e06d89c3ccba9fd4f0456d68407ff941409b57
cmd/asm: fix handling of nested #if[n]defs

The lexer needs to process all #if[n]defs, even those found when processing is
disabled by a preceding failed conditional, or the first #endif in something
like:

    #ifdef <undefined>
    #ifdef whatever
    #endif
    #endif

terminates the first #ifdef and the second causes an error. And then the
processing of the inner #ifdefs needs to ignore their argument when they are
disabled by an outer failed condition.

Change-Id: Iba259498f1e16042f5b7580b9c000bb0599733d0
Reviewed-on: https://go-review.googlesource.com/14253
Reviewed-by: Rob Pike <r@golang.org>
src/cmd/asm/internal/lex/input.go
src/cmd/asm/internal/lex/lex_test.go