1 /* Declaration for error-reporting function for Bison.
3 Copyright (C) 2000-2002, 2006, 2009-2013 Free Software Foundation,
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 # define COMPLAIN_H_ 1
22 # include "location.h"
24 /* Sub-messages indent. */
25 # define SUB_INDENT (4)
31 /** The bits assigned to each warning type. */
34 warning_midrule_values
, /**< Unset or unused midrule values. */
35 warning_yacc
, /**< POSIXME. */
36 warning_conflicts_sr
, /**< S/R conflicts. */
37 warning_conflicts_rr
, /**< R/R conflicts. */
38 warning_deprecated
, /**< Obsolete constructs. */
39 warning_precedence
, /**< Useless precedence and associativity. */
40 warning_other
, /**< All other warnings. */
42 warnings_size
/**< The number of warnings. Must be last. */
47 /**< Issue no warnings. */
50 Wmidrule_values
= 1 << warning_midrule_values
,
51 Wyacc
= 1 << warning_yacc
,
52 Wconflicts_sr
= 1 << warning_conflicts_sr
,
53 Wconflicts_rr
= 1 << warning_conflicts_rr
,
54 Wdeprecated
= 1 << warning_deprecated
,
55 Wprecedence
= 1 << warning_precedence
,
56 Wother
= 1 << warning_other
,
58 Werror
= 1 << 10, /** This bit is no longer used. */
60 complaint
= 1 << 11, /**< All complaints. */
61 fatal
= 1 << 12, /**< All fatal errors. */
62 silent
= 1 << 13, /**< Do not display the warning type. */
63 no_caret
= 1 << 14, /**< Do not display caret location. */
65 /**< All above warnings. */
66 Wall
= ~complaint
& ~fatal
& ~silent
70 /** For each warning type, its severity. */
73 severity_disabled
= 0,
80 /** Whether -Werror was set. */
81 extern bool warnings_are_errors
;
83 /** For each warning type, its severity. */
84 extern severity warnings_flag
[];
86 /** Initialize this module. */
87 void complain_init (void);
89 /** Make a complaint, with maybe a location. */
90 void complain (location
const *loc
, warnings flags
, char const *message
, ...)
91 __attribute__ ((__format__ (__printf__
, 3, 4)));
93 /** Likewise, but with an \a argc/argv interface. */
94 void complain_args (location
const *loc
, warnings w
, unsigned *indent
,
95 int argc
, char *arg
[]);
97 /** Make a complaint with location and some indentation. */
98 void complain_indent (location
const *loc
, warnings flags
, unsigned *indent
,
99 char const *message
, ...)
100 __attribute__ ((__format__ (__printf__
, 4, 5)));
103 /** Report an obsolete syntax, suggest the updated one. */
104 void deprecated_directive (location
const *loc
,
105 char const *obsolete
, char const *updated
);
107 /** Warnings treated as errors shouldn't stop the execution as regular errors
108 should (because due to their nature, it is safe to go on). Thus, there are
109 three possible execution statuses. */
113 status_warning_as_error
,
117 /** Whether an error was reported. */
118 extern err_status complaint_status
;
120 #endif /* !COMPLAIN_H_ */