xref: /freebsd/contrib/libarchive/cat/bsdcat_platform.h (revision bd66c1b43e33540205dbc1187c2f2a15c58b57ba)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2003-2007 Tim Kientzle
5  * All rights reserved.
6  */
7 
8 /*
9  * This header is the first thing included in any of the bsdtar
10  * source files.  As far as possible, platform-specific issues should
11  * be dealt with here and not within individual source files.
12  */
13 
14 #ifndef BSDCAT_PLATFORM_H_INCLUDED
15 #define	BSDCAT_PLATFORM_H_INCLUDED
16 
17 #if defined(PLATFORM_CONFIG_H)
18 /* Use hand-built config.h in environments that need it. */
19 #include PLATFORM_CONFIG_H
20 #else
21 /* Not having a config.h of some sort is a serious problem. */
22 #include "config.h"
23 #endif
24 
25 #ifdef HAVE_LIBARCHIVE
26 /* If we're using the platform libarchive, include system headers. */
27 #include <archive.h>
28 #include <archive_entry.h>
29 #else
30 /* Otherwise, include user headers. */
31 #include "archive.h"
32 #include "archive_entry.h"
33 #endif
34 
35 /* How to mark functions that don't return. */
36 /* This facilitates use of some newer static code analysis tools. */
37 #undef __LA_NORETURN
38 #if defined(__GNUC__) && (__GNUC__ > 2 || \
39                           (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
40 #define __LA_NORETURN       __attribute__((__noreturn__))
41 #elif defined(_MSC_VER)
42 #define __LA_NORETURN __declspec(noreturn)
43 #else
44 #define __LA_NORETURN
45 #endif
46 
47 #endif /* !BSDCAT_PLATFORM_H_INCLUDED */
48