2G ems initial
This commit is contained in:
288
include/Makefile.splint
Normal file
288
include/Makefile.splint
Normal file
@@ -0,0 +1,288 @@
|
||||
|
||||
##----------------------------------------------------------##
|
||||
## ##
|
||||
## Universal Makefile Splint Function ##
|
||||
## ##
|
||||
## Created : Wei Liu 07/05/20 ##
|
||||
## Revision: [Last]Wei Liu 07/07/07 ##
|
||||
## ##
|
||||
##----------------------------------------------------------##
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## Make splinting program flags
|
||||
##
|
||||
##--------------------------------------
|
||||
|
||||
##<23>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>Ϣ
|
||||
SFLAG_HINTS := #-hints
|
||||
|
||||
##<23>Ƿ<EFBFBD><C7B7>ÿ<EFBFBD><C3BF><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
|
||||
SFLAG_INCLUDE := +single-include
|
||||
#+never-include
|
||||
|
||||
##<23><><EFBFBD><EFBFBD>ʲô<CAB2><C3B4>
|
||||
SFLAG_LIB := +posixlib
|
||||
##+nolib +nof -warnposix
|
||||
##+unixlib
|
||||
##+posixlib
|
||||
#+nolib +nof -warnposix
|
||||
##+nof
|
||||
##+unixlib
|
||||
##+which_lib
|
||||
|
||||
##
|
||||
SFLAG_DUMP :=
|
||||
##dump ./include/public.h ./include/pub_base.h ./include/includes.h
|
||||
SFLAG_LOAD :=
|
||||
##+load /usr/share/splint/lib/unixstrict.lcd
|
||||
##load ./include/public.h ./include/pub_base.h ./include/includes.h
|
||||
|
||||
SFLAG_DIR :=
|
||||
##-I/work/r9/plat/public/src/include/splint
|
||||
##-I/work/r9/plat/public/src/include/splint
|
||||
##-I /usr/local/work/r9/plat/public/src/include/
|
||||
|
||||
##<23><><EFBFBD><EFBFBD>ģʽ
|
||||
SFLAG_TYPE := -strict
|
||||
|
||||
##<23>Թ<EFBFBD><D4B9><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
|
||||
SFLAG_SYS_HEADERS := +skip_sys_headers
|
||||
SFLAG_ISO_HEADERS :=
|
||||
#+skip_iso_headers
|
||||
SFLAG_POSIX_HEADERS :=
|
||||
##+skip_posix_headers
|
||||
|
||||
##ÿ<><C3BF>ͷ<EFBFBD>ļ<EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
||||
SFLAG_SINGLE_INCLUDE := +singleinclude
|
||||
|
||||
##ϵͳ<CFB5>ļ<EFBFBD>Ŀ¼
|
||||
SFLAG_SYS_DIR :=
|
||||
##+sys-dirs /work/r9/plat/public/src/include/splint
|
||||
|
||||
##<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>
|
||||
SFLAG_PROTO_PARAMNAME := -protoparamname
|
||||
|
||||
##<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
SFLAG_UNDERSCORE := -isoreserved -isoreservedinternal
|
||||
|
||||
## <20><>"/*"<22><>"*/"<22><><EFBFBD>ٴ<EFBFBD>ʹ<EFBFBD><CAB9>"/*"<22><>"*/"
|
||||
SFLAG_NESTCOMMENT := -nestcomment
|
||||
|
||||
##<23><><EFBFBD><EFBFBD>δ˵<CEB4><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
SFLAG_EXPORT_VAR := -exportvar
|
||||
SFLAG_EXPORT_FCN := -exportfcn
|
||||
SFLAG_EXPORT_TYPE := -exporttype
|
||||
SFLAG_EXPORT_CONST := -exportconst
|
||||
|
||||
##<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD>ΪBOOL<4F><4C>
|
||||
SFLAG_LIKELY_BOOL := -likelybool
|
||||
|
||||
##<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
SFLAG_CHAR_INT := +charint
|
||||
SFLAG_BOOL_INT := +boolint
|
||||
|
||||
##Report memory transfer errors for initializations to read-only string literals
|
||||
SFLAG_READONLY_TRANS := -readonlytrans
|
||||
|
||||
##A string literal is assigned to a char array that smaller than the string literal needs
|
||||
SFLAG_STRING_SMALLER := -stringliteralsmaller
|
||||
|
||||
##A variable declared outside a macro body starts with the macro-var-prefix
|
||||
SFLAG_MACRO_PREFIX := -macrovarprefixexclude
|
||||
|
||||
##Initializer does not define all elements of a declared array
|
||||
SFLAG_INITAL_ELEMENT := -initallelements
|
||||
|
||||
##<23><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5>
|
||||
SFLAG_PARAM_TYPE := -type
|
||||
|
||||
##Report modification errors in functions declared without a modifies clause
|
||||
SFLAG_MODIFY := -modnomods
|
||||
|
||||
##Use of a checked global in a function with no globals list
|
||||
SFLAG_GLOBAL := -glob-noglobs
|
||||
|
||||
##Use of internal state in function with no globals list
|
||||
SFLAG_INTERNAL_GLOBS := -internal-globs-noglobs
|
||||
|
||||
##Implicit checked qualifier on global variables and qualifier file static scope variables with no checking annotation
|
||||
SFLAG_CHECK_GLOBAL := -imp-checkedstrict-globs -imp-checkedstrict_statics
|
||||
|
||||
##Undocumented modification of a checked global variable in a function with no modifies clause
|
||||
SFLAG_CHECK_GLOBAL_MODIFY := -mod-globs-nomods
|
||||
|
||||
##Storage declared with observer may be modified through a call to an unconstrained function
|
||||
SFLAG_OBSERVER_MODIFY := -mod-observer-uncon
|
||||
|
||||
##<23><><EFBFBD>Է<EFBFBD><D4B7><EFBFBD>ֵ
|
||||
SFLAG_IGNORE_RETVAL := -retval
|
||||
|
||||
##while,if and for statement is not a block
|
||||
SFLAG_WHILE_BLOCK := -whileblock
|
||||
SFLAG_IF_BLOCK := -ifblock
|
||||
SFLAG_FOR_BLOCK := -forblock
|
||||
|
||||
##There is no finals else following an else if construct
|
||||
SFLAG_ELSEIF_COMPLETE := -elseifcomplete
|
||||
|
||||
##<23><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>
|
||||
SFLAG_POINT_ARITH := -ptrarith -nullptrarith
|
||||
|
||||
##An unconstrained function is called in a function body where modifications are checked.
|
||||
SFLAG_UNCONSTRAIN_MODIFY := -mod-uncon-nomods
|
||||
|
||||
##NO effect of unconstrained functions
|
||||
SFLAG_EFFECT_UNCONSTRAIN := -no-effect-uncon
|
||||
|
||||
##Type-mismatch in parameter corresponding to format code in a printflike or scanflike function
|
||||
SFLAG_FORMAT-TYPE := -format-type
|
||||
|
||||
##An actual parameter that is passed as a unique formal parameter is aliased by another parameter or global variable
|
||||
SFLAG_ALIASING := -alias-unique -ret-alias#-may-alias-unique
|
||||
|
||||
##Transfer Errors flag
|
||||
SFLAG_STORAGE_TRANSFER := -onlytrans -temptrans -unqualified-trans -immediatetrans
|
||||
|
||||
##Report errors for break statements inside a nested while, for or switch
|
||||
SFLAG_DEEP_BREAK := -deep-break #-switch-switch-break -loop-loop-break
|
||||
|
||||
##Storage has inconsistent states of alternate paths through a branch
|
||||
SFLAG_INCONSISTENT_BRANCH := -branch-state
|
||||
|
||||
##There is a non-empty case in a switch not followed by a break.
|
||||
##Likely infinite loop is detected
|
||||
##Likely infinite loop is detected. Loop test or body calls an unconstrained function that may produce an undetected modification
|
||||
SFLAG_PROBLEMATIC_CTR := -case-break -infloops -infloopsuncon
|
||||
|
||||
##An expression may be undefined because a sub-expression contains a call to an unconstrained function (no modifies clause)
|
||||
##that may modify something that may be modified or used by another sub-expression
|
||||
SFLAG_UNDEFINED_EVALORDER := -eval-order-uncon
|
||||
|
||||
##Only storage transferred to an unqualified global or static reference.
|
||||
##This may lead to a memory leak, since the new reference is not necessarily released
|
||||
SFLAG_INITIALIZERS := -only-unq-global-trans
|
||||
|
||||
##Primitive operation does not type check strictly
|
||||
SFLAG_PRIMITIVE_OPERA := -strict-ops -bitwise-signed
|
||||
|
||||
##Unused Declarations <20><>δʹ<CEB4>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
SFLAG_DECLARARIONS := -field-use -fcnuse -param-use -typeuse -varuse -enummemuse
|
||||
|
||||
##Function, variable, iterator or constant declared but never defined (δ<><CEB4>ʼ<EFBFBD><CABC>)
|
||||
SFLAG_COMPLETE_PRG := -decl-undef
|
||||
|
||||
##A declaration is exported but not used outside this module or not appear in a header file
|
||||
SFLAG_EXPORTS := -export-local -export-header
|
||||
|
||||
##<23><>warning<6E><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>splint_warn<72><6E>
|
||||
SFLAG_WARN_FILE := #+warning-stream splint_warn
|
||||
|
||||
##<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>splint_error<6F><72>
|
||||
SFLAG_ERROR_FILE := #+error-stream splint_error
|
||||
|
||||
##<23>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
SFLAG_STREAM_OVERWRITE := -streamoverwrite
|
||||
|
||||
##An abstract type defined in M.h (or specified in M.lcl) is accessible in M.c
|
||||
SFLAG_ACCESS := -access-module
|
||||
|
||||
##Function definition is in old style syntax. Standard prototype syntax is preferred.
|
||||
SFLAG_ISO_CONFORMANCE := #-old-style
|
||||
|
||||
##Use of function that may lead to buffer overflow
|
||||
SFLAG_BUFFER := -bufferoverflowhigh
|
||||
|
||||
##A function is declared without a parameter list prototype
|
||||
SFLAG_FUNC_NOPARAM := -noparams
|
||||
|
||||
##Operand of sizeof operator is a type
|
||||
SFLAG_SIZEOF_TYPE := -sizeoftype
|
||||
|
||||
##Storage derivable from a parameter, return value or global variable is not completely defined
|
||||
SFLAG_COMP_DEF := -compdef
|
||||
|
||||
##Behavior of an expression is unspecified or implementation-dependent
|
||||
##because sub-expressions contain interfering side effects that may be evaluated in any order
|
||||
SFLAG_EVAL_ORDER := -eval-order
|
||||
|
||||
##try to recover code
|
||||
SFLAG_TRY_TO_RECOVER := #+trytorecover
|
||||
|
||||
##<23><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>NULLָ<4C><D6B8>
|
||||
SFLAG_NULL_RET := -nullret
|
||||
|
||||
##A possibly null pointer is reachable from a parameter or global variable that is not declared using a /*@null@*/ annotation
|
||||
SFLAG_NULL_STATE := -nullstate
|
||||
|
||||
##The value of a location that may not be initialized on some execution path is used
|
||||
SFLAG_USE_BEFORE_DEF := -usedef
|
||||
|
||||
##<23><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>֪<EFBFBD><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Format parameter is not known at compile-time <20><><EFBFBD><EFBFBD>:sprintf(mgcpAsciTempBuf, msg)
|
||||
SFLAG_FORMAT_CONST := -format-const
|
||||
|
||||
##Argument to exit has implementation defined behavior. The only valid arguments to exit are EXIT_SUCCESS, EXIT_FAILURE and 0.
|
||||
##An error is reported if Splint can determine statically that the argument to exit is not one of these
|
||||
SFLAG_EXIT_ARG := -exitarg
|
||||
|
||||
##An extern declaration is used inside a function body
|
||||
SFLAG_EXTERN := -nested-extern
|
||||
|
||||
|
||||
|
||||
SFLAG_OLD_STTLE := -oldstyle
|
||||
|
||||
|
||||
SFLAG_SHIFT_NEG := -shiftnegative
|
||||
|
||||
|
||||
SFLAG_PREPROC := -preproc
|
||||
|
||||
##all splint flags
|
||||
|
||||
SPLINT_FLAGS := $(SFLAG_LIB) $(SFLAG_TYPE) $(SFLAG_SYS_HEADERS) $(SFLAG_ISO_HEADERS)\
|
||||
$(SFLAG_POSIX_HEADERS) $(SFLAG_SINGLEINCLUDE) $(SFLAG_WARN)\
|
||||
$(SFLAG_UNDERSCORE) $(SFLAG_NESTCOMMENT) $(SFLAG_EVAL_ORDER)\
|
||||
$(SFLAG_PROTO_PARAMNAME) $(SFLAG_EXPORT_VAR) $(SFLAG_EXPORT_FCN)\
|
||||
$(SFLAG_EXPORT_TYPE) $(SFLAG_LIKELY_BOOL) $(SFLAG_CHAR_INT)\
|
||||
$(SFLAG_READONLY_TRANS) $(SFLAG_STRING_SMALLER) $(SFLAG_MACRO_PREFIX)\
|
||||
$(SFLAG_INITAL_ELEMENT) $(SFLAG_PARAM_TYPE) $(SFLAG_GLOBAL)\
|
||||
$(SFLAG_CHECK_GLOBAL) $(SFLAG_CHECK_GLOBAL_MODIFY) $(SFLAG_IGNORE_RETVAL)\
|
||||
$(SFLAG_INTERNAL_GLOBS) $(SFLAG_MODIFY) $(SFLAG_BOOL_INT)\
|
||||
$(SFLAG_WHILE_BLOCK) $(SFLAG_HINTS) $(SFLAG_IF_BLOCK) $(SFLAG_FOR_BLOCK)\
|
||||
$(SFLAG_POINT_ARITH) $(SFLAG_ELSEIF_COMPLETE) $(SFLAG_UNCONSTRAIN_MODIFY)\
|
||||
$(SFLAG_EFFECT_UNCONSTRAIN) $(SFLAG_OBSERVER_MODIFY)\
|
||||
$(SFLAG_FORMAT-TYPE) $(SFLAG_ALIASING) $(SFLAG_STORAGE_TRANSFER)\
|
||||
$(SFLAG_DEEP_BREAK) $(SFLAG_INCONSISTENT_BRANCH) $(SFLAG_PROBLEMATIC_CTR)\
|
||||
$(SFLAG_UNDEFINED_EVALORDER) $(SFLAG_INITIALIZERS) $(SFLAG_PRIMITIVE_OPERA)\
|
||||
$(SFLAG_DECLARARIONS) $(SFLAG_COMPLETE_PRG) $(SFLAG_EXPORTS) $(SFLAG_INCLUDE)\
|
||||
$(SFLAG_STREAM_OVERWRITE) $(SFLAG_WARN_FILE) $(SFLAG_ERROR_FILE)\
|
||||
$(SFLAG_ACCESS) $(SFLAG_ISO_CONFORMANCE) $(SFLAG_BUFFER) $(SFLAG_SIZEOF_TYPE)\
|
||||
$(SFLAG_COMP_DEF) $(SFLAG_FUNC_NOPARAM) $(SFLAG_TRY_TO_RECOVER)\
|
||||
$(SFLAG_EXPORT_CONST) $(SFLAG_DUMP) $(SFLAG_LOAD) $(SFLAG_NULL_RET)\
|
||||
$(SFLAG_NULL_STATE) $(SFLAG_USE_BEFORE_DEF) $(SFLAG_FORMAT_CONST)\
|
||||
$(SFLAG_EXIT_ARG) $(SFLAG_EXTERN) $(SFLAG_OLD_STTLE) $(SFLAG_DIR)\
|
||||
$(SFLAG_SHIFT_NEG) $(SFLAG_PREPROC)
|
||||
|
||||
##--------------------------------------
|
||||
##
|
||||
## MAKE_INDENT template
|
||||
##
|
||||
##------------------------------------
|
||||
|
||||
define SPLINT_FILE
|
||||
@echo -e "Splinting: $(notdir $(1)) \t\t\t please wait ..."
|
||||
@nohup splint $(SPLINT_FLAGS) $(1) | sed '$d' | sed '1,2d' |\
|
||||
sed '/Splint /d' | sed '/Finished /d' |\
|
||||
sed '/Cannot continue/d'
|
||||
|
||||
endef
|
||||
|
||||
##@echo $(SPLINT_FLAGS)
|
||||
define MAKE_SPLINT
|
||||
@echo
|
||||
|
||||
$(foreach file,$(1),$(call SPLINT_FILE, $(file)))
|
||||
@echo
|
||||
@echo =======================================End======================================
|
||||
endef
|
||||
Reference in New Issue
Block a user