提交 b80f5815 编写于 作者: 还_没_想_好's avatar 还_没_想_好 提交者: guo

[compilers] Fix c/c++ compilation warnings and errors

上级 e896021b
......@@ -13,6 +13,10 @@
#include <rtthread.h>
#ifdef __cplusplus
extern "C" {
#endif
enum
{
RT_WORK_STATE_PENDING = 0x0001, /* Work item pending state */
......@@ -70,7 +74,9 @@ rt_err_t rt_work_urgent(struct rt_work *work);
rt_err_t rt_work_cancel(struct rt_work *work);
#endif /* RT_USING_SYSTEM_WORKQUEUE */
#ifdef __cplusplus
}
#endif
#endif /* RT_USING_HEAP */
......
......@@ -43,6 +43,9 @@ struct part_flash_info
#elif defined (__GNUC__) /* GNU GCC Compiler */
#define SECTION(x) __attribute__((section(x)))
#define USED __attribute__((used))
#elif defined (_MSC_VER)
#define SECTION(x)
#define USED
#else
#error not supported tool chain
#endif /* __CC_ARM */
......
......@@ -875,7 +875,7 @@ static void fal(uint8_t argc, char **argv) {
result = fal_partition_read(part_dev, i, read_data, cur_op_size);
}
/* data check */
for (int index = 0; index < cur_op_size; index ++)
for (size_t index = 0; index < cur_op_size; index ++)
{
if (write_data[index] != read_data[index])
{
......
......@@ -13,6 +13,10 @@
#include "sys/types.h"
#ifdef __cplusplus
extern "C" {
#endif
#define O_RDONLY 00
#define O_WRONLY 01
#define O_RDWR 02
......@@ -68,4 +72,8 @@ int open(const char *file, int flags, ...);
int fcntl(int fildes, int cmd, ...);
int creat(const char *path, mode_t mode);
#ifdef __cplusplus
}
#endif
#endif
......@@ -20,6 +20,10 @@
#include <winsock.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifndef FD_SETSIZE
#define FD_SETSIZE 32
#endif
......@@ -55,4 +59,8 @@ typedef struct _types_fd_set {
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
#endif /* _WIN32 */
#ifdef __cplusplus
}
#endif
#endif /* __SYS_SELECT_H__ */
......@@ -14,6 +14,10 @@
#include <sys/types.h>
#include <sys/time.h>
#ifdef __cplusplus
extern "C" {
#endif
#define S_IFMT 00170000
#define S_IFSOCK 0140000
#define S_IFLNK 0120000
......@@ -80,4 +84,8 @@ int mknod(const char *, mode_t, dev_t);
int stat(const char *, struct stat *);
mode_t umask(mode_t);
#ifdef __cplusplus
}
#endif
#endif
......@@ -16,6 +16,10 @@
#include <stddef.h>
#include <time.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef int32_t clockid_t;
typedef int32_t key_t; /* Used for interprocess communication. */
typedef int pid_t; /* Used for process IDs and process group IDs. */
......@@ -39,4 +43,8 @@ typedef unsigned int u_int;
typedef unsigned char u_char;
typedef unsigned long u_long;
#ifdef __cplusplus
}
#endif
#endif
......@@ -15,6 +15,10 @@
#include <stddef.h>
#include "types.h" /* <sys/types.h> */
#ifdef __cplusplus
extern "C" {
#endif
#define STDIN_FILENO 0 /* standard input file descriptor */
#define STDOUT_FILENO 1 /* standard output file descriptor */
#define STDERR_FILENO 2 /* standard error file descriptor */
......@@ -46,4 +50,8 @@ uid_t geteuid(void);
gid_t getgid(void);
gid_t getegid(void);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_UNISTD_H */
......@@ -15,6 +15,10 @@
#include <winsock.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct winsize
{
unsigned short ws_row;
......@@ -271,4 +275,8 @@ struct winsize
int ioctl(int fildes, int cmd, ...);
#ifdef __cplusplus
}
#endif
#endif
......@@ -12,6 +12,10 @@
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
struct statfs
{
size_t f_bsize; /* block size */
......@@ -22,4 +26,8 @@ struct statfs
int statfs(const char *path, struct statfs *buf);
int fstatfs(int fd, struct statfs *buf);
#ifdef __cplusplus
}
#endif
#endif
......@@ -83,7 +83,7 @@ int var_export_init(void)
static char __vexp_strbuf1[1024];
static char __vexp_strbuf2[1024];
ve_exporter_t ve_exporter_temp;
int index_i, index_j;
rt_size_t index_i, index_j;
/* past the three members in first ptr_begin */
ptr_begin += (sizeof(struct ve_exporter) / sizeof(unsigned int));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册