parser: Remove the unused attribute alignment from struct declaration_specifiers_t.
[cparser] / diagnostic.c
index 7c0f8a1..3ff3d61 100644 (file)
@@ -1,21 +1,6 @@
 /*
  * This file is part of cparser.
- * Copyright (C) 2007-2009 Matthias Braun <matze@braunis.de>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * Copyright (C) 2012 Matthias Braun <matze@braunis.de>
  */
 #include <stdarg.h>
 #include <stdio.h>
 #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;
@@ -141,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;
                }
 
@@ -277,8 +261,9 @@ void errorf(const position_t *pos, const char *const fmt, ...)
 
 void warningf(warning_t const warn, position_t const* pos, char const *const fmt, ...)
 {
-       va_list ap;
-       va_start(ap, fmt);
+       if (pos->is_system_header && !is_warn_on(WARN_SYSTEM))
+               return;
+
        warning_switch_t const *const s = get_warn_switch(warn);
        switch ((unsigned) s->state) {
                        char const* kind;
@@ -292,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
@@ -302,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,