Do not silenty create an error expression, if the second argument of __builtin_va_sta...
[cparser] / token.c
diff --git a/token.c b/token.c
index 6e53a6c..c9b0de8 100644 (file)
--- a/token.c
+++ b/token.c
@@ -134,11 +134,10 @@ void print_token(FILE *f, const token_t *token)
 {
        switch(token->kind) {
        case T_IDENTIFIER:
-               fprintf(f, "identifier '%s'", token->identifier.symbol->string);
+               fprintf(f, "identifier '%s'", token->base.symbol->string);
                break;
        case T_INTEGER:
        case T_FLOATINGPOINT:
-       case T_FLOATINGPOINT_HEXADECIMAL:
                print_token_kind(f, (token_kind_t)token->kind);
                fputs(" '", f);
                print_stringrep(&token->number.number, f);
@@ -158,10 +157,15 @@ void print_token(FILE *f, const token_t *token)
                print_stringrep(&token->string.string, f);
                fputs("'", f);
                break;
+
        default:
-               fputc('\'', f);
-               print_token_kind(f, (token_kind_t)token->kind);
-               fputc('\'', f);
+               if (token->base.symbol) {
+                       fprintf(f, "'%s'", token->base.symbol->string);
+               } else {
+                       fputc('\'', f);
+                       print_token_kind(f, (token_kind_t)token->kind);
+                       fputc('\'', f);
+               }
                break;
        }
 }
@@ -195,7 +199,7 @@ void print_pp_token(FILE *f, const token_t *token)
 {
        switch((preprocessor_token_kind_t) token->kind) {
        case TP_IDENTIFIER:
-               fprintf(f, "identifier '%s'", token->identifier.symbol->string);
+               fprintf(f, "identifier '%s'", token->base.symbol->string);
                break;
        case TP_NUMBER:
                fprintf(f, "number '%s'", token->number.number.begin);