diagnostic-core.h revision 1.4
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-2016 Free Software Foundation, Inc. 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 "bversion.h" 26 27/* Constants used to discriminate diagnostics. */ 28typedef enum 29{ 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; 38 39extern const char *progname; 40 41extern 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. */ 51#if (CHECKING_P && GCC_VERSION >= 4001) || GCC_VERSION == BUILDING_GCC_VERSION 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 56extern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2) 57 ATTRIBUTE_NORETURN; 58extern void internal_error_no_backtrace (const char *, ...) 59 ATTRIBUTE_GCC_DIAG(1,2) ATTRIBUTE_NORETURN; 60/* Pass one of the OPT_W* from options.h as the first parameter. */ 61extern bool warning (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); 62extern bool warning_n (location_t, int, int, const char *, const char *, ...) 63 ATTRIBUTE_GCC_DIAG(4,6) ATTRIBUTE_GCC_DIAG(5,6); 64extern bool warning_at (location_t, int, const char *, ...) 65 ATTRIBUTE_GCC_DIAG(3,4); 66extern bool warning_at_rich_loc (rich_location *, int, const char *, ...) 67 ATTRIBUTE_GCC_DIAG(3,4); 68extern void error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); 69extern void error_n (location_t, int, const char *, const char *, ...) 70 ATTRIBUTE_GCC_DIAG(3,5) ATTRIBUTE_GCC_DIAG(4,5); 71extern void error_at (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); 72extern void error_at_rich_loc (rich_location *, const char *, ...) 73 ATTRIBUTE_GCC_DIAG(2,3); 74extern void fatal_error (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3) 75 ATTRIBUTE_NORETURN; 76/* Pass one of the OPT_W* from options.h as the second parameter. */ 77extern bool pedwarn (location_t, int, const char *, ...) 78 ATTRIBUTE_GCC_DIAG(3,4); 79extern bool permerror (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); 80extern bool permerror_at_rich_loc (rich_location *, const char *, 81 ...) ATTRIBUTE_GCC_DIAG(2,3); 82extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); 83extern void inform (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); 84extern void inform_at_rich_loc (rich_location *, const char *, 85 ...) ATTRIBUTE_GCC_DIAG(2,3); 86extern void inform_n (location_t, int, const char *, const char *, ...) 87 ATTRIBUTE_GCC_DIAG(3,5) ATTRIBUTE_GCC_DIAG(4,5); 88extern void verbatim (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); 89extern bool emit_diagnostic (diagnostic_t, location_t, int, 90 const char *, ...) ATTRIBUTE_GCC_DIAG(4,5); 91extern bool seen_error (void); 92 93#ifdef BUFSIZ 94 /* N.B. Unlike all the others, fnotice is just gettext+fprintf, and 95 therefore it can have ATTRIBUTE_PRINTF. */ 96extern void fnotice (FILE *, const char *, ...) 97 ATTRIBUTE_PRINTF_2; 98#endif 99 100#endif /* ! GCC_DIAGNOSTIC_CORE_H */ 101