mirror of
https://github.com/apache/nuttx.git
synced 2026-05-26 10:46:28 +08:00
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:
@@ -69,6 +69,7 @@ namespace std
|
||||
using ::log10f;
|
||||
using ::log2f;
|
||||
using ::modff;
|
||||
using ::roundf;
|
||||
using ::powf;
|
||||
using ::sinf;
|
||||
using ::sinhf;
|
||||
@@ -95,6 +96,7 @@ namespace std
|
||||
using ::log10;
|
||||
using ::log2;
|
||||
using ::modf;
|
||||
using ::round;
|
||||
using ::pow;
|
||||
using ::sin;
|
||||
using ::sinh;
|
||||
@@ -121,6 +123,7 @@ namespace std
|
||||
using ::log10l;
|
||||
using ::log2l;
|
||||
using ::modfl;
|
||||
using ::roundl;
|
||||
using ::powl;
|
||||
using ::sinl;
|
||||
using ::sinhl;
|
||||
|
||||
@@ -70,6 +70,7 @@ namespace std
|
||||
#endif
|
||||
|
||||
using ::strtol;
|
||||
using ::strtoul;
|
||||
using ::strtod;
|
||||
|
||||
using ::malloc;
|
||||
|
||||
@@ -176,7 +176,7 @@ struct mountpt_operations
|
||||
|
||||
int (*statfs)(FAR struct inode *mountpt, FAR struct statfs *buf);
|
||||
|
||||
/* Operations on pathes */
|
||||
/* Operations on paths */
|
||||
|
||||
int (*unlink)(FAR struct inode *mountpt, FAR const char *relpath);
|
||||
int (*mkdir)(FAR struct inode *mountpt, FAR const char *relpath, mode_t mode);
|
||||
|
||||
@@ -141,6 +141,14 @@ double floor (double x);
|
||||
long double floorl(long double x);
|
||||
#endif
|
||||
|
||||
float roundf(float x);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
double round (double x);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double roundl(long double x);
|
||||
#endif
|
||||
|
||||
float fabsf (float x);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
double fabs (double x);
|
||||
|
||||
+2
-1
@@ -220,7 +220,6 @@ EXTERN FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_dev_s *dev);
|
||||
|
||||
EXTERN FAR struct mtd_dev_s *sst25_initialize(FAR struct spi_dev_s *dev);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: w25_initialize
|
||||
*
|
||||
@@ -233,6 +232,8 @@ EXTERN FAR struct mtd_dev_s *sst25_initialize(FAR struct spi_dev_s *dev);
|
||||
|
||||
EXTERN FAR struct mtd_dev_s *w25_initialize(FAR struct spi_dev_s *dev);
|
||||
|
||||
EXTERN FAR struct mtd_dev_s *at25_initialize(FAR struct spi_dev_s *dev);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+33
-2
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user