OSDN Git Service

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