[PATCH 05/11] gas: pre-init the scrubber's lex[]

Hans-Peter Nilsson hp@bitrange.com
Mon Jul 1 01:45:49 GMT 2024


On Fri, 28 Jun 2024, Jan Beulich wrote:
> +static char lex[256] = {
> +  [' ']  = LEX_IS_WHITESPACE,
> +  ['\t'] = LEX_IS_WHITESPACE,
> +  ['\r'] = LEX_IS_WHITESPACE,
> +  ['\n'] = LEX_IS_NEWLINE,
> +  [':']  = LEX_IS_COLON,
> +  ['$']  = LEX_IS_SYMBOL_COMPONENT,
> +  ['.']  = LEX_IS_SYMBOL_COMPONENT,
> +  ['_']  = LEX_IS_SYMBOL_COMPONENT,
> +  ['A' ... 'Z'] = LEX_IS_SYMBOL_COMPONENT,
> +  ['a' ... 'z'] = LEX_IS_SYMBOL_COMPONENT,
> +  ['0' ... '9'] = LEX_IS_SYMBOL_COMPONENT,
> +  [128 ... 255] = LEX_IS_SYMBOL_COMPONENT,

That "..." initializer thingy is a GCC GNU extension.
Cf. GCC docs.  You probably don't want to do that.
Spelling it out won't hurt that much.

brgds, H-P


More information about the Binutils mailing list