]> git.saurik.com Git - bison.git/blame - src/complain.h
options: no longer document warnings when diagnosing an invalid -W
[bison.git] / src / complain.h
CommitLineData
a0f6b076 1/* Declaration for error-reporting function for Bison.
7d424de1 2
7d6bad19 3 Copyright (C) 2000-2002, 2006, 2009-2013 Free Software Foundation,
575619af 4 Inc.
a0f6b076 5
f16b0819
PE
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.
a0f6b076
AD
10
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.
15
16 You should have received a copy of the GNU General Public License
f16b0819 17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
a0f6b076
AD
18
19#ifndef COMPLAIN_H_
ee000ba4 20# define COMPLAIN_H_ 1
a0f6b076 21
ee000ba4
AD
22# include "location.h"
23
46bdb8ec 24/* Sub-messages indent. */
a99ec53e 25# define SUB_INDENT (4)
46bdb8ec 26
d0f11c1b
VS
27/*-------------.
28| --warnings. |
29`-------------*/
30
6fb8b256 31typedef enum
d0f11c1b 32 {
b6403170
VS
33 Wnone = 0, /**< Issue no warnings. */
34 Wmidrule_values = 1 << 0, /**< Unset or unused midrule values. */
35 Wyacc = 1 << 1, /**< POSIXME. */
36 Wconflicts_sr = 1 << 2, /**< S/R conflicts. */
37 Wconflicts_rr = 1 << 3, /**< R/R conflicts. */
518e8830 38 Wdeprecated = 1 << 4, /**< Obsolete constructs. */
cc2235ac
VT
39 Wprecedence = 1 << 5, /**< Useless precedence and associativity. */
40
41 Wother = 1 << 6, /**< All other warnings. */
b6403170 42
9503b0a4
TR
43 Werror = 1 << 10, /** This bit is no longer used. */
44
b6403170
VS
45 complaint = 1 << 11, /**< All complaints. */
46 fatal = 1 << 12, /**< All fatal errors. */
47 silent = 1 << 13, /**< Do not display the warning type. */
ea9e670d 48 no_caret = 1 << 14, /**< Do not display caret location. */
9503b0a4
TR
49
50 /**< All above warnings. */
51 Wall = ~complaint & ~fatal & ~silent
6fb8b256 52 } warnings;
d0f11c1b
VS
53
54/** What warnings are issued. */
6fb8b256 55extern warnings warnings_flag;
d0f11c1b 56
9503b0a4
TR
57/** What warnings are made errors. */
58extern warnings errors_flag;
59
b6403170
VS
60/** Display a "[-Wyacc]" like message on stderr. */
61void warnings_print_categories (warnings warn_flags);
62
bb8e56ff 63/** Make a complaint, with maybe a location. */
b999409e 64void complain (location const *loc, warnings flags, char const *message, ...)
66381412
AR
65 __attribute__ ((__format__ (__printf__, 3, 4)));
66
782e8187 67/** Likewise, but with an \a argc/argv interface. */
c6c8de16
TR
68void complain_args (location const *loc, warnings w, unsigned *indent,
69 int argc, char *arg[]);
782e8187 70
6fb8b256 71/** Make a complaint with location and some indentation. */
b999409e
TR
72void complain_indent (location const *loc, warnings flags, unsigned *indent,
73 char const *message, ...)
6fb8b256 74 __attribute__ ((__format__ (__printf__, 4, 5)));
a0f6b076 75
697a8022 76
1dc927a7
AD
77/** Report an obsolete syntax, suggest the updated one. */
78void deprecated_directive (location const *loc,
79 char const *obsolete, char const *updated);
80
697a8022
TR
81/** Warnings treated as errors shouldn't stop the execution as regular errors
82 should (because due to their nature, it is safe to go on). Thus, there are
83 three possible execution statuses. */
84typedef enum
85 {
86 status_none,
87 status_warning_as_error,
88 status_complaint
89 } err_status;
90
23eb2a69 91/** Whether an error was reported. */
697a8022 92extern err_status complaint_status;
a0f6b076 93
a0f6b076 94#endif /* !COMPLAIN_H_ */