Fix logic error in is_builtin_expect() introduced in r24902.
[cparser] / diagnostic.c
index 585d61b..7d8c0ab 100644 (file)
@@ -40,7 +40,8 @@ static const source_position_t *curr_pos = NULL;
 /**
  * prints an additional source position
  */
-static void print_source_position(FILE *out, const source_position_t *pos) {
+static void print_source_position(FILE *out, const source_position_t *pos)
+{
        fprintf(out, "at line %u", pos->linenr);
        if (curr_pos == NULL || curr_pos->input_name != pos->input_name)
                fprintf(out, " of \"%s\"", pos->input_name);
@@ -68,7 +69,7 @@ static void diagnosticvf(const char *const fmt, va_list ap)
 
                                case 'C': {
                                        const wint_t val = va_arg(ap, wint_t);
-                                       fputwc(val, stderr);
+                                       fprintf(stderr, "%lc", val);
                                        break;
                                }
 
@@ -127,6 +128,12 @@ static void diagnosticvf(const char *const fmt, va_list ap)
                                        break;
                                }
 
+                               case 't': {
+                                       const token_t *const token = va_arg(ap, const token_t*);
+                                       print_pp_token(stderr, token);
+                                       break;
+                               }
+
                                case 'K': {
                                        const token_t* const token = va_arg(ap, const token_t*);
                                        print_token(stderr, token);