mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-03-31 18:20:22 +08:00
preproc: Add dump_token helper
While being debugging some nifty problem I found that it might be useful to produce a full dump of tokens, in particular text of tokens. For this reason dump_token is here just to not loose it. It doesn't affect normal build procedure since it requires a special -DNASM_TRACE to be passed to the compiler. Which of course we don't in a regular compilations. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
parent
574fbf1972
commit
49e8f698fc
18
preproc.c
18
preproc.c
@ -483,6 +483,24 @@ static ExpInv *new_ExpInv(int exp_type, ExpDef *ed);
|
||||
#define tok_is_(x,v) (tok_type_((x), TOK_OTHER) && !strcmp((x)->text,(v)))
|
||||
#define tok_isnt_(x,v) ((x) && ((x)->type!=TOK_OTHER || strcmp((x)->text,(v))))
|
||||
|
||||
#ifdef NASM_TRACE
|
||||
|
||||
#define dump_token(t) raw_dump_token(t, __FILE__, __LINE__, __func__);
|
||||
static void raw_dump_token(Token *token, const char *file, int line, const char *func)
|
||||
{
|
||||
printf("---[%s (%s:%d): %p]---\n", func, file, line, (void *)token);
|
||||
if (token) {
|
||||
Token *t;
|
||||
list_for_each(t, token) {
|
||||
if (t->text)
|
||||
printf("'%s' ", t->text);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* nasm_unquote with error if the string contains NUL characters.
|
||||
* If the string contains NUL characters, issue an error and return
|
||||
|
Loading…
x
Reference in New Issue
Block a user