]>
git.ipfire.org Git - thirdparty/glibc.git/blob - support/check.h
1 /* Macros for reporting test results.
2 Copyright (C) 2016 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library 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 GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 #ifndef SUPPORT_CHECK_H
20 #define SUPPORT_CHECK_H
22 #include <sys/cdefs.h>
26 /* Print failure message to standard output and return 1. */
27 #define FAIL_RET(...) \
28 return support_print_failure_impl (__FILE__, __LINE__, __VA_ARGS__)
30 /* Print failure message and terminate the process with STATUS. */
31 #define FAIL_EXIT(status, ...) \
32 support_exit_failure_impl (status, __FILE__, __LINE__, __VA_ARGS__)
34 /* Print failure message and terminate with exit status 1. */
35 #define FAIL_EXIT1(...) \
36 support_exit_failure_impl (1, __FILE__, __LINE__, __VA_ARGS__)
38 int support_print_failure_impl (const char *file
, int line
,
39 const char *format
, ...)
40 __attribute__ ((nonnull (1), format (printf
, 3, 4)));
41 void support_exit_failure_impl (int exit_status
,
42 const char *file
, int line
,
43 const char *format
, ...)
44 __attribute__ ((noreturn
, nonnull (2), format (printf
, 4, 5)));
49 #endif /* SUPPORT_CHECK_H */