SST code sanity

1) as of 2016-05-26

https://drupal.star.bnl.gov/STAR/comp/sofi/soft-n-libs/sanity

a) cpp check 

For :

StRoot/
StSsdDbMaker  StSstDaqMaker  StSstPointMaker  StSstUtil
cppcheck --force --enable=information StRoot/
Checking StRoot/StSsdDbMaker/StSsdDbMaker.cxx...
Checking StRoot/StSsdDbMaker/StSsdDbMaker.cxx: StMaker_H...
1/20 files checked 3% done
Checking StRoot/StSsdDbMaker/StSstDbMaker.cxx...
Checking StRoot/StSsdDbMaker/StSstDbMaker.cxx: StMaker_H...
2/20 files checked 6% done
Checking StRoot/StSstDaqMaker/StSstDaqMaker.cxx...
3/20 files checked 19% done
Checking StRoot/StSstPointMaker/StSstPointMaker.cxx...
Checking StRoot/StSstPointMaker/StSstPointMaker.cxx: StMaker_H...
4/20 files checked 26% done
Checking StRoot/StSstUtil/StSpaListNoise.cc...
5/20 files checked 28% done
Checking StRoot/StSstUtil/StSpaNoise.cc...
6/20 files checked 29% done
Checking StRoot/StSstUtil/StSstBarrel.cc...
7/20 files checked 45% done
Checking StRoot/StSstUtil/StSstCluster.cc...
8/20 files checked 47% done
Checking StRoot/StSstUtil/StSstClusterControl.cxx...
9/20 files checked 47% done
Checking StRoot/StSstUtil/StSstClusterList.cc... [StRoot/StSstUtil/StSstClusterList.cc:267]: (error) Memory leak: minima [StRoot/StSstUtil/StSstClusterList.cc:267]: (error) Memory leak: maxima [StRoot/StSstUtil/StSstClusterList.cc:267]: (error) Memory leak: keyToIdStrip
10/20 files checked 50% done
Checking StRoot/StSstUtil/StSstConfig.cc...
11/20 files checked 51% done
Checking StRoot/StSstUtil/StSstDynamicControl.cxx...
12/20 files checked 52% done
Checking StRoot/StSstUtil/StSstLadder.cc...
13/20 files checked 53% done
Checking StRoot/StSstUtil/StSstPackage.cc...
14/20 files checked 55% done
Checking StRoot/StSstUtil/StSstPackageList.cc...
15/20 files checked 55% done
Checking StRoot/StSstUtil/StSstPoint.cc...
16/20 files checked 56% done
Checking StRoot/StSstUtil/StSstPointList.cc...
17/20 files checked 59% done
Checking StRoot/StSstUtil/StSstStrip.cc...
18/20 files checked 59% done
Checking StRoot/StSstUtil/StSstStripList.cc...
19/20 files checked 62% done
Checking StRoot/StSstUtil/StSstWafer.cc...
20/20 files checked 100% done
(information) Cppcheck cannot find all the include files (use --check-config for details)



2) as of 2016-05-27
coverity report  : here 
(links to SST codes will not work since I only imported the summary/index.html from coverity but it's enough to check what errors remain)

coverity report (after StSstPointMaker DEAD_CODE fixed) : here 
 
3) StSstDbMaker

STACK_USE error 

(1) Event stack_use_local_overflow: Local variable "row" uses 30720 bytes of stack space, which exceeds the maximum single use of 10000 bytes.
169  	   sstWafersPosition_st row;
170  	   memset (&row, 0, sizeof(sstWafersPosition_st));


Reason is because sstWaferPositions is too large :
 

struct sstWafersPosition { 
  double  driftDirection[960];       /* Drift direction  */
  double  normalDirection[960];      /* Coordinates of unit vector normal to wafer */
  double  transverseDirection[960];  /* t=nxd, transverse to drift and normal direction    */
  double  centerPosition[960];       /* coordinates of the wafer center in the Star syst  */ 
  
};   


8 bytes (double) * 4 * 960 = 30720
Even with float (4 bytes), it will be over the maximum size

4) as of 2016-06-27 (StSstUtil)

Analysis summary report:
------------------------
Files analyzed                 : 158
Total LoC input to cov-analyze : 101833
Functions analyzed             : 838
Classes/structs analyzed       : 307
Paths analyzed                 : 21517
Time taken by analysis         : 00:01:12
Defect occurrences found       : 73 Total
                                  9 FORWARD_NULL
                                  2 PASS_BY_VALUE
                                  1 PW.INCLUDE_RECURSION
                                 12 PW.USELESS_TYPE_QUALIFIER_ON_RETURN_TYPE
                                 29 RESOURCE_LEAK
                                  2 REVERSE_INULL
                                 17 UNINIT_CTOR
                                  1 UNREACHABLE