]>
Commit | Line | Data |
---|---|---|
1da2ed5f JM |
1 | /* Declarations of core diagnostic functionality for code that does |
2 | not need to deal with diagnostic contexts or diagnostic info | |
3 | structures. | |
85ec4feb | 4 | Copyright (C) 1998-2018 Free Software Foundation, Inc. |
1da2ed5f JM |
5 | |
6 | This file is part of GCC. | |
7 | ||
8 | GCC is free software; you can redistribute it and/or modify it under | |
9 | the terms of the GNU General Public License as published by the Free | |
10 | Software Foundation; either version 3, or (at your option) any later | |
11 | version. | |
12 | ||
13 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
14 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 | for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with GCC; see the file COPYING3. If not see | |
20 | <http://www.gnu.org/licenses/>. */ | |
21 | ||
22 | #ifndef GCC_DIAGNOSTIC_CORE_H | |
23 | #define GCC_DIAGNOSTIC_CORE_H | |
24 | ||
7c475d11 | 25 | #include "bversion.h" |
1da2ed5f JM |
26 | |
27 | /* Constants used to discriminate diagnostics. */ | |
28 | typedef enum | |
29 | { | |
4b84d650 | 30 | #define DEFINE_DIAGNOSTIC_KIND(K, msgid, C) K, |
1da2ed5f JM |
31 | #include "diagnostic.def" |
32 | #undef DEFINE_DIAGNOSTIC_KIND | |
cd7fe53b DD |
33 | DK_LAST_DIAGNOSTIC_KIND, |
34 | /* This is used for tagging pragma pops in the diagnostic | |
35 | classification history chain. */ | |
36 | DK_POP | |
1da2ed5f JM |
37 | } diagnostic_t; |
38 | ||
39 | extern const char *progname; | |
40 | ||
41 | extern const char *trim_filename (const char *); | |
42 | ||
43 | /* If we haven't already defined a front-end-specific diagnostics | |
44 | style, use the generic one. */ | |
45 | #ifndef GCC_DIAG_STYLE | |
46 | #define GCC_DIAG_STYLE __gcc_tdiag__ | |
47 | #endif | |
48 | /* None of these functions are suitable for ATTRIBUTE_PRINTF, because | |
49 | each language front end can extend them with its own set of format | |
50 | specifiers. We must use custom format checks. */ | |
b2b29377 | 51 | #if (CHECKING_P && GCC_VERSION >= 4001) || GCC_VERSION == BUILDING_GCC_VERSION |
1da2ed5f JM |
52 | #define ATTRIBUTE_GCC_DIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m) |
53 | #else | |
54 | #define ATTRIBUTE_GCC_DIAG(m, n) ATTRIBUTE_NONNULL(m) | |
55 | #endif | |
56 | extern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2) | |
57 | ATTRIBUTE_NORETURN; | |
b55f40c1 JJ |
58 | extern void internal_error_no_backtrace (const char *, ...) |
59 | ATTRIBUTE_GCC_DIAG(1,2) ATTRIBUTE_NORETURN; | |
1da2ed5f JM |
60 | /* Pass one of the OPT_W* from options.h as the first parameter. */ |
61 | extern bool warning (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); | |
26e82579 JH |
62 | extern bool warning_n (location_t, int, int, const char *, const char *, ...) |
63 | ATTRIBUTE_GCC_DIAG(4,6) ATTRIBUTE_GCC_DIAG(5,6); | |
64a5912c DM |
64 | extern bool warning_n (rich_location *, int, int, const char *, |
65 | const char *, ...) | |
66 | ATTRIBUTE_GCC_DIAG(4, 6) ATTRIBUTE_GCC_DIAG(5, 6); | |
1da2ed5f JM |
67 | extern bool warning_at (location_t, int, const char *, ...) |
68 | ATTRIBUTE_GCC_DIAG(3,4); | |
64a5912c | 69 | extern bool warning_at (rich_location *, int, const char *, ...) |
8a645150 | 70 | ATTRIBUTE_GCC_DIAG(3,4); |
1da2ed5f JM |
71 | extern void error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); |
72 | extern void error_n (location_t, int, const char *, const char *, ...) | |
73 | ATTRIBUTE_GCC_DIAG(3,5) ATTRIBUTE_GCC_DIAG(4,5); | |
74 | extern void error_at (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); | |
64a5912c | 75 | extern void error_at (rich_location *, const char *, ...) |
8a645150 | 76 | ATTRIBUTE_GCC_DIAG(2,3); |
3d00119c AB |
77 | extern void fatal_error (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3) |
78 | ATTRIBUTE_NORETURN; | |
1da2ed5f JM |
79 | /* Pass one of the OPT_W* from options.h as the second parameter. */ |
80 | extern bool pedwarn (location_t, int, const char *, ...) | |
81 | ATTRIBUTE_GCC_DIAG(3,4); | |
64a5912c | 82 | extern bool pedwarn (rich_location *, int, const char *, ...) |
1a4f11c8 | 83 | ATTRIBUTE_GCC_DIAG(3,4); |
1da2ed5f | 84 | extern bool permerror (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); |
64a5912c | 85 | extern bool permerror (rich_location *, const char *, |
8a645150 | 86 | ...) ATTRIBUTE_GCC_DIAG(2,3); |
1da2ed5f JM |
87 | extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); |
88 | extern void inform (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); | |
64a5912c | 89 | extern void inform (rich_location *, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); |
1da2ed5f JM |
90 | extern void inform_n (location_t, int, const char *, const char *, ...) |
91 | ATTRIBUTE_GCC_DIAG(3,5) ATTRIBUTE_GCC_DIAG(4,5); | |
92 | extern void verbatim (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); | |
93 | extern bool emit_diagnostic (diagnostic_t, location_t, int, | |
94 | const char *, ...) ATTRIBUTE_GCC_DIAG(4,5); | |
296c53ac MP |
95 | extern bool emit_diagnostic_valist (diagnostic_t, location_t, int, const char *, |
96 | va_list *) ATTRIBUTE_GCC_DIAG (4,0); | |
1da2ed5f JM |
97 | extern bool seen_error (void); |
98 | ||
99 | #ifdef BUFSIZ | |
100 | /* N.B. Unlike all the others, fnotice is just gettext+fprintf, and | |
101 | therefore it can have ATTRIBUTE_PRINTF. */ | |
102 | extern void fnotice (FILE *, const char *, ...) | |
103 | ATTRIBUTE_PRINTF_2; | |
104 | #endif | |
105 | ||
106 | #endif /* ! GCC_DIAGNOSTIC_CORE_H */ |