From cc9faa98adc96788e6a560c685bbd8e69c856cb7 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 11 Aug 2021 18:16:35 +0930 Subject: [PATCH] PR28198, Support # as linker script comment marker PR 28198 * ldlex.l: Combine rules for handling newline, whitespace and comments. Extend # comment handling to all states. --- ld/ldlex.l | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ld/ldlex.l b/ld/ldlex.l index 25b4bcaae01..f588bd3adc5 100644 --- a/ld/ldlex.l +++ b/ld/ldlex.l @@ -420,8 +420,13 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* yylval.name[len] = 0; return NAME; } -"\n" { lineno++;} -[ \t\r]+ { } + +"\n" { + lineno++; } +[ \t\r]+ { + /* Eat up whitespace */ } +#.* { + /* Eat up comments */ } [:,;] { return *yytext; } @@ -450,12 +455,6 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)* return *yytext; } -[\n] { lineno++; } - -#.* { /* Eat up comments */ } - -[ \t\r]+ { /* Eat up whitespace */ } - <> { include_stack_ptr--; if (include_stack_ptr == 0) -- 2.30.2