Patches from Petteri Aimonen + stdbool and rand() changes for Freddie Chopin

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5415 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2012-12-07 16:00:56 +00:00
parent 419bb814c5
commit 5306523bce
34 changed files with 1110 additions and 181 deletions
+33 -2
View File
@@ -42,10 +42,33 @@
#include <nuttx/config.h>
/* If CONFIG_ARCH_STDBOOL_H is set, then the archecture will provide its own
* stdbool.h file. In this case, this header file will simply re-direct to
* the architecture-specfiic stdbool.h header file.
*/
#ifdef CONFIG_ARCH_STDBOOL_H
# include <arch/stdbool.h>
/* NuttX will insist that the sizeof(bool) is 8-bits. The sizeof of _Bool
* used by any specific compiler is implementation specific: It can vary from
* compiler-to-compiler and even vary between different versions of the same
* compiler. Compilers seems to be converging to sizeof(_Bool) == 1. If that
* is true for your compiler, you should define CONFIG_C99_BOOL8 in your NuttX
* configuration for better standards compatibility.
*
* CONFIG_C99_BOOL8 - Means (1) your C++ compiler has sizeof(_Bool) == 8,
* (2) your C compiler supports the C99 _Bool intrinsic type, and (2) that
* the C99 _Bool type also has size 1.
*/
#else
/* nuttx/compiler.h may also define or undefine CONFIG_C99_BOOL8 */
# include <nuttx/compiler.h>
#if !defined(__cplusplus) || !defined(CONFIG_C99_BOOL8)
# include <stdint.h>
/****************************************************************************
@@ -58,10 +81,15 @@
* NOTE: Under C99 'bool' is required to be defined to be the intrinsic type
* _Bool. However, in this NuttX context, we need backward compatibility
* to pre-C99 standards where _Bool is not an intrinsic type. Hence, we
* use _Bool8 as the underlying type.
* use _Bool8 as the underlying type (unless CONFIG_C99_BOOL8 is defined)
*/
#define bool _Bool8
#ifdef CONFIG_C99_BOOL8
# define bool _Bool
#else
# define bool _Bool8
#endif
#define true 1
#define false 0
@@ -83,7 +111,10 @@
* as the underlying type.
*/
#ifndef CONFIG_C99_BOOL8
typedef uint8_t _Bool8;
#endif
#endif /* __cplusplus && CONFIG_C99_BOOL8 */
#endif /* CONFIG_ARCH_STDBOOL_H */
#endif /* __INCLUDE_STDBOOL_H */