]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/diagnostic-core.h
[committed] [RISC-V] Don't run new rounding tests on newlib risc-v targets
[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.
a945c346 4 Copyright (C) 1998-2024 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
7c475d11 25#include "bversion.h"
1da2ed5f
JM
26
27/* Constants used to discriminate diagnostics. */
28typedef 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. */
44ba7bcb
LH
36 DK_POP,
37 /* This is used internally to note that a diagnostic is enabled
38 without mandating any specific type. */
39 DK_ANY,
1da2ed5f
JM
40} diagnostic_t;
41
097f82ec
DM
42/* RAII-style class for grouping related diagnostics. */
43
44class auto_diagnostic_group
45{
46 public:
47 auto_diagnostic_group ();
48 ~auto_diagnostic_group ();
49};
50
6d4a35ca
DM
51/* Forward decl. */
52class diagnostic_metadata; /* See diagnostic-metadata.h. */
53
1da2ed5f
JM
54extern const char *progname;
55
56extern const char *trim_filename (const char *);
57
58/* If we haven't already defined a front-end-specific diagnostics
59 style, use the generic one. */
60#ifndef GCC_DIAG_STYLE
61#define GCC_DIAG_STYLE __gcc_tdiag__
62#endif
63/* None of these functions are suitable for ATTRIBUTE_PRINTF, because
64 each language front end can extend them with its own set of format
65 specifiers. We must use custom format checks. */
b2b29377 66#if (CHECKING_P && GCC_VERSION >= 4001) || GCC_VERSION == BUILDING_GCC_VERSION
1da2ed5f
JM
67#define ATTRIBUTE_GCC_DIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
68#else
69#define ATTRIBUTE_GCC_DIAG(m, n) ATTRIBUTE_NONNULL(m)
70#endif
71extern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
72 ATTRIBUTE_NORETURN;
b55f40c1
JJ
73extern void internal_error_no_backtrace (const char *, ...)
74 ATTRIBUTE_GCC_DIAG(1,2) ATTRIBUTE_NORETURN;
1da2ed5f
JM
75/* Pass one of the OPT_W* from options.h as the first parameter. */
76extern bool warning (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
1c89478a
MS
77extern bool warning_n (location_t, int, unsigned HOST_WIDE_INT,
78 const char *, const char *, ...)
26e82579 79 ATTRIBUTE_GCC_DIAG(4,6) ATTRIBUTE_GCC_DIAG(5,6);
1c89478a
MS
80extern bool warning_n (rich_location *, int, unsigned HOST_WIDE_INT,
81 const char *, const char *, ...)
64a5912c 82 ATTRIBUTE_GCC_DIAG(4, 6) ATTRIBUTE_GCC_DIAG(5, 6);
1da2ed5f
JM
83extern bool warning_at (location_t, int, const char *, ...)
84 ATTRIBUTE_GCC_DIAG(3,4);
64a5912c 85extern bool warning_at (rich_location *, int, const char *, ...)
8a645150 86 ATTRIBUTE_GCC_DIAG(3,4);
6c8e5844
DM
87extern bool warning_meta (rich_location *,
88 const diagnostic_metadata &, int,
89 const char *, ...)
6d4a35ca 90 ATTRIBUTE_GCC_DIAG(4,5);
1da2ed5f 91extern void error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
1c89478a
MS
92extern void error_n (location_t, unsigned HOST_WIDE_INT, const char *,
93 const char *, ...)
1da2ed5f
JM
94 ATTRIBUTE_GCC_DIAG(3,5) ATTRIBUTE_GCC_DIAG(4,5);
95extern void error_at (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
64a5912c 96extern void error_at (rich_location *, const char *, ...)
8a645150 97 ATTRIBUTE_GCC_DIAG(2,3);
1ad5ae5a
DM
98extern void error_meta (rich_location *, const diagnostic_metadata &,
99 const char *, ...)
100 ATTRIBUTE_GCC_DIAG(3,4);
3d00119c
AB
101extern void fatal_error (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3)
102 ATTRIBUTE_NORETURN;
1da2ed5f
JM
103/* Pass one of the OPT_W* from options.h as the second parameter. */
104extern bool pedwarn (location_t, int, const char *, ...)
105 ATTRIBUTE_GCC_DIAG(3,4);
64a5912c 106extern bool pedwarn (rich_location *, int, const char *, ...)
1a4f11c8 107 ATTRIBUTE_GCC_DIAG(3,4);
1da2ed5f 108extern bool permerror (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
64a5912c 109extern bool permerror (rich_location *, const char *,
8a645150 110 ...) ATTRIBUTE_GCC_DIAG(2,3);
1ec36bcd
JM
111extern bool permerror_opt (location_t, int, const char *, ...)
112 ATTRIBUTE_GCC_DIAG(3,4);
113extern bool permerror_opt (rich_location *, int, const char *,
114 ...) ATTRIBUTE_GCC_DIAG(3,4);
1da2ed5f 115extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
ad172f72 116extern void sorry_at (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
1da2ed5f 117extern void inform (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
64a5912c 118extern void inform (rich_location *, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
1c89478a
MS
119extern void inform_n (location_t, unsigned HOST_WIDE_INT, const char *,
120 const char *, ...)
1da2ed5f
JM
121 ATTRIBUTE_GCC_DIAG(3,5) ATTRIBUTE_GCC_DIAG(4,5);
122extern void verbatim (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
123extern bool emit_diagnostic (diagnostic_t, location_t, int,
124 const char *, ...) ATTRIBUTE_GCC_DIAG(4,5);
8ba109ce
DM
125extern bool emit_diagnostic (diagnostic_t, rich_location *, int,
126 const char *, ...) ATTRIBUTE_GCC_DIAG(4,5);
296c53ac
MP
127extern bool emit_diagnostic_valist (diagnostic_t, location_t, int, const char *,
128 va_list *) ATTRIBUTE_GCC_DIAG (4,0);
b753ef8f
DM
129extern bool emit_diagnostic_valist_meta (diagnostic_t,
130 rich_location *,
131 const diagnostic_metadata *,
132 int,
133 const char *,
134 va_list *) ATTRIBUTE_GCC_DIAG (5,0);
1da2ed5f
JM
135extern bool seen_error (void);
136
137#ifdef BUFSIZ
138 /* N.B. Unlike all the others, fnotice is just gettext+fprintf, and
139 therefore it can have ATTRIBUTE_PRINTF. */
140extern void fnotice (FILE *, const char *, ...)
141 ATTRIBUTE_PRINTF_2;
142#endif
143
144#endif /* ! GCC_DIAGNOSTIC_CORE_H */