Skip to content

Commit c2fbb86

Browse files
committed
Fix warnings with GCC11. cherry-pick:main
1 parent f473d38 commit c2fbb86

11 files changed

Lines changed: 27 additions & 25 deletions

File tree

include/cortexm/task_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ typedef struct {
4646
int pid /*! The process ID assigned to the new thread */;
4747
} task_thread_t;
4848

49-
typedef struct MCU_PACK {
49+
typedef struct {
5050
volatile void *sp /*! The task stack pointer */;
5151
int pid /*! The process id */;
5252
volatile s8 priority /*! Task priority */;

include/mcu/mmc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ typedef struct MCU_PACK {
2020
u32 value;
2121
} mmc_event_data_t;
2222

23-
typedef struct MCU_PACK {
23+
typedef struct {
2424
mmc_attr_t attr; // default attributes
2525
u32 port;
2626
} mmc_config_t;

include/mcu/sdio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ typedef struct MCU_PACK {
2020
u32 value;
2121
} sdio_event_data_t;
2222

23-
typedef struct MCU_PACK {
23+
typedef struct {
2424
sdio_attr_t attr; // default attributes
2525
u32 port;
2626
} sdio_config_t;

include/sos/link/types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ typedef u32 link_trace_event_id_t;
303303
typedef u32 link_trace_event_set_t;
304304
typedef u32 link_mqd_t;
305305

306-
typedef struct MCU_PACK {
306+
typedef struct {
307307
u32 status;
308308
link_trace_event_set_t filter;
309309
link_trace_attr_t attr;

include/sos/symbols.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ extern u32 __aeabi_f2uiz();
7070
extern u32 __aeabi_f2ulz();
7171
extern u32 __clzsi2();
7272
extern u32 __clzdi2();
73-
extern u32 __muldi3();
73+
extern long long int __muldi3(int,int);
7474
extern u32 __negdi2();
7575
extern u32 __cmpdi2();
7676
extern u32 __ucmpdi2();
@@ -192,9 +192,6 @@ useconds_t _EXFUN(ualarm, (useconds_t __useconds, useconds_t __interval));
192192
extern void crt_load_data(void * global_reent, int code_size, int data_size);
193193
extern char ** const crt_import_argv(int argc, char * const argv[]);
194194

195-
extern void sg_api();
196-
extern void son_api();
197-
198195
#include "sys/socket.h"
199196

200197
#ifndef USE_FLOAT

include/sos/trace.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ extern "C" {
88
#endif
99

1010
#define SOS_TRACE_MESSAGE(msg) \
11-
sos_trace_event(LINK_POSIX_TRACE_MESSAGE, msg, strnlen(msg, LINK_POSIX_TRACE_DATA_SIZE))
11+
sos_trace_event(LINK_POSIX_TRACE_MESSAGE, msg, sizeof(msg))
1212
#define SOS_TRACE_WARNING(msg) \
13-
sos_trace_event(LINK_POSIX_TRACE_WARNING, msg, strnlen(msg, LINK_POSIX_TRACE_DATA_SIZE))
13+
sos_trace_event(LINK_POSIX_TRACE_WARNING, msg, sizeof(msg))
1414
#define SOS_TRACE_CRITICAL(msg) \
1515
sos_trace_event( \
16-
LINK_POSIX_TRACE_CRITICAL, msg, strnlen(msg, LINK_POSIX_TRACE_DATA_SIZE))
16+
LINK_POSIX_TRACE_CRITICAL, msg, sizeof(msg))
1717
#define SOS_TRACE_FATAL(msg) \
18-
sos_trace_event(LINK_POSIX_TRACE_FATAL, msg, strnlen(msg, LINK_POSIX_TRACE_DATA_SIZE))
18+
sos_trace_event(LINK_POSIX_TRACE_FATAL, msg, sizeof(msg))
1919

2020
void sos_trace_event(
2121
link_trace_event_id_t event_id,

src/sys/sysfs/sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const sysfs_t *sysfs_find(const char *path, bool needs_parent) {
126126
}
127127

128128
const char *sysfs_stripmountpath(const sysfs_t *fs, const char *path) {
129-
path = path + strnlen(fs->mount_path, NAME_MAX);
129+
path = path + strnlen(fs->mount_path, SYSFS_MOUNT_PATH_MAX);
130130
if (path[0] == '/') {
131131
path++;
132132
}

src/sys/time/_settimeofday.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ int settimeofday(const struct timeval *tp, const struct timezone *tzp){
7070

7171
int settimeofday_rtc(const struct timeval *tp) {
7272
int fd;
73-
rtc_time_t cal_time;
7473

7574
fd = open("/dev/rtc", O_RDWR);
7675
if (fd < 0) {
7776
return -1;
7877
}
7978

80-
gmtime_r((time_t *)&tp, (struct tm *)&cal_time.time);
81-
cal_time.useconds = tp->tv_usec;
79+
struct link_tm time_struct;
80+
gmtime_r((time_t *)&tp, (struct tm *)&time_struct);
81+
rtc_time_t cal_time = {.time = time_struct, .useconds = tp->tv_usec};
8282

8383
if (ioctl(fd, I_RTC_SET, &cal_time) < 0) {
8484
close(fd);

src/sys/time/hibernate.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,12 @@ int set_alarm(int seconds) {
7171

7272
fd = open("/dev/rtc", O_RDWR);
7373
if (fd >= 0) {
74-
attr.time.time_t = time(NULL);
74+
time_t t = time(NULL);
75+
attr.time.time_t = t;
7576
attr.time.time_t += seconds;
76-
gmtime_r((time_t *)&attr.time.time_t, (struct tm *)&attr.time.time);
77+
struct link_tm time_struct;
78+
gmtime_r(&t, (struct tm *)&time_struct);
79+
attr.time.time = time_struct;
7780
attr.o_flags = RTC_FLAG_IS_ALARM_ONCE | RTC_FLAG_ENABLE_ALARM;
7881

7982
// set the alarm for "seconds" from now

src/sys/trace/posix_trace.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ static trace_id_handle_t *trace_get_ptr(trace_id_t id) {
6868
return 0;
6969
}
7070

71-
static uint32_t calc_checksum(trace_id_t id) {
72-
uint32_t check;
73-
uint32_t *ptr = (uint32_t *)id;
71+
static u32 calc_checksum(trace_id_t id) {
72+
u32 check;
73+
u32 *ptr = (u32 *)id;
7474
int i;
7575
check = 0xAA55AA55;
7676
// go over handle excluding checksum value
@@ -210,8 +210,10 @@ int posix_trace_create(pid_t pid, const trace_attr_t *attr, trace_id_t *id) {
210210
trace_handle.attr = tmp_attr;
211211

212212
// populate the timestamp
213-
clock_gettime(CLOCK_REALTIME, (struct timespec *)&(trace_handle.attr.create_time));
214-
213+
struct timespec clock_time;
214+
clock_gettime(CLOCK_REALTIME, (struct timespec *)&clock_time);
215+
trace_handle.attr.create_time.tv_sec = clock_time.tv_sec;
216+
trace_handle.attr.create_time.tv_nsec = clock_time.tv_nsec;
215217
update_checksum(&trace_handle);
216218

217219
*id = trace_find_free();

0 commit comments

Comments
 (0)