/*-
 * Copyright (c) 2004 Andrey Simonenko
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *  @(#)$Id: compat.h,v 1.3 2006/04/26 21:00:43 simon Exp $
 */

#include <osreldate.h>

#if __FreeBSD_version < 500000

#if !defined(__GNUC__) && !defined(lint)
# warning compat.h was tested only with GCC
#endif

#include <inttypes.h>

#ifdef __GNUC__
# define ATTR_UNUSED __attribute__ ((unused))
# define ATTR_PRINTFLIKE(x, y) __attribute__ ((format (printf, x, y)))
#else
# define ATTR_UNUSED
# define ATTR_PRINTFLIKE(x, y)
#endif

#if defined(i386) || defined(__i386) || defined(__i386__)

# define UINT64_C(c)	(c ## ULL)

# define UINT32_MAX	0xffffffffU
# define UINT64_MAX	0xffffffffffffffffULL

/*
 * IPv6 Firewall was introduced in FreeBSD 4.0 and
 * printf(3) in this version accepts %llu.
 */
# define PRIu64		"llu"

#elif defined(alpha) || defined(__alpha) || defined(__alpha__)

# define UINT64_C(c)	(c ## UL)

# define UINT32_MAX	0xffffffffU
# define UINT64_MAX	0xffffffffffffffffUL

# define PRIu64		"lu"

#else /* !i386 && !alpha */

# error "Cannot determine type of your system architecture."

# endif /* i386 || alpha */

#else /* __FreeBSD_version >= 500000 */

#include <stdint.h>
#include <inttypes.h>
#include <sys/cdefs.h>

# define ATTR_UNUSED __unused
# define ATTR_PRINTFLIKE(x, y) __printflike(x, y)

#endif /* __FreeBSD_version < 500000 */


syntax highlighted by Code2HTML, v. 0.9.1