konashi/SBBLEのテスト

Dependencies:   BLE_API mbed

Fork of BLE_LoopbackUART by Bluetooth Low Energy

Committer:
robo8080
Date:
Sun Aug 17 00:53:23 2014 +0000
Revision:
8:a62b8f7d5dcf
Parent:
5:61109bce11fe
DeviceName??

Who changed what in which revision?

UserRevisionLine numberNew contents of line
robo8080 5:61109bce11fe 1 /**************************************************************************/
robo8080 5:61109bce11fe 2 /*!
robo8080 5:61109bce11fe 3 @file compiler.h
robo8080 5:61109bce11fe 4 @author hathach (tinyusb.org)
robo8080 5:61109bce11fe 5
robo8080 5:61109bce11fe 6 @section LICENSE
robo8080 5:61109bce11fe 7
robo8080 5:61109bce11fe 8 Software License Agreement (BSD License)
robo8080 5:61109bce11fe 9
robo8080 5:61109bce11fe 10 Copyright (c) 2013, K. Townsend (microBuilder.eu)
robo8080 5:61109bce11fe 11 All rights reserved.
robo8080 5:61109bce11fe 12
robo8080 5:61109bce11fe 13 Redistribution and use in source and binary forms, with or without
robo8080 5:61109bce11fe 14 modification, are permitted provided that the following conditions are met:
robo8080 5:61109bce11fe 15 1. Redistributions of source code must retain the above copyright
robo8080 5:61109bce11fe 16 notice, this list of conditions and the following disclaimer.
robo8080 5:61109bce11fe 17 2. Redistributions in binary form must reproduce the above copyright
robo8080 5:61109bce11fe 18 notice, this list of conditions and the following disclaimer in the
robo8080 5:61109bce11fe 19 documentation and/or other materials provided with the distribution.
robo8080 5:61109bce11fe 20 3. Neither the name of the copyright holders nor the
robo8080 5:61109bce11fe 21 names of its contributors may be used to endorse or promote products
robo8080 5:61109bce11fe 22 derived from this software without specific prior written permission.
robo8080 5:61109bce11fe 23
robo8080 5:61109bce11fe 24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
robo8080 5:61109bce11fe 25 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
robo8080 5:61109bce11fe 26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
robo8080 5:61109bce11fe 27 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
robo8080 5:61109bce11fe 28 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
robo8080 5:61109bce11fe 29 INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
robo8080 5:61109bce11fe 30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND
robo8080 5:61109bce11fe 31 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
robo8080 5:61109bce11fe 32 INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
robo8080 5:61109bce11fe 33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
robo8080 5:61109bce11fe 34 */
robo8080 5:61109bce11fe 35 /**************************************************************************/
robo8080 5:61109bce11fe 36
robo8080 5:61109bce11fe 37 /** \file
robo8080 5:61109bce11fe 38 * \brief GCC Header
robo8080 5:61109bce11fe 39 */
robo8080 5:61109bce11fe 40
robo8080 5:61109bce11fe 41 /** \ingroup Group_Compiler
robo8080 5:61109bce11fe 42 * \defgroup Group_GCC GNU GCC
robo8080 5:61109bce11fe 43 * @{
robo8080 5:61109bce11fe 44 */
robo8080 5:61109bce11fe 45
robo8080 5:61109bce11fe 46 #ifndef _COMPILER_GCC_H_
robo8080 5:61109bce11fe 47 #define _COMPILER_GCC_H_
robo8080 5:61109bce11fe 48
robo8080 5:61109bce11fe 49 #ifdef __cplusplus
robo8080 5:61109bce11fe 50 extern "C" {
robo8080 5:61109bce11fe 51 #endif
robo8080 5:61109bce11fe 52
robo8080 5:61109bce11fe 53 #include "projectconfig.h"
robo8080 5:61109bce11fe 54
robo8080 5:61109bce11fe 55 //#ifndef __GNUC__
robo8080 5:61109bce11fe 56 // #define ATTR_ALWAYS_INLINE
robo8080 5:61109bce11fe 57 // #define ATTR_CONST
robo8080 5:61109bce11fe 58 //#else
robo8080 5:61109bce11fe 59
robo8080 5:61109bce11fe 60 #ifdef _TEST_
robo8080 5:61109bce11fe 61 #define ATTR_ALWAYS_INLINE
robo8080 5:61109bce11fe 62 #define STATIC_
robo8080 5:61109bce11fe 63 #define INLINE_
robo8080 5:61109bce11fe 64 #else
robo8080 5:61109bce11fe 65 #define STATIC_ static
robo8080 5:61109bce11fe 66 #define INLINE_ inline
robo8080 5:61109bce11fe 67
robo8080 5:61109bce11fe 68 #if CFG_DEBUG == 3
robo8080 5:61109bce11fe 69 #define ATTR_ALWAYS_INLINE // no inline for debug = 3
robo8080 5:61109bce11fe 70 #endif
robo8080 5:61109bce11fe 71 #endif
robo8080 5:61109bce11fe 72
robo8080 5:61109bce11fe 73 #define ALIGN_OF(x) __alignof__(x)
robo8080 5:61109bce11fe 74
robo8080 5:61109bce11fe 75 /// Normally, the compiler places the objects it generates in sections like data or bss & function in text. Sometimes, however, you need additional sections, or you need certain particular variables to appear in special sections, for example to map to special hardware. The section attribute specifies that a variable (or function) lives in a particular section
robo8080 5:61109bce11fe 76 #define ATTR_SECTION(section) __attribute__ ((#section))
robo8080 5:61109bce11fe 77
robo8080 5:61109bce11fe 78 /// If this attribute is used on a function declaration and a call to such a function is not eliminated through dead code elimination or other optimizations, an error that includes message is diagnosed. This is useful for compile-time checking
robo8080 5:61109bce11fe 79 #define ATTR_ERROR(Message) __attribute__ ((error(Message)))
robo8080 5:61109bce11fe 80
robo8080 5:61109bce11fe 81 /// If this attribute is used on a function declaration and a call to such a function is not eliminated through dead code elimination or other optimizations, a warning that includes message is diagnosed. This is useful for compile-time checking
robo8080 5:61109bce11fe 82 #define ATTR_WARNING(Message) __attribute__ ((warning(Message)))
robo8080 5:61109bce11fe 83
robo8080 5:61109bce11fe 84 /**
robo8080 5:61109bce11fe 85 * \defgroup Group_VariableAttr Variable Attributes
robo8080 5:61109bce11fe 86 * @{
robo8080 5:61109bce11fe 87 */
robo8080 5:61109bce11fe 88
robo8080 5:61109bce11fe 89 /// This attribute specifies a minimum alignment for the variable or structure field, measured in bytes
robo8080 5:61109bce11fe 90 #define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes)))
robo8080 5:61109bce11fe 91
robo8080 5:61109bce11fe 92 /// The packed attribute specifies that a variable or structure field should have the smallest possible alignment—one byte for a variable, and one bit for a field, unless you specify a larger value with the aligned attribute
robo8080 5:61109bce11fe 93 #define ATTR_PACKED __attribute__ ((packed))
robo8080 5:61109bce11fe 94
robo8080 5:61109bce11fe 95 #define ATTR_PREPACKED
robo8080 5:61109bce11fe 96
robo8080 5:61109bce11fe 97 #define ATTR_PACKED_STRUCT(x) x __attribute__ ((packed))
robo8080 5:61109bce11fe 98 /** @} */
robo8080 5:61109bce11fe 99
robo8080 5:61109bce11fe 100 /**
robo8080 5:61109bce11fe 101 * \defgroup Group_FuncAttr Function Attributes
robo8080 5:61109bce11fe 102 * @{
robo8080 5:61109bce11fe 103 */
robo8080 5:61109bce11fe 104
robo8080 5:61109bce11fe 105 #ifndef ATTR_ALWAYS_INLINE
robo8080 5:61109bce11fe 106 /// Generally, functions are not inlined unless optimization is specified. For functions declared inline, this attribute inlines the function even if no optimization level is specified
robo8080 5:61109bce11fe 107 #define ATTR_ALWAYS_INLINE __attribute__ ((always_inline))
robo8080 5:61109bce11fe 108 #endif
robo8080 5:61109bce11fe 109
robo8080 5:61109bce11fe 110 /// The nonnull attribute specifies that some function parameters should be non-null pointers. f the compiler determines that a null pointer is passed in an argument slot marked as non-null, and the -Wnonnull option is enabled, a warning is issued. All pointer arguments are marked as non-null
robo8080 5:61109bce11fe 111 #define ATTR_NON_NULL __attribute__ ((nonull))
robo8080 5:61109bce11fe 112
robo8080 5:61109bce11fe 113 /// Many functions have no effects except the return value and their return value depends only on the parameters and/or global variables. Such a function can be subject to common subexpression elimination and loop optimization just as an arithmetic operator would be. These functions should be declared with the attribute pure
robo8080 5:61109bce11fe 114 #define ATTR_PURE __attribute__ ((pure))
robo8080 5:61109bce11fe 115
robo8080 5:61109bce11fe 116 /// Many functions do not examine any values except their arguments, and have no effects except the return value. Basically this is just slightly more strict class than the pure attribute below, since function is not allowed to read global memory.
robo8080 5:61109bce11fe 117 /// Note that a function that has pointer arguments and examines the data pointed to must not be declared const. Likewise, a function that calls a non-const function usually must not be const. It does not make sense for a const function to return void
robo8080 5:61109bce11fe 118 #define ATTR_CONST __attribute__ ((const))
robo8080 5:61109bce11fe 119
robo8080 5:61109bce11fe 120 /// The deprecated attribute results in a warning if the function is used anywhere in the source file. This is useful when identifying functions that are expected to be removed in a future version of a program. The warning also includes the location of the declaration of the deprecated function, to enable users to easily find further information about why the function is deprecated, or what they should do instead. Note that the warnings only occurs for uses
robo8080 5:61109bce11fe 121 #define ATTR_DEPRECATED __attribute__ ((deprecated))
robo8080 5:61109bce11fe 122
robo8080 5:61109bce11fe 123 /// Same as the deprecated attribute with optional message in the warning
robo8080 5:61109bce11fe 124 #define ATTR_DEPRECATED_MESS(mess) __attribute__ ((deprecated(mess)))
robo8080 5:61109bce11fe 125
robo8080 5:61109bce11fe 126 /// The weak attribute causes the declaration to be emitted as a weak symbol rather than a global. This is primarily useful in defining library functions that can be overridden in user code
robo8080 5:61109bce11fe 127 #define ATTR_WEAK __attribute__ ((weak))
robo8080 5:61109bce11fe 128
robo8080 5:61109bce11fe 129 /// The alias attribute causes the declaration to be emitted as an alias for another symbol, which must be specified
robo8080 5:61109bce11fe 130 #define ATTR_ALIAS(func) __attribute__ ((alias(#func)))
robo8080 5:61109bce11fe 131
robo8080 5:61109bce11fe 132 /// The weakref attribute marks a declaration as a weak reference. It is equivalent with weak + alias attribute, but require function is static
robo8080 5:61109bce11fe 133 #define ATTR_WEAKREF(func) __attribute__ ((weakref(#func)))
robo8080 5:61109bce11fe 134
robo8080 5:61109bce11fe 135 /// The warn_unused_result attribute causes a warning to be emitted if a caller of the function with this attribute does not use its return value. This is useful for functions where not checking the result is either a security problem or always a bug
robo8080 5:61109bce11fe 136 #define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
robo8080 5:61109bce11fe 137
robo8080 5:61109bce11fe 138 /// This attribute, attached to a function, means that code must be emitted for the function even if it appears that the function is not referenced. This is useful, for example, when the function is referenced only in inline assembly.
robo8080 5:61109bce11fe 139 #define ATTR_USED __attribute__ ((used))
robo8080 5:61109bce11fe 140
robo8080 5:61109bce11fe 141 /// This attribute, attached to a function, means that the function is meant to be possibly unused. GCC does not produce a warning for this function.
robo8080 5:61109bce11fe 142 #define ATTR_UNUSED __attribute__ ((unused))
robo8080 5:61109bce11fe 143
robo8080 5:61109bce11fe 144 /** @} */
robo8080 5:61109bce11fe 145
robo8080 5:61109bce11fe 146 #ifdef __cplusplus
robo8080 5:61109bce11fe 147 }
robo8080 5:61109bce11fe 148 #endif
robo8080 5:61109bce11fe 149
robo8080 5:61109bce11fe 150 #endif /* _COMPILER_GCC_H_ */
robo8080 5:61109bce11fe 151
robo8080 5:61109bce11fe 152 /// @}