/*- * 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.2 2006/03/22 23:33:54 simon Exp $ */ #include #if __FreeBSD_version < 500000 #if !defined(__GNUC__) && !defined(lint) # warning compat.h was tested only with GCC #endif #include #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 # if __FreeBSD_version >= 320000 # define PRIu64 "llu" # else # define PRIu64 "qu" # endif #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 architecture." #endif /* i386 || alpha */ #else /* __FreeBSD_version >= 500000 */ #include #include #include # define ATTR_UNUSED __unused # define ATTR_PRINTFLIKE(x, y) __printflike(x, y) #endif /* __FreeBSD_version < 500000 */