123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135(**************************************************************************)(* *)(* SPDX-License-Identifier LGPL-2.1 *)(* Copyright (C) *)(* CEA (Commissariat à l'énergie atomique et aux énergies alternatives) *)(* *)(**************************************************************************)lethelp_msg="generates annotations for runtime error checking"includePlugin.Register(structletname="RteGen"letshortname="rte"lethelp=help_msgend)(* enabling/disabling plugin *)moduleEnabled=False(structletoption_name="-rte"lethelp="when on (off by default), "^help_msgend)(* annotates division by zero (undefined behavior) *)moduleDoDivMod=True(structletoption_name="-rte-div"lethelp="when on (default), annotate for modulo and division by zero"end)(* annotates left and right shifts (undefined behavior) *)moduleDoShift=True(structletoption_name="-rte-shift"lethelp="when on (default), annotate for left and right shifts by a value out of bounds"end)(* annotates casts from floating-point to integer (undefined behavior) *)moduleDoFloatToInt=True(structletoption_name="-rte-float-to-int"lethelp="when on (default), annotate casts from floating-point to \
integer"end)(* annotates local variables and pointers read (aside from globals) initialization *)moduleDoInitialized=Kernel_function_set(structletoption_name="-rte-initialized"letarg_name="fct"lethelp="for each function in 'fct', annotates reads of non struct or \
union values from local variables and pointers with \
initialization tests, see documentation for more details"end)(* annotates invalid memory access (undefined behavior) *)moduleDoMemAccess=True(structletoption_name="-rte-mem"lethelp="when on (default), annotate for valid pointer or \
array access"end)(* annotates calls through pointers *)moduleDoPointerCall=True(structletoption_name="-rte-pointer-call"lethelp="when on, annotate functions calls through pointers"end)(* uses results of basic constant propagation in order to check
validity / invalidity of generated assertions, emitting a status if possible.
Notice that annotations that can be considered valid from syntactical rules
are also considered as trivial.
*)moduleTrivial=False(structletoption_name="-rte-trivial-annotations"lethelp="generate all annotations even if they trivially hold \
(from evaluation of constant expressions, syntactical rules...)"(* if on, evaluates constants in order to check if assertions
are trivially true / false *)end)(* emits a warning when an assertion generated by rte is clearly invalid
(using constant folding, see ConstFold *)moduleWarn=True(structletoption_name="-rte-warn"lethelp="when on (default), emits warning on broken asserts"end)(* this option allows the user to select a set of functions on which
the plug-in performs its jobs (and only those).
By default all functions are annotated *)moduleFunctionSelection=Kernel_function_set(structletoption_name="-rte-select"letarg_name="fun"lethelp="select <fun> for analysis (default all functions)"end)letdkey_annot=register_category"annot"~default:true~help:"message about function annotations"let()=ifnotEva_analysis.is_availablethenParameter_customize.is_invisible()moduleUseEvaResults=Bool(structletoption_name="-rte-use-eva-results"letdefault=Eva_analysis.is_availablelethelp="When enabled, do not emit annotations on functions analyzed by Eva"end)letuse_eva_results()=ifUseEvaResults.get()&¬Eva_analysis.is_availablethenwarning~once:true"-rte-use-eva-results is set while Eva is not available, ignoring";UseEvaResults.get()