[GiNaC-list] [cppcheck] found a few issues

Martin Ettl ettl.martin at gmx.de
Thu May 13 23:49:33 CEST 2010


Hello,

i have checked the source of the current git head from ginac with the static code analysis tool cppcheck (http://sourceforge.net/projects/cppcheck/). It found a few uninitialized variables, const correctness issues...

Please refer the attached output ( it may help to make ginac even more stable):

[time_lw_M2.cpp:160]: (Style) The scope of the variable count can be reduced
[time_lw_N.cpp:64]: (Style) The scope of the variable count can be reduced
[exam_cra.cpp:85]: (Style) Function parameter 'ntimes' is passed by value. It could be passed by reference instead.
[exam_inifcns_nstdsums.cpp:236]: (Style) Variable 'digitsbuf' is assigned a value that is never used
[time_uvar_gcd.cpp:1854]: (Style) Function parameter 'deg' is passed by value. It could be passed by reference instead.
[time_uvar_gcd.cpp:1889]: (Style) Function parameter 'deg' is passed by value. It could be passed by reference instead.
[mul_eval_memleak.cpp:84]: (Style) Variable 'n_failures' is assigned a value that is never used
[time_lw_Qprime.cpp:78]: (Style) The scope of the variable count can be reduced
[exam_mod_gcd.cpp:39]: (Style) Function parameter 'deg' is passed by value. It could be passed by reference instead.
[exam_mod_gcd.cpp:41]: (Style) Function parameter 'deg' is passed by value. It could be passed by reference instead.
[exam_mod_gcd.cpp:97]: (Style) Function parameter 'deg' is passed by value. It could be passed by reference instead.
[timer.cpp:85]: (Style) Unused variable: elapsed
[timer.cpp:100] -> [timer.h:43]: (Style) The function 'timer::running' can be const
[time_lw_Q.cpp:66]: (Style) The scope of the variable count can be reduced
[../doc/examples/compile2.cpp:41]: (Style) Unused variable: comp
[../doc/examples/compile2.cpp:41]: (Style) Unused variable: nregions
[../doc/examples/compile1.cpp:36]: (Style) Variable 'result' is not assigned a value
[../ginac/remember.cpp:36]: (Style) Member variable not initialized in the constructor 'remember_table_entry::last_access'
[../ginac/basic.h:112]: (Style) Member variable not initialized in the constructor 'basic::hashvalue'
[../ginac/archive.h:66]: (Style) Member variable not initialized in the constructor 'property_info::count'
[../ginac/archive.h:66]: (Style) Member variable not initialized in the constructor 'property_info::type'
[../ginac/archive.h:77]: (Style) Member variable not initialized in the constructor 'property::value'
[../ginac/archive.h:77]: (Style) Member variable not initialized in the constructor 'property::name'
[../ginac/archive.h:77]: (Style) Member variable not initialized in the constructor 'property::type'
[../ginac/archive.h:308]: (Style) Member variable not initialized in the constructor 'archived_ex::root'
[../ginac/archive.h:308]: (Style) Member variable not initialized in the constructor 'archived_ex::name'
[../ginac/ptr.h:35]: (Error) Class refcounted which is inherited by class basic does not have a virtual destructor
[../ginac/relational.h:90]: (Style) The function 'safe_bool_helper::nonnull' can be const
[../ginac/parser/parser.cpp:187]: (Style) Member variable not initialized in the constructor 'parser::token'
[../ginac/excompiler.h:95]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.h:105]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.h:115]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.h:122]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.cpp:313]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.cpp:318]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.cpp:323]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.cpp:328]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.cpp:333]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.cpp:338]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.cpp:343]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.cpp:115]: (Style) Found 'mktemp'. You should use 'mkstemp' instead
[../ginac/excompiler.cpp:141]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.cpp:154]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.cpp:170]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.cpp:195]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.cpp:220]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.cpp:245]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.cpp:280]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.cpp:287]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.cpp:294]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.cpp:301]: (Style) Function parameter 'filename' is passed by value. It could be passed by reference instead.
[../ginac/excompiler.cpp:175]: (Error) Dangerous iterator usage. After erase the iterator is invalid so dereferencing it or comparing it with another iterator is invalid.
[../ginac/pseries.cpp:432]: (Style) Redundant condition. It is safe to deallocate a NULL pointer
[../ginac/archive.cpp:599] -> [../ginac/archive.h:142]: (Style) The function 'archive_node::forget' can be const
[../ginac/expairseq.cpp:1291]: (Style) Variable 'erased' is assigned a value that is never used
[../ginac/expairseq.cpp:72]: (Style) Member variable not initialized in the constructor 'expairseq::hashmask'
[../ginac/expairseq.cpp:374]: (Style) Redundant condition. It is safe to deallocate a NULL pointer
[../ginac/matrix.cpp:1447]: (Style) Variable 'check' is assigned a value that is never used
[../ginac/relational.cpp:44]: (Style) Member variable not initialized in the constructor 'relational::o'

Best regards

Ettl Martin
 
-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01


More information about the GiNaC-list mailing list