parser: Remove the unused attribute alignment from struct declaration_specifiers_t.
[cparser] / diagnostic.c
index 7447fda..3ff3d61 100644 (file)
 #include "entity_t.h"
 #include "separator_t.h"
 #include "symbol_t.h"
-#include "token_t.h"
 #include "ast.h"
 #include "type.h"
-#include "warning.h"
+#include "unicode.h"
 
 /** Number of occurred errors. */
 unsigned error_count             = 0;
@@ -126,9 +125,9 @@ done_flags:;
                }
 
                case 'X': {
-                       unsigned int const val = va_arg(ap, unsigned int);
-                       char const  *const fmt = flag_zero ? "%0*X" : "%*X";
-                       fprintf(stderr, fmt, field_width, val);
+                       unsigned int const val  = va_arg(ap, unsigned int);
+                       char  const *const xfmt = flag_zero ? "%0*X" : "%*X";
+                       fprintf(stderr, xfmt, field_width, val);
                        break;
                }
 
@@ -265,8 +264,6 @@ void warningf(warning_t const warn, position_t const* pos, char const *const fmt
        if (pos->is_system_header && !is_warn_on(WARN_SYSTEM))
                return;
 
-       va_list ap;
-       va_start(ap, fmt);
        warning_switch_t const *const s = get_warn_switch(warn);
        switch ((unsigned) s->state) {
                        char const* kind;
@@ -280,7 +277,10 @@ void warningf(warning_t const warn, position_t const* pos, char const *const fmt
                                ++warning_count;
                                kind = "warning";
                        }
+                       va_list ap;
+                       va_start(ap, fmt);
                        diagnosticposvf(pos, kind, fmt, ap);
+                       va_end(ap);
                        if (diagnostics_show_option)
                                fprintf(stderr, " [-W%s]\n", s->name);
                        else
@@ -290,7 +290,6 @@ void warningf(warning_t const warn, position_t const* pos, char const *const fmt
                default:
                        break;
        }
-       va_end(ap);
 }
 
 static void internal_errorvf(const position_t *pos,