[kernel][SConscript] add strict warning cflags

This commit is contained in:
Meco Man 2024-02-19 14:51:05 -05:00 committed by Rbb666
parent 6d4503363a
commit 4bec5f9b8f
1 changed files with 15 additions and 2 deletions

View File

@ -1,9 +1,9 @@
from building import *
from gcc import GetGCCLikePLATFORM
import os
src = Glob('*.c')
cwd = GetCurrentDir()
inc = [os.path.join(cwd, '..', 'include')]
if GetDepend('RT_USING_SMALL_MEM') == False:
@ -30,6 +30,19 @@ if GetDepend('RT_USING_SMP') == False:
if GetDepend('RT_USING_SMP') == True:
SrcRemove(src, ['scheduler_up.c'])
group = DefineGroup('Kernel', src, depend = [''], CPPPATH = inc, CPPDEFINES = ['__RTTHREAD__'])
LOCAL_CFLAGS = ''
if rtconfig.PLATFORM in GetGCCLikePLATFORM():
LOCAL_CFLAGS += ' -Wunused' # unused warning
LOCAL_CFLAGS += ' -Wformat -Wformat-security' # printf/scanf format warning
LOCAL_CFLAGS += ' -Warray-bounds -Wuninitialized' # memory access warning
LOCAL_CFLAGS += ' -Wreturn-type -Wcomment -Wswitch' # code style warning
LOCAL_CFLAGS += ' -Wparentheses -Wlogical-op ' # operation warning
# LOCAL_CFLAGS += ' -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes' # function declaration warning
if 'mips' not in rtconfig.PREFIX: # mips toolchain does not support
LOCAL_CFLAGS += ' -Wimplicit-fallthrough' # implicit fallthrough warning
LOCAL_CFLAGS += ' -Wduplicated-cond -Wduplicated-branches' # duplicated condition warning
group = DefineGroup('Kernel', src, depend=[''], CPPPATH=inc, CPPDEFINES=['__RTTHREAD__'], LOCAL_CFLAGS=LOCAL_CFLAGS)
Return('group')