tccpp: Allow local labels to start with a dot

--
By by ... Detlef
This commit is contained in:
Detlef Riekenberg 2010-04-05 12:28:27 +02:00
parent 9ff7a0bc98
commit f740485a5a
2 changed files with 10 additions and 1 deletions

View File

@ -691,8 +691,11 @@ static int tcc_assemble_internal(TCCState *s1, int do_preprocess)
opcode = tok; opcode = tok;
next(); next();
if (tok == ':') { if (tok == ':') {
char * label = get_tok_str(opcode, NULL);
/* new label */ /* new label */
asm_new_label(s1, opcode, 0); asm_new_label(s1, opcode,
(label && label[0] == '.' && label[1] == 'L') ? 1 : 0);
next(); next();
goto redo; goto redo;
} else if (tok == '=') { } else if (tok == '=') {

View File

@ -2279,6 +2279,12 @@ maybe_newline:
tok = TOK_PPNUM; tok = TOK_PPNUM;
break; break;
case '.': case '.':
/* check first for a local label (.Lxx:) */
if (p[1] == 'L') {
/* fast case */
goto parse_ident_fast;
}
/* special dot handling because it can also start a number */ /* special dot handling because it can also start a number */
PEEKC(c, p); PEEKC(c, p);
if (isnum(c)) { if (isnum(c)) {