Skip to content

Commit 1cf890c

Browse files
authored
Merge pull request #2413 from liruncong/errorwarn
部分警告及问题修改
2 parents 59d0445 + 4f108db commit 1cf890c

File tree

10 files changed

+94
-73
lines changed

10 files changed

+94
-73
lines changed

components/cplusplus/crt_init.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
#include <rtthread.h>
1515

16-
#ifdef __CC_ARM
16+
#if defined(__CC_ARM) || defined(__CLANG_ARM)
1717
extern void $Super$$__cpp_initialize__aeabi_(void);
1818
/* we need to change the cpp_initialize order */
19-
void $Sub$$__cpp_initialize__aeabi_(void)
19+
RT_WEAK void $Sub$$__cpp_initialize__aeabi_(void)
2020
{
2121
/* empty */
2222
}
@@ -34,19 +34,9 @@ RT_WEAK void *__dso_handle = 0;
3434

3535
#endif
3636

37-
RT_WEAK
38-
int cplusplus_system_init(void)
37+
RT_WEAK int cplusplus_system_init(void)
3938
{
40-
#if defined(__GNUC__) && !defined(__CC_ARM)
41-
typedef void (*pfunc) ();
42-
extern pfunc __ctors_start__[];
43-
extern pfunc __ctors_end__[];
44-
pfunc *p;
45-
46-
for (p = __ctors_start__; p < __ctors_end__; p++)
47-
(*p)();
48-
49-
#elif defined(__CC_ARM)
39+
#if defined(__CC_ARM) || defined(__CLANG_ARM)
5040
/* If there is no SHT$$INIT_ARRAY, calling
5141
* $Super$$__cpp_initialize__aeabi_() will cause fault. At least until Keil5.12
5242
* the problem still exists. So we have to initialize the C++ runtime by ourself.
@@ -63,9 +53,16 @@ int cplusplus_system_init(void)
6353
PROC *proc = (PROC*)((const char*)base + *base);
6454
(*proc)();
6555
}
56+
#elif defined(__GNUC__)
57+
typedef void(*pfunc) ();
58+
extern pfunc __ctors_start__[];
59+
extern pfunc __ctors_end__[];
60+
pfunc *p;
61+
62+
for (p = __ctors_start__; p < __ctors_end__; p++)
63+
(*p)();
6664
#endif
6765

6866
return 0;
6967
}
7068
INIT_COMPONENT_EXPORT(cplusplus_system_init);
71-

components/libc/compilers/armlibc/SConscript

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if GetDepend('RT_USING_DFS') == False:
1414
if GetDepend('RT_USING_MODULE') == False:
1515
SrcRemove(src, ['libc_syms.c'])
1616

17-
if rtconfig.PLATFORM == 'armcc':
17+
if rtconfig.PLATFORM == 'armcc' or rtconfig.PLATFORM == 'armclang':
1818
group = DefineGroup('libc', src, depend = ['RT_USING_LIBC'],
1919
CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
2020

components/libc/compilers/armlibc/stubs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ void _ttywrch(int ch)
251251
#endif
252252
}
253253

254-
void _sys_exit(int return_code)
254+
RT_WEAK void _sys_exit(int return_code)
255255
{
256256
/* TODO: perhaps exit the thread which is invoking this function */
257257
while (1);

components/net/lwip-1.4.1/src/include/netif/ethernetif.h

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,35 @@
1717

1818
struct eth_device
1919
{
20-
/* inherit from rt_device */
21-
struct rt_device parent;
20+
/* inherit from rt_device */
21+
struct rt_device parent;
2222

23-
/* network interface for lwip */
24-
struct netif *netif;
25-
struct rt_semaphore tx_ack;
23+
/* network interface for lwip */
24+
struct netif *netif;
25+
struct rt_semaphore tx_ack;
2626

27-
rt_uint16_t flags;
28-
rt_uint8_t link_changed;
29-
rt_uint8_t link_status;
27+
rt_uint16_t flags;
28+
rt_uint8_t link_changed;
29+
rt_uint8_t link_status;
3030

31-
/* eth device interface */
32-
struct pbuf* (*eth_rx)(rt_device_t dev);
33-
rt_err_t (*eth_tx)(rt_device_t dev, struct pbuf* p);
31+
/* eth device interface */
32+
struct pbuf* (*eth_rx)(rt_device_t dev);
33+
rt_err_t (*eth_tx)(rt_device_t dev, struct pbuf* p);
3434
};
3535

36-
rt_err_t eth_device_ready(struct eth_device* dev);
37-
rt_err_t eth_device_init(struct eth_device * dev, char *name);
38-
rt_err_t eth_device_init_with_flag(struct eth_device *dev, char *name, rt_uint16_t flag);
39-
rt_err_t eth_device_linkchange(struct eth_device* dev, rt_bool_t up);
36+
#ifdef __cplusplus
37+
extern "C" {
38+
#endif
39+
40+
rt_err_t eth_device_ready(struct eth_device* dev);
41+
rt_err_t eth_device_init(struct eth_device * dev, const char *name);
42+
rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_uint16_t flag);
43+
rt_err_t eth_device_linkchange(struct eth_device* dev, rt_bool_t up);
4044

41-
int eth_system_device_init(void);
45+
int eth_system_device_init(void);
46+
47+
#ifdef __cplusplus
48+
}
49+
#endif
4250

