adamdunkels | 1e45c6d | 2003-09-02 21:47:27 +0000 | [diff] [blame] | 1 | /** |
| 2 | * \file |
| 3 | * Default definitions of C compiler quirk work-arounds. |
| 4 | * \author Adam Dunkels <adam@dunkels.com> |
| 5 | * |
| 6 | * This file is used for making use of extra functionality of some C |
| 7 | * compilers used for Contiki, and defining work-arounds for various |
| 8 | * quirks and problems with some other C compilers. |
| 9 | */ |
| 10 | |
adamdunkels | e25fbf2 | 2003-04-05 12:14:09 +0000 | [diff] [blame] | 11 | /* |
| 12 | * Copyright (c) 2003, Adam Dunkels. |
| 13 | * All rights reserved. |
| 14 | * |
| 15 | * Redistribution and use in source and binary forms, with or without |
| 16 | * modification, are permitted provided that the following conditions |
| 17 | * are met: |
| 18 | * 1. Redistributions of source code must retain the above copyright |
| 19 | * notice, this list of conditions and the following disclaimer. |
| 20 | * 2. Redistributions in binary form must reproduce the above |
| 21 | * copyright notice, this list of conditions and the following |
| 22 | * disclaimer in the documentation and/or other materials provided |
| 23 | * with the distribution. |
adamdunkels | 1e45c6d | 2003-09-02 21:47:27 +0000 | [diff] [blame] | 24 | * 3. The name of the author may not be used to endorse or promote |
adamdunkels | e25fbf2 | 2003-04-05 12:14:09 +0000 | [diff] [blame] | 25 | * products derived from this software without specific prior |
| 26 | * written permission. |
| 27 | * |
| 28 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS |
| 29 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 30 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 31 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| 32 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
| 34 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 35 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 36 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 37 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 38 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 39 | * |
| 40 | * This file is part of the Contiki desktop OS |
| 41 | * |
adamdunkels | dd780b2 | 2004-03-02 20:45:57 +0000 | [diff] [blame^] | 42 | * $Id: cc.h,v 1.5 2004/03/02 20:45:57 adamdunkels Exp $ |
adamdunkels | e25fbf2 | 2003-04-05 12:14:09 +0000 | [diff] [blame] | 43 | * |
| 44 | */ |
| 45 | #ifndef __CC_H__ |
| 46 | #define __CC_H__ |
| 47 | |
| 48 | #include "cc-conf.h" |
| 49 | |
adamdunkels | 1e45c6d | 2003-09-02 21:47:27 +0000 | [diff] [blame] | 50 | /** |
| 51 | * Configure if the C compiler supports the "register" keyword for |
| 52 | * function arguments. |
| 53 | */ |
adamdunkels | e25fbf2 | 2003-04-05 12:14:09 +0000 | [diff] [blame] | 54 | #if CC_CONF_REGISTER_ARGS |
| 55 | #define CC_REGISTER_ARG register |
| 56 | #else /* CC_CONF_REGISTER_ARGS */ |
| 57 | #define CC_REGISTER_ARG |
| 58 | #endif /* CC_CONF_REGISTER_ARGS */ |
| 59 | |
adamdunkels | 1e45c6d | 2003-09-02 21:47:27 +0000 | [diff] [blame] | 60 | /** |
| 61 | * Configure if the C compiler supports the arguments for function |
| 62 | * pointers. |
| 63 | */ |
adamdunkels | 78c03dc | 2003-04-09 13:45:05 +0000 | [diff] [blame] | 64 | #if CC_CONF_FUNCTION_POINTER_ARGS |
| 65 | #define CC_FUNCTION_POINTER_ARGS 1 |
| 66 | #else /* CC_CONF_FUNCTION_POINTER_ARGS */ |
| 67 | #define CC_FUNCTION_POINTER_ARGS 0 |
| 68 | #endif /* CC_CONF_FUNCTION_POINTER_ARGS */ |
| 69 | |
adamdunkels | 1e45c6d | 2003-09-02 21:47:27 +0000 | [diff] [blame] | 70 | /** |
| 71 | * Configure if the C compiler supports fastcall function |
| 72 | * declarations. |
| 73 | */ |
adamdunkels | e25fbf2 | 2003-04-05 12:14:09 +0000 | [diff] [blame] | 74 | #ifdef CC_CONF_FASTCALL |
| 75 | #define CC_FASTCALL CC_CONF_FASTCALL |
| 76 | #else /* CC_CONF_FASTCALL */ |
| 77 | #define CC_FASTCALL |
| 78 | #endif /* CC_CONF_FASTCALL */ |
| 79 | |
adamdunkels | 1e45c6d | 2003-09-02 21:47:27 +0000 | [diff] [blame] | 80 | /** |
| 81 | * Configure work-around for unsigned char bugs with sdcc. |
| 82 | */ |
adamdunkels | 78c03dc | 2003-04-09 13:45:05 +0000 | [diff] [blame] | 83 | #if CC_CONF_UNSIGNED_CHAR_BUGS |
| 84 | #define CC_UNSIGNED_CHAR_BUGS 1 |
| 85 | #else /* CC_CONF_UNSIGNED_CHAR_BUGS */ |
| 86 | #define CC_UNSIGNED_CHAR_BUGS 0 |
| 87 | #endif /* CC_CONF_UNSIGNED_CHAR_BUGS */ |
| 88 | |
adamdunkels | 0f41361 | 2004-02-24 09:56:06 +0000 | [diff] [blame] | 89 | /** |
| 90 | * Configure if C compiler supports double hash marks in C macros. |
| 91 | */ |
| 92 | #if CC_CONF_DOUBLE_HASH |
| 93 | #define CC_DOUBLE_HASH 1 |
| 94 | #else /* CC_CONF_DOUBLE_HASH */ |
| 95 | #define CC_DOUBLE_HASH 0 |
| 96 | #endif /* CC_CONF_DOUBLE_HASH */ |
| 97 | |
adamdunkels | dd780b2 | 2004-03-02 20:45:57 +0000 | [diff] [blame^] | 98 | #ifndef NULL |
| 99 | #define NULL (void *)0 |
| 100 | #endif /* NULL */ |
adamdunkels | e25fbf2 | 2003-04-05 12:14:09 +0000 | [diff] [blame] | 101 | #endif /* __CC_H__ */ |
| 102 | |