1 /* b-complain.h --- various ways of writing to standard error
2 
3    Copyright (C) 2010-2020 Thien-Thi Nguyen
4 
5    This file is part of GNU RCS.
6 
7    GNU RCS is free software: you can redistribute it and/or modify it
8    under the terms of the GNU General Public License as published by
9    the Free Software Foundation, either version 3 of the License, or
10    (at your option) any later version.
11 
12    GNU RCS is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty
14    of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15    See the GNU General Public License for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 /* Usually, complaints precede a failureful exit.  */
22 #include "exitfail.h"
23 
24 extern void unbuffer_standard_error (void);
25 extern void vcomplain (char const *fmt, va_list args)
26   ALL_NONNULL;
27 extern void complain (char const *fmt, ...)
28   ARG_NONNULL ((1))
29   printf_string (1, 2);
30 extern void diagnose (char const *fmt, ...)
31   ARG_NONNULL ((1))
32   printf_string (1, 2);
33 extern void syserror (int e, char const *who)
34   ALL_NONNULL;
35 extern void generic_warn (char const *who, char const *fmt, ...)
36   ARG_NONNULL ((2))
37   printf_string (2, 3);
38 extern void generic_error (char const *who, char const *fmt, ...)
39   ARG_NONNULL ((2))
40   printf_string (2, 3);
41 exiting
42 extern void generic_fatal (char const *who, char const *fmt, ...)
43   ARG_NONNULL ((2))
44   printf_string (2, 3);
45 exiting
46 extern void fatal_syntax (size_t lno, char const *fmt, ...)
47   ARG_NONNULL ((2))
48   printf_string (2, 3);
49 exiting
50 extern void fatal_sys (char const *who)
51   ALL_NONNULL;
52 
53 /* Idioms.  Here, prefix P stands for "program" (general operation);
54    M for "manifestation"; R for "repository".  */
55 
56 #define syserror_errno(who)  syserror (errno, who)
57 
58 #define PWARN(...)     generic_warn (NULL, __VA_ARGS__)
59 #define MWARN(...)     generic_warn (MANI (filename), __VA_ARGS__)
60 #define RWARN(...)     generic_warn (REPO (filename), __VA_ARGS__)
61 
62 #define PERR(...)      generic_error (NULL, __VA_ARGS__)
63 #define MERR(...)      generic_error (MANI (filename), __VA_ARGS__)
64 #define RERR(...)      generic_error (REPO (filename), __VA_ARGS__)
65 
66 #define PFATAL(...)    generic_fatal (NULL, __VA_ARGS__)
67 #define RFATAL(...)    generic_fatal (REPO (filename), __VA_ARGS__)
68 
69 #define SYNTAX_ERROR(...)  fatal_syntax (0, __VA_ARGS__)
70 
71 /* b-complain.h ends here */
72