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