Skip to content

Commit d26357d

Browse files
extinguishxiaoxiang781216
authored andcommitted
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]>
1 parent 469418f commit d26357d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/nuttx/lib/math32.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,12 @@ extern "C"
260260
})
261261

262262
# define div_const(n, base) \
263-
((sizeof(n) == sizeof(uint64_t)) ? div64_const(n, base) : ((n) / (base)))
263+
((sizeof(typeof(n)) == sizeof(uint64_t)) ? div64_const(n, base) : ((n) / (base)))
264264
# define div_const_roundup(n, base) \
265-
((sizeof(n) == sizeof(uint64_t)) ? div64_const((n) + (base) - 1, base) : \
265+
((sizeof(typeof(n)) == sizeof(uint64_t)) ? div64_const((n) + (base) - 1, base) : \
266266
(((n) + (base) - 1) / (base)))
267267
# define div_const_roundnearest(n, base) \
268-
((sizeof(n) == sizeof(uint64_t)) ? div64_const((n) + ((base) / 2), base) : \
268+
((sizeof(typeof(n)) == sizeof(uint64_t)) ? div64_const((n) + ((base) / 2), base) : \
269269
(((n) + ((base) / 2)) / (base)))
270270
#else
271271
# define div_const(n, base) ((n) / (base))

0 commit comments

Comments
 (0)