This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new d26357d3e6 nuttx/math: fix greenhills build warning on using sizeof
with operand
d26357d3e6 is described below
commit d26357d3e69b374aad08d5069fda741dc032be7e
Author: guoshichao <[email protected]>
AuthorDate: Mon Jun 24 16:08:34 2024 +0800
nuttx/math: fix greenhills build warning on using sizeof with operand
the detailed warning info are:
CC: syslog/vsyslog.c "pthread/pthread_create.c", line 443: warning
#1931-D: operand of sizeof is
not a type, variable, or dereferenced pointer expression
ptcb->cmn.timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
^
CC: dirent/lib_closedir.c "sched/sched_profil.c", line 81: warning
#1931-D: operand of sizeof is not a
type, variable, or dereferenced pointer expression
wd_start(&prof->timer, PROFTICK, profil_timer_handler, arg);
^
"sched/sched_profil.c", line 142: warning #1931-D: operand of sizeof is not
a
type, variable, or dereferenced pointer expression
wd_start(&prof->timer, PROFTICK, profil_timer_handler, (wdparm_t)prof);
^
CC: common/arm_modifyreg8.c "sched/sched_setscheduler.c", line 165:
warning #1931-D: operand of sizeof is
not a type, variable, or dereferenced pointer expression
tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
^
CC: misc/lib_utsname.c "sched/sched_unlock.c", line 275: warning #1931-D:
operand of sizeof is not a
type, variable, or dereferenced pointer expression
rtcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
^
"sched/sched_roundrobin.c", line 119: warning #1931-D: operand of sizeof is
not a type, variable, or dereferenced pointer expression
tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
^
CC: armv7-m/arm_fpuconfig.c cxarm: Error: No files. Try -help.
CC: misc/lib_crc8ccitt.c cxarm: Error: No files. Try -help.
cxarm: Error: No files. Try -help.
CC: getprime_main.c cxarm: Error: No files. Try -help.
cxarm: Error: No files. Try -help.
CC: misc/lib_log2ceil.c cxarm: Error: No files. Try -help.
CC: task/task_start.c "task/task_setup.c", line 423: warning #1931-D:
operand of sizeof is not a
type, variable, or dereferenced pointer expression
tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
^
Signed-off-by: guoshichao <[email protected]>
---
include/nuttx/lib/math32.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/nuttx/lib/math32.h b/include/nuttx/lib/math32.h
index acfd09749f..07b955b4d0 100644
--- a/include/nuttx/lib/math32.h
+++ b/include/nuttx/lib/math32.h
@@ -260,12 +260,12 @@ extern "C"
})
# define div_const(n, base) \
- ((sizeof(n) == sizeof(uint64_t)) ? div64_const(n, base) : ((n) / (base)))
+ ((sizeof(typeof(n)) == sizeof(uint64_t)) ? div64_const(n, base) : ((n) /
(base)))
# define div_const_roundup(n, base) \
- ((sizeof(n) == sizeof(uint64_t)) ? div64_const((n) + (base) - 1, base) : \
+ ((sizeof(typeof(n)) == sizeof(uint64_t)) ? div64_const((n) + (base) - 1,
base) : \
(((n) + (base) - 1) / (base)))
# define div_const_roundnearest(n, base) \
- ((sizeof(n) == sizeof(uint64_t)) ? div64_const((n) + ((base) / 2), base) :
\
+ ((sizeof(typeof(n)) == sizeof(uint64_t)) ? div64_const((n) + ((base) / 2),
base) : \
(((n) + ((base) / 2)) / (base)))
#else
# define div_const(n, base) ((n) / (base))