00001 /** 00002 * \file 00003 * Default definitions of C compiler quirk work-arounds. 00004 * \author Adam Dunkels <adam@dunkels.com> 00005 * 00006 * This file is used for making use of extra functionality of some C 00007 * compilers used for Contiki, and defining work-arounds for various 00008 * quirks and problems with some other C compilers. 00009 */ 00010 00011 /* 00012 * Copyright (c) 2003, Adam Dunkels. 00013 * All rights reserved. 00014 * 00015 * Redistribution and use in source and binary forms, with or without 00016 * modification, are permitted provided that the following conditions 00017 * are met: 00018 * 1. Redistributions of source code must retain the above copyright 00019 * notice, this list of conditions and the following disclaimer. 00020 * 2. Redistributions in binary form must reproduce the above 00021 * copyright notice, this list of conditions and the following 00022 * disclaimer in the documentation and/or other materials provided 00023 * with the distribution. 00024 * 3. The name of the author may not be used to endorse or promote 00025 * products derived from this software without specific prior 00026 * written permission. 00027 * 00028 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 00029 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00030 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00031 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 00032 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00033 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 00034 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00035 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00036 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00037 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00038 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00039 * 00040 * This file is part of the Contiki desktop OS 00041 * 00042 * $Id: cc.h,v 1.1 2006/06/17 22:41:20 adamdunkels Exp $ 00043 * 00044 */ 00045 #ifndef __CC_H__ 00046 #define __CC_H__ 00047 00048 #include "contiki-conf.h" 00049 00050 /** 00051 * Configure if the C compiler supports the "register" keyword for 00052 * function arguments. 00053 */ 00054 #if CC_CONF_REGISTER_ARGS 00055 #define CC_REGISTER_ARG register 00056 #else /* CC_CONF_REGISTER_ARGS */ 00057 #define CC_REGISTER_ARG 00058 #endif /* CC_CONF_REGISTER_ARGS */ 00059 00060 /** 00061 * Configure if the C compiler supports the arguments for function 00062 * pointers. 00063 */ 00064 #if CC_CONF_FUNCTION_POINTER_ARGS 00065 #define CC_FUNCTION_POINTER_ARGS 1 00066 #else /* CC_CONF_FUNCTION_POINTER_ARGS */ 00067 #define CC_FUNCTION_POINTER_ARGS 0 00068 #endif /* CC_CONF_FUNCTION_POINTER_ARGS */ 00069 00070 /** 00071 * Configure if the C compiler supports fastcall function 00072 * declarations. 00073 */ 00074 #ifdef CC_CONF_FASTCALL 00075 #define CC_FASTCALL CC_CONF_FASTCALL 00076 #else /* CC_CONF_FASTCALL */ 00077 #define CC_FASTCALL 00078 #endif /* CC_CONF_FASTCALL */ 00079 00080 /** 00081 * Configure work-around for unsigned char bugs with sdcc. 00082 */ 00083 #if CC_CONF_UNSIGNED_CHAR_BUGS 00084 #define CC_UNSIGNED_CHAR_BUGS 1 00085 #else /* CC_CONF_UNSIGNED_CHAR_BUGS */ 00086 #define CC_UNSIGNED_CHAR_BUGS 0 00087 #endif /* CC_CONF_UNSIGNED_CHAR_BUGS */ 00088 00089 /** 00090 * Configure if C compiler supports double hash marks in C macros. 00091 */ 00092 #if CC_CONF_DOUBLE_HASH 00093 #define CC_DOUBLE_HASH 1 00094 #else /* CC_CONF_DOUBLE_HASH */ 00095 #define CC_DOUBLE_HASH 0 00096 #endif /* CC_CONF_DOUBLE_HASH */ 00097 00098 #ifdef CC_CONF_INLINE 00099 #define CC_INLINE CC_CONF_INLINE 00100 #else /* CC_CONF_INLINE */ 00101 #define CC_INLINE 00102 #endif /* CC_CONF_INLINE */ 00103 00104 #if CC_CONF_NO_VA_ARGS 00105 #define CC_NO_VA_ARGS CC_CONF_VA_ARGS 00106 #endif 00107 00108 #ifndef NULL 00109 #define NULL 0 00110 #endif /* NULL */ 00111 #endif /* __CC_H__ */