diff --git a/src/plugins/wp/WpTarget.ml b/src/plugins/wp/WpTarget.ml index 4dc9ae541c5ea88b00d1186f2f1dc40eea77b7da..10d122bee5a79927ac7c2e3d9bb71dfb0880e672 100644 --- a/src/plugins/wp/WpTarget.ml +++ b/src/plugins/wp/WpTarget.ml @@ -52,11 +52,22 @@ let calls_visitor callees = object(self) | _ -> Cil.SkipChildren end -let add_with_dependencies kf = +(** Note: we add the kf received in parameter in the set only if it has a + definition (and thus if it does not have one, we add nothing as it has + no visible callee). + + This prevent to warn on prototypes that have a contract but are unused. If + the function is used, it will be added to the set via its caller(s) if they + are under verification. +*) +let add_with_callees kf = let component kf = - let set = ref (Fct.singleton kf) in - ignore (Visitor.visitFramacKf (calls_visitor set) kf) ; - !set + if Kernel_function.has_definition kf then begin + let set = ref (Fct.singleton kf) in + ignore (Visitor.visitFramacKf (calls_visitor set) kf) ; + !set + end else + Fct.empty in Fct.iter TargetKfs.add (component kf) @@ -147,10 +158,10 @@ let check_properties behaviors props kf = let add_with_behaviors behaviors props kf = if behaviors = [] && props = [] then - add_with_dependencies kf + add_with_callees kf else begin try check_properties behaviors props kf - with Found -> add_with_dependencies kf + with Found -> add_with_callees kf end let compute model = diff --git a/src/plugins/wp/tests/wp_bts/oracle/issue-684-exit.res.oracle b/src/plugins/wp/tests/wp_bts/oracle/issue-684-exit.res.oracle index f5c27f43319456aeb2ab9d5c59f1960109477a78..cb499212b74e034784cefec5bc0743455477de99 100644 --- a/src/plugins/wp/tests/wp_bts/oracle/issue-684-exit.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle/issue-684-exit.res.oracle @@ -25,75 +25,3 @@ Goal Assigns nothing in 'inconditional_exit': Prove: true. ------------------------------------------------------------ -[wp] Warning: Memory model hypotheses for function 'seed48': - /*@ - behavior typed: - requires - \separated( - seed16v + (..), (unsigned short *)__fc_random48_counter + (..), - &__fc_random48_init, &__fc_p_random48_counter - ); - */ - extern unsigned short *seed48(unsigned short * /*[3]*/ seed16v); -[wp] Warning: Memory model hypotheses for function 'lcong48': - /*@ - behavior typed: - requires - \separated( - param + (..), (unsigned short *)__fc_random48_counter + (..), - &__fc_random48_init - ); - */ - extern void lcong48(unsigned short * /*[7]*/ param); -[wp] Warning: Memory model hypotheses for function 'erand48': - /*@ - behavior typed: - requires - \separated( - xsubi + (..), (unsigned short *)__fc_random48_counter + (..) - ); - */ - extern double erand48(unsigned short * /*[3]*/ xsubi); -[wp] Warning: Memory model hypotheses for function 'nrand48': - /*@ - behavior typed: - requires - \separated( - xsubi + (..), (unsigned short *)__fc_random48_counter + (..) - ); - */ - extern long nrand48(unsigned short * /*[3]*/ xsubi); -[wp] Warning: Memory model hypotheses for function 'jrand48': - /*@ - behavior typed: - requires - \separated( - xsubi + (..), (unsigned short *)__fc_random48_counter + (..) - ); - */ - extern long jrand48(unsigned short * /*[3]*/ xsubi); -[wp] Warning: Memory model hypotheses for function 'getenv': - /*@ - behavior typed: - requires \separated(name + (..), (char **)__fc_env + (..)); - */ - extern char *getenv(char const *name); -[wp] Warning: Memory model hypotheses for function 'putenv': - /*@ - behavior typed: - requires \separated(string + (..), (char **)__fc_env + (..)); - */ - extern int putenv(char *string); -[wp] Warning: Memory model hypotheses for function 'setenv': - /*@ - behavior typed: - requires - \separated((char **)__fc_env + (..), {name + (..), value + (..)}); - */ - extern int setenv(char const *name, char const *value, int overwrite); -[wp] Warning: Memory model hypotheses for function 'unsetenv': - /*@ - behavior typed: - requires \separated(name + (..), (char **)__fc_env + (..)); - */ - extern int unsetenv(char const *name); diff --git a/src/plugins/wp/tests/wp_bts/oracle_qualif/issue-684-exit.res.oracle b/src/plugins/wp/tests/wp_bts/oracle_qualif/issue-684-exit.res.oracle index 4301abb0fa78255ca714f32e6d73cdbf33adc3be..be5d63c71f629ebf2cfc190d1532174e3f93b970 100644 --- a/src/plugins/wp/tests/wp_bts/oracle_qualif/issue-684-exit.res.oracle +++ b/src/plugins/wp/tests/wp_bts/oracle_qualif/issue-684-exit.res.oracle @@ -13,75 +13,3 @@ Functions WP Alt-Ergo Total Success inconditional_exit 4 - 4 100% ------------------------------------------------------------ -[wp] Warning: Memory model hypotheses for function 'seed48': - /*@ - behavior typed: - requires - \separated( - seed16v + (..), (unsigned short *)__fc_random48_counter + (..), - &__fc_random48_init, &__fc_p_random48_counter - ); - */ - extern unsigned short *seed48(unsigned short * /*[3]*/ seed16v); -[wp] Warning: Memory model hypotheses for function 'lcong48': - /*@ - behavior typed: - requires - \separated( - param + (..), (unsigned short *)__fc_random48_counter + (..), - &__fc_random48_init - ); - */ - extern void lcong48(unsigned short * /*[7]*/ param); -[wp] Warning: Memory model hypotheses for function 'erand48': - /*@ - behavior typed: - requires - \separated( - xsubi + (..), (unsigned short *)__fc_random48_counter + (..) - ); - */ - extern double erand48(unsigned short * /*[3]*/ xsubi); -[wp] Warning: Memory model hypotheses for function 'nrand48': - /*@ - behavior typed: - requires - \separated( - xsubi + (..), (unsigned short *)__fc_random48_counter + (..) - ); - */ - extern long nrand48(unsigned short * /*[3]*/ xsubi); -[wp] Warning: Memory model hypotheses for function 'jrand48': - /*@ - behavior typed: - requires - \separated( - xsubi + (..), (unsigned short *)__fc_random48_counter + (..) - ); - */ - extern long jrand48(unsigned short * /*[3]*/ xsubi); -[wp] Warning: Memory model hypotheses for function 'getenv': - /*@ - behavior typed: - requires \separated(name + (..), (char **)__fc_env + (..)); - */ - extern char *getenv(char const *name); -[wp] Warning: Memory model hypotheses for function 'putenv': - /*@ - behavior typed: - requires \separated(string + (..), (char **)__fc_env + (..)); - */ - extern int putenv(char *string); -[wp] Warning: Memory model hypotheses for function 'setenv': - /*@ - behavior typed: - requires - \separated((char **)__fc_env + (..), {name + (..), value + (..)}); - */ - extern int setenv(char const *name, char const *value, int overwrite); -[wp] Warning: Memory model hypotheses for function 'unsetenv': - /*@ - behavior typed: - requires \separated(name + (..), (char **)__fc_env + (..)); - */ - extern int unsetenv(char const *name);