diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2007-10-15 14:40:02 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2007-10-15 14:40:02 +0000 |
commit | 551eb4d6c3e45ace719aea770e0078885dd553dd (patch) | |
tree | f7c8f069e746140050ac0e6612530aa77c4b98bc /dmake/macparse.c | |
parent | f6c2da4d3a5a2c688a7b5c2706c775fa3ba7052a (diff) |
INTEGRATION: CWS dmake411 (1.2.16); FILE MERGED
2007/08/09 19:46:38 vq 1.2.16.3:
#i69510# Change error on assignment to an empty macro name to a warning.
2007/08/08 16:54:59 vq 1.2.16.2: #i69510# Improve error message.
2007/08/08 16:52:21 vq 1.2.16.1: #i69510# Improve macro name syntax check during assignment.
Diffstat (limited to 'dmake/macparse.c')
-rw-r--r-- | dmake/macparse.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/dmake/macparse.c b/dmake/macparse.c index bbc9cd823667..88db1230ec84 100644 --- a/dmake/macparse.c +++ b/dmake/macparse.c @@ -1,4 +1,4 @@ -/* RCS $Id: macparse.c,v 1.2 2006-09-25 09:40:09 vg Exp $ +/* RCS $Id: macparse.c,v 1.3 2007-10-15 15:40:02 ihi Exp $ -- -- SYNOPSIS -- Parse a macro definition @@ -45,6 +45,7 @@ int flag; int operator; /* what macro operator do we have */ char *tok1; /* temporary place to keep a token */ char *tok2; /* temporary place to keep a token */ + int toklen; /* length of a token */ DB_ENTER( "Parse_macro" ); @@ -53,8 +54,8 @@ int flag; operator=Macro_op(tok1); if( operator ) { - Error( "No macro name" ); CLEAR_TOKEN( &input ); + Error( "Assignment without macro name: [%s].", buffer ); DB_RETURN( 1 ); } @@ -67,6 +68,22 @@ int flag; } tok2 = Expand(tok1); FREE(tok1); tok1 = tok2; + if ( !(toklen = strlen(tok1)) ) { + Warning( "Empty macro name after expansion: [%s].", buffer ); + } + + /* Catch illegal single character macro names. */ + if ( toklen == 1 && strchr("{()}", tok1[0]) ) { + CLEAR_TOKEN( &input ); + Fatal( "Syntax error in macro assignment [%s]. The following characters cannot be used as single letter macro names: '{()}'.", buffer ); + } + + /* Catch ':' in macro names. */ + if ( strchr(tok1, ':') ) { + CLEAR_TOKEN( &input ); + Fatal( "Syntax error in macro assignment [%s]. The character ':' is not allowed in macro names.", buffer ); + } + tok2 = Get_token(&input, NIL( char ), FALSE); /* Make sure we can force the assignment. */ |