4351
#endif /* __NETIF_ETHERNETIF_H__ */

components/net/lwip-1.4.1/src/netif/ethernetif.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ static err_t eth_netif_device_init(struct netif *netif)
177177
}
178178

179179
/* Keep old drivers compatible in RT-Thread */
180-
rt_err_t eth_device_init_with_flag(struct eth_device *dev, char *name, rt_uint16_t flags)
180+
rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_uint16_t flags)
181181
{
182182
struct netif* netif;
183183

@@ -242,7 +242,7 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, char *name, rt_uint16
242242
return RT_EOK;
243243
}
244244

245-
rt_err_t eth_device_init(struct eth_device * dev, char *name)
245+
rt_err_t eth_device_init(struct eth_device * dev, const char *name)
246246
{
247247
rt_uint16_t flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP;
248248

components/net/lwip-2.0.2/src/include/netif/ethernetif.h

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,35 @@
1717

1818
struct eth_device
1919
{
20-
/* inherit from rt_device */
21-
struct rt_device parent;
20+
/* inherit from rt_device */
21+
struct rt_device parent;
2222

23-
/* network interface for lwip */
24-
struct netif *netif;
25-
struct rt_semaphore tx_ack;
23+
/* network interface for lwip */
24+
struct netif *netif;
25+
struct rt_semaphore tx_ack;
2626

27-
rt_uint16_t flags;
28-
rt_uint8_t link_changed;
29-
rt_uint8_t link_status;
27+
rt_uint16_t flags;
28+
rt_uint8_t link_changed;
29+
rt_uint8_t link_status;
3030

31-
/* eth device interface */
32-
struct pbuf* (*eth_rx)(rt_device_t dev);
33-
rt_err_t (*eth_tx)(rt_device_t dev, struct pbuf* p);
31+
/* eth device interface */
32+
struct pbuf* (*eth_rx)(rt_device_t dev);
33+
rt_err_t (*eth_tx)(rt_device_t dev, struct pbuf* p);
3434
};
3535

36-
rt_err_t eth_device_ready(struct eth_device* dev);
37-
rt_err_t eth_device_init(struct eth_device * dev, char *name);
38-
rt_err_t eth_device_init_with_flag(struct eth_device *dev, char *name, rt_uint16_t flag);
39-
rt_err_t eth_device_linkchange(struct eth_device* dev, rt_bool_t up);
36+
#ifdef __cplusplus
37+
extern "C" {
38+
#endif
39+
40+
rt_err_t eth_device_ready(struct eth_device* dev);
41+
rt_err_t eth_device_init(struct eth_device * dev, const char *name);
42+
rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_uint16_t flag);
43+
rt_err_t eth_device_linkchange(struct eth_device* dev, rt_bool_t up);
4044

41-
int eth_system_device_init(void);
45+
int eth_system_device_init(void);
46+
47+
#ifdef __cplusplus
48+
}
49+
#endif
4250

4351
#endif /* __NETIF_ETHERNETIF_H__ */

components/net/lwip-2.0.2/src/netif/ethernetif.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ static err_t eth_netif_device_init(struct netif *netif)
205205
}
206206

