summaryrefslogtreecommitdiff
path: root/src/SConscript
diff options
context:
space:
mode:
authorMeco Man <[email protected]>2024-02-19 14:51:05 -0500
committerRbb666 <[email protected]>2024-02-20 08:39:05 +0800
commit4bec5f9b8f74065713974181480622db98b7b548 (patch)
tree8606d3dc8b915af2b982ac447bf35ae108290fa9 /src/SConscript
parent6d4503363a352c72148bc91da3026f0db096f119 (diff)
[kernel][SConscript] add strict warning cflags
Diffstat (limited to 'src/SConscript')
-rw-r--r--src/SConscript17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/SConscript b/src/SConscript
index 7f7098aaab..5ab18ef52a 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -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')