1299425Smm/*-
2299425Smm * Copyright (c) 2003-2007 Tim Kientzle
3299425Smm * All rights reserved.
4299425Smm *
5299425Smm * Redistribution and use in source and binary forms, with or without
6299425Smm * modification, are permitted provided that the following conditions
7299425Smm * are met:
8299425Smm * 1. Redistributions of source code must retain the above copyright
9299425Smm *    notice, this list of conditions and the following disclaimer.
10299425Smm * 2. Redistributions in binary form must reproduce the above copyright
11299425Smm *    notice, this list of conditions and the following disclaimer in the
12299425Smm *    documentation and/or other materials provided with the distribution.
13299425Smm *
14299425Smm * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15299425Smm * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16299425Smm * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17299425Smm * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18299425Smm * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19299425Smm * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20299425Smm * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21299425Smm * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22299425Smm * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23299425Smm * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24299425Smm *
25299425Smm * $FreeBSD: releng/11.0/contrib/libarchive/cat/bsdcat_platform.h 299425 2016-05-11 10:19:44Z mm $
26299425Smm */
27299425Smm
28299425Smm/*
29299425Smm * This header is the first thing included in any of the bsdtar
30299425Smm * source files.  As far as possible, platform-specific issues should
31299425Smm * be dealt with here and not within individual source files.
32299425Smm */
33299425Smm
34299425Smm#ifndef BSDCAT_PLATFORM_H_INCLUDED
35299425Smm#define	BSDCAT_PLATFORM_H_INCLUDED
36299425Smm
37299425Smm#if defined(PLATFORM_CONFIG_H)
38299425Smm/* Use hand-built config.h in environments that need it. */
39299425Smm#include PLATFORM_CONFIG_H
40299425Smm#else
41299425Smm/* Not having a config.h of some sort is a serious problem. */
42299425Smm#include "config.h"
43299425Smm#endif
44299425Smm
45299425Smm/* Get a real definition for __FBSDID if we can */
46299425Smm#if HAVE_SYS_CDEFS_H
47299425Smm#include <sys/cdefs.h>
48299425Smm#endif
49299425Smm
50299425Smm/* If not, define it so as to avoid dangling semicolons. */
51299425Smm#ifndef __FBSDID
52299425Smm#define	__FBSDID(a)     struct _undefined_hack
53299425Smm#endif
54299425Smm
55299425Smm#ifdef HAVE_LIBARCHIVE
56299425Smm/* If we're using the platform libarchive, include system headers. */
57299425Smm#include <archive.h>
58299425Smm#include <archive_entry.h>
59299425Smm#else
60299425Smm/* Otherwise, include user headers. */
61299425Smm#include "archive.h"
62299425Smm#include "archive_entry.h"
63299425Smm#endif
64299425Smm
65299425Smm/* How to mark functions that don't return. */
66299425Smm/* This facilitates use of some newer static code analysis tools. */
67299425Smm#undef __LA_DEAD
68299425Smm#if defined(__GNUC__) && (__GNUC__ > 2 || \
69299425Smm			  (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
70299425Smm#define	__LA_DEAD	__attribute__((__noreturn__))
71299425Smm#else
72299425Smm#define	__LA_DEAD
73299425Smm#endif
74299425Smm
75299425Smm#endif /* !BSDCAT_PLATFORM_H_INCLUDED */
76