mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-01-18 16:25:05 +08:00
strfunc: better error messages if a string transform fails
Let the user know what string transform actually failed on them. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
d4b20355d2
commit
236f4a832b
@ -746,7 +746,7 @@ static expr *eval_floatize(enum floatize type)
|
||||
return finishtemp();
|
||||
}
|
||||
|
||||
static expr *eval_strfunc(enum strfunc type)
|
||||
static expr *eval_strfunc(enum strfunc type, const char *name)
|
||||
{
|
||||
char *string;
|
||||
size_t string_len;
|
||||
@ -760,13 +760,13 @@ static expr *eval_strfunc(enum strfunc type)
|
||||
scan();
|
||||
}
|
||||
if (tt != TOKEN_STR) {
|
||||
nasm_nonfatal("expecting string");
|
||||
nasm_nonfatal("expecting string as argument to %s", name);
|
||||
return NULL;
|
||||
}
|
||||
string_len = string_transform(tokval->t_charptr, tokval->t_inttwo,
|
||||
&string, type);
|
||||
if (string_len == (size_t)-1) {
|
||||
nasm_nonfatal("invalid string for transform");
|
||||
nasm_nonfatal("invalid input string to %s", name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -908,7 +908,7 @@ static expr *expr6(void)
|
||||
return eval_floatize(tokval->t_integer);
|
||||
|
||||
case TOKEN_STRFUNC:
|
||||
return eval_strfunc(tokval->t_integer);
|
||||
return eval_strfunc(tokval->t_integer, tokval->t_charptr);
|
||||
|
||||
case '(':
|
||||
scan();
|
||||
|
@ -619,7 +619,7 @@ restart_parse:
|
||||
string_transform(tokval.t_charptr, tokval.t_inttwo,
|
||||
&eop->stringval, func);
|
||||
if (eop->stringlen == (size_t)-1) {
|
||||
nasm_nonfatal("invalid string for transform");
|
||||
nasm_nonfatal("invalid input string to %s", funcname);
|
||||
eop->type = EOT_NOTHING;
|
||||
}
|
||||
}
|
||||
|
@ -3,16 +3,16 @@
|
||||
./travis/test/utf.asm:65: error: unterminated __utf16__ function
|
||||
./travis/test/utf.asm:65: error: comma expected after operand 2
|
||||
./travis/test/utf.asm:66: error: unterminated __utf16__ function
|
||||
./travis/test/utf.asm:67: error: invalid string for transform
|
||||
./travis/test/utf.asm:67: error: invalid input string to __utf16__
|
||||
./travis/test/utf.asm:69: error: __utf16le__ must be followed by a string constant
|
||||
./travis/test/utf.asm:70: error: __utf16le__ must be followed by a string constant
|
||||
./travis/test/utf.asm:71: error: unterminated __utf16le__ function
|
||||
./travis/test/utf.asm:71: error: comma expected after operand 2
|
||||
./travis/test/utf.asm:72: error: unterminated __utf16le__ function
|
||||
./travis/test/utf.asm:73: error: invalid string for transform
|
||||
./travis/test/utf.asm:73: error: invalid input string to __utf16le__
|
||||
./travis/test/utf.asm:75: error: __utf16be__ must be followed by a string constant
|
||||
./travis/test/utf.asm:76: error: __utf16be__ must be followed by a string constant
|
||||
./travis/test/utf.asm:77: error: unterminated __utf16be__ function
|
||||
./travis/test/utf.asm:77: error: comma expected after operand 2
|
||||
./travis/test/utf.asm:78: error: unterminated __utf16be__ function
|
||||
./travis/test/utf.asm:79: error: invalid string for transform
|
||||
./travis/test/utf.asm:79: error: invalid input string to __utf16be__
|
||||
|
Loading…
Reference in New Issue
Block a user