aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDetlef Riekenberg <tcc.dev@web.de>2010-04-05 12:28:27 +0200
committerDetlef Riekenberg <tcc.dev@web.de>2010-04-05 12:28:27 +0200
commitf740485a5ab2ecef741bf1161b9feeea9c18cac0 (patch)
treef1ef9db2dfa452f60203c50ed35ca860d6730464
parent9ff7a0bc98867e8749de2622b65e9a07eb0749a8 (diff)
downloadtinycc-f740485a5ab2ecef741bf1161b9feeea9c18cac0.tar.gz
tinycc-f740485a5ab2ecef741bf1161b9feeea9c18cac0.tar.bz2
tccpp: Allow local labels to start with a dot
-- By by ... Detlef
-rw-r--r--tccasm.c5
-rw-r--r--tccpp.c6
2 files changed, 10 insertions, 1 deletions
diff --git a/tccasm.c b/tccasm.c
index 5702556..a1bd28c 100644
--- a/tccasm.c
+++ b/tccasm.c
@@ -691,8 +691,11 @@ static int tcc_assemble_internal(TCCState *s1, int do_preprocess)
opcode = tok;
next();
if (tok == ':') {
+ char * label = get_tok_str(opcode, NULL);
+
/* new label */
- asm_new_label(s1, opcode, 0);
+ asm_new_label(s1, opcode,
+ (label && label[0] == '.' && label[1] == 'L') ? 1 : 0);
next();
goto redo;
} else if (tok == '=') {
diff --git a/tccpp.c b/tccpp.c
index 9a4cbca..51348cf 100644
--- a/tccpp.c
+++ b/tccpp.c
@@ -2279,6 +2279,12 @@ maybe_newline:
tok = TOK_PPNUM;
break;
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 */
PEEKC(c, p);
if (isnum(c)) {