xref: /freebsd/contrib/libarchive/libarchive_fe/err.h (revision b9128a37faafede823eb456aa65a11ac69997284)
1caf54c4fSMartin Matuska /*-
2caf54c4fSMartin Matuska  * Copyright (c) 2009 Joerg Sonnenberger
3caf54c4fSMartin Matuska  * All rights reserved.
4caf54c4fSMartin Matuska  *
5caf54c4fSMartin Matuska  * Redistribution and use in source and binary forms, with or without
6caf54c4fSMartin Matuska  * modification, are permitted provided that the following conditions
7caf54c4fSMartin Matuska  * are met:
8caf54c4fSMartin Matuska  * 1. Redistributions of source code must retain the above copyright
9caf54c4fSMartin Matuska  *    notice, this list of conditions and the following disclaimer.
10caf54c4fSMartin Matuska  * 2. Redistributions in binary form must reproduce the above copyright
11caf54c4fSMartin Matuska  *    notice, this list of conditions and the following disclaimer in the
12caf54c4fSMartin Matuska  *    documentation and/or other materials provided with the distribution.
13caf54c4fSMartin Matuska  *
14caf54c4fSMartin Matuska  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15caf54c4fSMartin Matuska  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16caf54c4fSMartin Matuska  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17caf54c4fSMartin Matuska  * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18caf54c4fSMartin Matuska  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19caf54c4fSMartin Matuska  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20caf54c4fSMartin Matuska  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21caf54c4fSMartin Matuska  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22caf54c4fSMartin Matuska  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23caf54c4fSMartin Matuska  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24457fe389SMartin Matuska  *
25457fe389SMartin Matuska  * $FreeBSD$
26caf54c4fSMartin Matuska  */
27caf54c4fSMartin Matuska 
28caf54c4fSMartin Matuska #ifndef LAFE_ERR_H
29caf54c4fSMartin Matuska #define LAFE_ERR_H
30caf54c4fSMartin Matuska 
31caf54c4fSMartin Matuska #if defined(__GNUC__) && (__GNUC__ > 2 || \
32caf54c4fSMartin Matuska 						  (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
33*b9128a37SMartin Matuska #define __LA_NORETURN __attribute__((__noreturn__))
34*b9128a37SMartin Matuska #elif defined(_MSC_VER)
35*b9128a37SMartin Matuska #define __LA_NORETURN __declspec(noreturn)
36caf54c4fSMartin Matuska #else
37*b9128a37SMartin Matuska #define __LA_NORETURN
38caf54c4fSMartin Matuska #endif
39caf54c4fSMartin Matuska 
40fd082e96SMartin Matuska #if defined(__GNUC__) && (__GNUC__ > 2 || \
41fd082e96SMartin Matuska 			  (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
42f9762417SMartin Matuska # ifdef __MINGW_PRINTF_FORMAT
43f9762417SMartin Matuska #  define __LA_PRINTF_FORMAT __MINGW_PRINTF_FORMAT
44f9762417SMartin Matuska # else
45f9762417SMartin Matuska #  define __LA_PRINTF_FORMAT __printf__
46f9762417SMartin Matuska # endif
47f9762417SMartin Matuska # define __LA_PRINTFLIKE(f,a)	__attribute__((__format__(__LA_PRINTF_FORMAT, f, a)))
48fd082e96SMartin Matuska #else
49fd082e96SMartin Matuska # define __LA_PRINTFLIKE(f,a)
50fd082e96SMartin Matuska #endif
51fd082e96SMartin Matuska 
52fd082e96SMartin Matuska void	lafe_warnc(int code, const char *fmt, ...) __LA_PRINTFLIKE(2, 3);
53*b9128a37SMartin Matuska __LA_NORETURN void	lafe_errc(int eval, int code, const char *fmt, ...) __LA_PRINTFLIKE(3, 4);
54caf54c4fSMartin Matuska 
55cdf63a70SMartin Matuska const char *	lafe_getprogname(void);
56cdf63a70SMartin Matuska void		lafe_setprogname(const char *name, const char *defaultname);
57cdf63a70SMartin Matuska 
58caf54c4fSMartin Matuska #endif
59