207207
/* Keep old drivers compatible in RT-Thread */
208-
rt_err_t eth_device_init_with_flag(struct eth_device *dev, char *name, rt_uint16_t flags)
208+
rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_uint16_t flags)
209209
{
210210
struct netif* netif;
211211

@@ -269,7 +269,7 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, char *name, rt_uint16
269269
return RT_EOK;
270270
}
271271

272-
rt_err_t eth_device_init(struct eth_device * dev, char *name)
272+
rt_err_t eth_device_init(struct eth_device * dev, const char *name)
273273
{
274274
rt_uint16_t flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP;
275275

components/net/lwip-2.1.0/src/include/netif/ethernetif.h

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,35 @@
1717

1818
struct eth_device
1919
{
20-
/* inherit from rt_device */
21-
struct rt_device parent;
20+
/* inherit from rt_device */
21+
struct rt_device parent;
2222

23-
/* network interface for lwip */
24-
struct netif *netif;
25-
struct rt_semaphore tx_ack;
23+
/* network interface for lwip */
24+
struct netif *netif;
25+
struct rt_semaphore tx_ack;
2626

27-
rt_uint16_t flags;
28-
rt_uint8_t link_changed;
29-
rt_uint8_t link_status;
27+
rt_uint16_t flags;
28+
rt_uint8_t link_changed;
29+
rt_uint8_t link_status;
3030

31-
/* eth device interface */
32-
struct pbuf* (*eth_rx)(rt_device_t dev);
33-
rt_err_t (*eth_tx)(rt_device_t dev, struct pbuf* p);
31+
/* eth device interface */
32+
struct pbuf* (*eth_rx)(rt_device_t dev);
33+
rt_err_t (*eth_tx)(rt_device_t dev, struct pbuf* p);
3434
};
3535

36-
rt_err_t eth_device_ready(struct eth_device* dev);
37-
rt_err_t eth_device_init(struct eth_device * dev, char *name);
38-
rt_err_t eth_device_init_with_flag(struct eth_device *dev, char *name, rt_uint16_t flag);
39-
rt_err_t eth_device_linkchange(struct eth_device* dev, rt_bool_t up);
36+
#ifdef __cplusplus
37+
extern "C" {
38+
#endif
39+
40+
rt_err_t eth_device_ready(struct eth_device* dev);
41+
rt_err_t eth_device_init(struct eth_device * dev, const char *name);
42+
rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_uint16_t flag);
43+
rt_err_t eth_device_linkchange(struct eth_device* dev, rt_bool_t up);
4044

41-
int eth_system_device_init(void);
45+
int eth_system_device_init(void);
46+
47+
#ifdef __cplusplus
48+
}
49+
#endif
4250

4351
#endif /* __NETIF_ETHERNETIF_H__ */

components/net/lwip-2.1.0/src/netif/ethernetif.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static err_t eth_netif_device_init(struct netif *netif)
210210
}
211211

212212
/* Keep old drivers compatible in RT-Thread */
213-
rt_err_t eth_device_init_with_flag(struct eth_device *dev, char *name, rt_uint16_t flags)
213+
rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_uint16_t flags)
214214
{
215215
struct netif* netif;
216216

@@ -273,7 +273,7 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, char *name, rt_uint16
273273
return RT_EOK;
274274
}
275275

276-
rt_err_t eth_device_init(struct eth_device * dev, char *name)
276+
rt_err_t eth_device_init(struct eth_device * dev, const char *name)
277277
{
278278
rt_uint16_t flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP;
279279

src/slab.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,10 @@ void rt_system_heap_init(void *begin_addr, void *end_addr)
398398
* Calculate the zone index for the allocation request size and set the
399399
* allocation request size to that particular zone's chunk size.
400400
*/
401-
rt_inline int zoneindex(rt_uint32_t *bytes)
401+
rt_inline int zoneindex(rt_size_t *bytes)
402402
{
403403
/* unsigned for shift opt */
404-
rt_uint32_t n = (rt_uint32_t) * bytes;
404+
rt_uint32_t n = (rt_uint32_t)(*bytes);
405405

406406
if (n < 128)
407407
{

0 commit comments

Comments
 (0)