parser: Remove the unused attribute alignment from struct declaration_specifiers_t.
[cparser] / diagnostic.h
1 /*
2  * This file is part of cparser.
3  * Copyright (C) 2012 Matthias Braun <matze@braunis.de>
4  */
5 #ifndef DIAGNOSTIC_H
6 #define DIAGNOSTIC_H
7
8 #include <stdbool.h>
9 #include "token_t.h"
10 #include "warning.h"
11
12 /* define a NORETURN attribute */
13 #ifndef NORETURN
14 # if defined(__GNUC__)
15 #  if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 70)
16 #   define NORETURN void __attribute__ ((noreturn))
17 #  endif /* __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 70) */
18 # endif /* defined(__GNUC__) */
19
20 # if defined(_MSC_VER)
21 #  define NORETURN void __declspec(noreturn)
22 # endif /* defined(_MSC_VER) */
23
24 /* If not set above, use "void" for DOES_NOT_RETURN. */
25 # ifndef NORETURN
26 # define NORETURN void
27 # endif /* ifndef NORETURN */
28 #endif /* ifndef NORETURN */
29
30 /**
31  * Issue a diagnostic message.
32  * Format types:
33  *  %E   expression_t const*
34  *  %K   token_t const*
35  *  %k   token_kind_t
36  *  %#k  va_list*, char const*
37  *  %N   entity_t const*
38  *  %#N  entity_t const*
39  *  %P   position_t const*
40  *  %Q   unsigned (qualifier)
41  *  %S   string_t const*
42  *  %T   type_t const*
43  *  %#T  type_t const*, symbol_t const*
44  *  %Y   symbol_t const*
45  */
46 void diagnosticf(const char *fmt, ...);
47 void errorf(const position_t *pos, const char *fmt, ...);
48 void warningf(warning_t, const position_t *pos, const char *fmt, ...);
49 NORETURN internal_errorf(const position_t *pos, const char *fmt, ...);
50
51 extern unsigned error_count;
52 extern unsigned warning_count;
53 extern bool     show_column;             /**< Show column in diagnostic messages */
54 extern bool     diagnostics_show_option; /**< Show the switch, which controls a warning. */
55
56 #endif