PR C++/88114 Gen destructor of an abstract class
[official-gcc.git] / gcc / diagnostic-core.h
blobefafde4fa24a4046dc91b90e37f44a3f819736b8
1 /* Declarations of core diagnostic functionality for code that does
2 not need to deal with diagnostic contexts or diagnostic info
3 structures.
4 Copyright (C) 1998-2019 Free Software Foundation, Inc.
6 This file is part of GCC.
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.
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.
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/>. */
22 #ifndef GCC_DIAGNOSTIC_CORE_H
23 #define GCC_DIAGNOSTIC_CORE_H
25 #include "bversion.h"
27 /* Constants used to discriminate diagnostics. */
28 typedef enum
30 #define DEFINE_DIAGNOSTIC_KIND(K, msgid, C) K,
31 #include "diagnostic.def"
32 #undef DEFINE_DIAGNOSTIC_KIND
33 DK_LAST_DIAGNOSTIC_KIND,
34 /* This is used for tagging pragma pops in the diagnostic
35 classification history chain. */
36 DK_POP
37 } diagnostic_t;
39 /* RAII-style class for grouping related diagnostics. */
41 class auto_diagnostic_group
43 public:
44 auto_diagnostic_group ();
45 ~auto_diagnostic_group ();
48 extern const char *progname;
50 extern const char *trim_filename (const char *);
52 /* If we haven't already defined a front-end-specific diagnostics
53 style, use the generic one. */
54 #ifndef GCC_DIAG_STYLE
55 #define GCC_DIAG_STYLE __gcc_tdiag__
56 #endif
57 /* None of these functions are suitable for ATTRIBUTE_PRINTF, because
58 each language front end can extend them with its own set of format
59 specifiers. We must use custom format checks. */
60 #if (CHECKING_P && GCC_VERSION >= 4001) || GCC_VERSION == BUILDING_GCC_VERSION
61 #define ATTRIBUTE_GCC_DIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
62 #else
63 #define ATTRIBUTE_GCC_DIAG(m, n) ATTRIBUTE_NONNULL(m)
64 #endif
65 extern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
66 ATTRIBUTE_NORETURN;
67 extern void internal_error_no_backtrace (const char *, ...)
68 ATTRIBUTE_GCC_DIAG(1,2) ATTRIBUTE_NORETURN;
69 /* Pass one of the OPT_W* from options.h as the first parameter. */
70 extern bool warning (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
71 extern bool warning_n (location_t, int, unsigned HOST_WIDE_INT,
72 const char *, const char *, ...)
73 ATTRIBUTE_GCC_DIAG(4,6) ATTRIBUTE_GCC_DIAG(5,6);
74 extern bool warning_n (rich_location *, int, unsigned HOST_WIDE_INT,
75 const char *, const char *, ...)
76 ATTRIBUTE_GCC_DIAG(4, 6) ATTRIBUTE_GCC_DIAG(5, 6);
77 extern bool warning_at (location_t, int, const char *, ...)
78 ATTRIBUTE_GCC_DIAG(3,4);
79 extern bool warning_at (rich_location *, int, const char *, ...)
80 ATTRIBUTE_GCC_DIAG(3,4);
81 extern void error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
82 extern void error_n (location_t, unsigned HOST_WIDE_INT, const char *,
83 const char *, ...)
84 ATTRIBUTE_GCC_DIAG(3,5) ATTRIBUTE_GCC_DIAG(4,5);
85 extern void error_at (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
86 extern void error_at (rich_location *, const char *, ...)
87 ATTRIBUTE_GCC_DIAG(2,3);
88 extern void fatal_error (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3)
89 ATTRIBUTE_NORETURN;
90 /* Pass one of the OPT_W* from options.h as the second parameter. */
91 extern bool pedwarn (location_t, int, const char *, ...)
92 ATTRIBUTE_GCC_DIAG(3,4);
93 extern bool pedwarn (rich_location *, int, const char *, ...)
94 ATTRIBUTE_GCC_DIAG(3,4);
95 extern bool permerror (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
96 extern bool permerror (rich_location *, const char *,
97 ...) ATTRIBUTE_GCC_DIAG(2,3);
98 extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
99 extern void sorry_at (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
100 extern void inform (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
101 extern void inform (rich_location *, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
102 extern void inform_n (location_t, unsigned HOST_WIDE_INT, const char *,
103 const char *, ...)
104 ATTRIBUTE_GCC_DIAG(3,5) ATTRIBUTE_GCC_DIAG(4,5);
105 extern void verbatim (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
106 extern bool emit_diagnostic (diagnostic_t, location_t, int,
107 const char *, ...) ATTRIBUTE_GCC_DIAG(4,5);
108 extern bool emit_diagnostic (diagnostic_t, rich_location *, int,
109 const char *, ...) ATTRIBUTE_GCC_DIAG(4,5);
110 extern bool emit_diagnostic_valist (diagnostic_t, location_t, int, const char *,
111 va_list *) ATTRIBUTE_GCC_DIAG (4,0);
112 extern bool seen_error (void);
114 #ifdef BUFSIZ
115 /* N.B. Unlike all the others, fnotice is just gettext+fprintf, and
116 therefore it can have ATTRIBUTE_PRINTF. */
117 extern void fnotice (FILE *, const char *, ...)
118 ATTRIBUTE_PRINTF_2;
119 #endif
121 #endif /* ! GCC_DIAGNOSTIC_CORE_H */