]> git.saurik.com Git - bison.git/blob - src/complain.h
3e028d69dec85cd8e3271b20bdbe389e8e47297c
[bison.git] / src / complain.h
1 /* Declaration for error-reporting function for Bison.
2 Copyright (C) 2000-2002, 2006, 2009-2010 Free Software Foundation,
3 Inc.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17
18 #ifndef COMPLAIN_H_
19 # define COMPLAIN_H_ 1
20
21 # include "location.h"
22
23 # ifdef __cplusplus
24 extern "C" {
25 # endif
26
27 /** Informative messages, but we proceed. */
28
29 void warn (char const *format, ...)
30 __attribute__ ((__format__ (__printf__, 1, 2)));
31
32 void warn_at (location loc, char const *format, ...)
33 __attribute__ ((__format__ (__printf__, 2, 3)));
34
35 /* Generate a message aligned by an indent.
36 When *indent == 0, assign message's indent to *indent,
37 When *indent > 0, align the message by *indent value. */
38 void warn_at_indent (location loc, unsigned *indent,
39 char const *format, ...)
40 __attribute__ ((__format__ (__printf__, 3, 4)));
41
42 /** An error, but we continue and die later. */
43
44 void complain (char const *format, ...)
45 __attribute__ ((__format__ (__printf__, 1, 2)));
46
47 void complain_at (location loc, char const *format, ...)
48 __attribute__ ((__format__ (__printf__, 2, 3)));
49
50 /* Generate a message aligned by an indent.
51 When *indent == 0, assign message's indent to *indent,
52 When *indent > 0, align the message by *indent value. */
53 void complain_at_indent (location loc, unsigned *indent,
54 char const *format, ...)
55 __attribute__ ((__format__ (__printf__, 3, 4)));
56
57 /** An incompatibility with POSIX Yacc: mapped either to warn* or
58 complain* depending on yacc_flag. */
59
60 void yacc_at (location loc, char const *format, ...)
61 __attribute__ ((__format__ (__printf__, 2, 3)));
62
63
64 /** A fatal error, causing immediate exit. */
65
66 void fatal (char const *format, ...)
67 __attribute__ ((__noreturn__, __format__ (__printf__, 1, 2)));
68
69 void fatal_at (location loc, char const *format, ...)
70 __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
71
72 /** Whether an error was reported. */
73 extern bool complaint_issued;
74
75 # ifdef __cplusplus
76 }
77 # endif
78
79 #endif /* !COMPLAIN_H_ */