]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/diagnostic-core.h
Update copyright years in gcc/
[thirdparty/gcc.git] / gcc / diagnostic-core.h
CommitLineData
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.
23a5b65a 4 Copyright (C) 1998-2014 Free Software Foundation, Inc.
1da2ed5f
JM
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free
10Software Foundation; either version 3, or (at your option) any later
11version.
12
13GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14WARRANTY; without even the implied warranty of MERCHANTABILITY or
15FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16for more details.
17
18You should have received a copy of the GNU General Public License
19along 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
25#include "input.h"
7c475d11 26#include "bversion.h"
1da2ed5f
JM
27
28/* Constants used to discriminate diagnostics. */
29typedef enum
30{
4b84d650 31#define DEFINE_DIAGNOSTIC_KIND(K, msgid, C) K,
1da2ed5f
JM
32#include "diagnostic.def"
33#undef DEFINE_DIAGNOSTIC_KIND
cd7fe53b
DD
34 DK_LAST_DIAGNOSTIC_KIND,
35 /* This is used for tagging pragma pops in the diagnostic
36 classification history chain. */
37 DK_POP
1da2ed5f
JM
38} diagnostic_t;
39
40extern const char *progname;
41
42extern const char *trim_filename (const char *);
43
44/* If we haven't already defined a front-end-specific diagnostics
45 style, use the generic one. */
46#ifndef GCC_DIAG_STYLE
47#define GCC_DIAG_STYLE __gcc_tdiag__
48#endif
49/* None of these functions are suitable for ATTRIBUTE_PRINTF, because
50 each language front end can extend them with its own set of format
51 specifiers. We must use custom format checks. */
52#if (ENABLE_CHECKING && GCC_VERSION >= 4001) || GCC_VERSION == BUILDING_GCC_VERSION
53#define ATTRIBUTE_GCC_DIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
54#else
55#define ATTRIBUTE_GCC_DIAG(m, n) ATTRIBUTE_NONNULL(m)
56#endif
57extern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
58 ATTRIBUTE_NORETURN;
59/* Pass one of the OPT_W* from options.h as the first parameter. */
60extern bool warning (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
61extern bool warning_at (location_t, int, const char *, ...)
62 ATTRIBUTE_GCC_DIAG(3,4);
63extern void error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
64extern void error_n (location_t, int, const char *, const char *, ...)
65 ATTRIBUTE_GCC_DIAG(3,5) ATTRIBUTE_GCC_DIAG(4,5);
66extern void error_at (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
67extern void fatal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
68 ATTRIBUTE_NORETURN;
69/* Pass one of the OPT_W* from options.h as the second parameter. */
70extern bool pedwarn (location_t, int, const char *, ...)
71 ATTRIBUTE_GCC_DIAG(3,4);
72extern bool permerror (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
73extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
74extern void inform (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
75extern void inform_n (location_t, int, const char *, const char *, ...)
76 ATTRIBUTE_GCC_DIAG(3,5) ATTRIBUTE_GCC_DIAG(4,5);
77extern void verbatim (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
78extern bool emit_diagnostic (diagnostic_t, location_t, int,
79 const char *, ...) ATTRIBUTE_GCC_DIAG(4,5);
80extern bool seen_error (void);
81
82#ifdef BUFSIZ
83 /* N.B. Unlike all the others, fnotice is just gettext+fprintf, and
84 therefore it can have ATTRIBUTE_PRINTF. */
85extern void fnotice (FILE *, const char *, ...)
86 ATTRIBUTE_PRINTF_2;
87#endif
88
89#endif /* ! GCC_DIAGNOSTIC_CORE_H */