Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix more clang issues. #3592

Merged
merged 1 commit into from May 2, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
43 changes: 22 additions & 21 deletions CondFormats/L1TObjects/src/L1MuCSCTFConfiguration.cc
@@ -1,6 +1,7 @@
#include "CondFormats/L1TObjects/interface/L1MuCSCTFConfiguration.h"
#include <sstream>
#include <iostream>
#include <stdlib.h>
#include "FWCore/MessageLogger/interface/MessageLogger.h"

edm::ParameterSet L1MuCSCTFConfiguration::parameters(int sp) const {
Expand Down Expand Up @@ -247,7 +248,7 @@ edm::ParameterSet L1MuCSCTFConfiguration::parameters(int sp) const {
std::string comments_; std::getline(line,comments_);

if( register_=="CSR_REQ" && chip_=="SP" ){
unsigned int value = strtol(writeValue_.c_str(),'\0',16);
unsigned int value = ::strtol(writeValue_.c_str(),'\0',16);
run_core = (value&0x8000);
trigger_on_ME1a = (value&0x0001);
trigger_on_ME1b = (value&0x0002);
Expand All @@ -260,7 +261,7 @@ edm::ParameterSet L1MuCSCTFConfiguration::parameters(int sp) const {


if( register_=="CSR_SCC" && chip_=="SP" ){
unsigned int value = strtol(writeValue_.c_str(),'\0',16);
unsigned int value = ::strtol(writeValue_.c_str(),'\0',16);

BXAdepth = (value&0x3);
useDT = ( (value&0x80)>>7 );
Expand All @@ -270,54 +271,54 @@ edm::ParameterSet L1MuCSCTFConfiguration::parameters(int sp) const {


if( register_=="CSR_LQE" && chip_=="F1" && muon_=="M1" )
QualityEnableME1a = strtol(writeValue_.c_str(),'\0',16);
QualityEnableME1a = ::strtol(writeValue_.c_str(),'\0',16);
if( register_=="CSR_LQE" && chip_=="F1" && muon_=="M2" )
QualityEnableME1b = strtol(writeValue_.c_str(),'\0',16);
QualityEnableME1b = ::strtol(writeValue_.c_str(),'\0',16);
if( register_=="CSR_LQE" && chip_=="F1" && muon_=="M3" )
QualityEnableME1c = strtol(writeValue_.c_str(),'\0',16);
QualityEnableME1c = ::strtol(writeValue_.c_str(),'\0',16);
if( register_=="CSR_LQE" && chip_=="F2" && muon_=="M1" )
QualityEnableME1d = strtol(writeValue_.c_str(),'\0',16);
QualityEnableME1d = ::strtol(writeValue_.c_str(),'\0',16);
if( register_=="CSR_LQE" && chip_=="F2" && muon_=="M2" )
QualityEnableME1e = strtol(writeValue_.c_str(),'\0',16);
QualityEnableME1e = ::strtol(writeValue_.c_str(),'\0',16);
if( register_=="CSR_LQE" && chip_=="F2" && muon_=="M3" )
QualityEnableME1f = strtol(writeValue_.c_str(),'\0',16);
QualityEnableME1f = ::strtol(writeValue_.c_str(),'\0',16);
if( register_=="CSR_LQE" && chip_=="F3" && muon_=="M1" )
QualityEnableME2a = strtol(writeValue_.c_str(),'\0',16);
QualityEnableME2a = ::strtol(writeValue_.c_str(),'\0',16);
if( register_=="CSR_LQE" && chip_=="F3" && muon_=="M2" )
QualityEnableME2b = strtol(writeValue_.c_str(),'\0',16);
QualityEnableME2b = ::strtol(writeValue_.c_str(),'\0',16);
if( register_=="CSR_LQE" && chip_=="F3" && muon_=="M3" )
QualityEnableME2c = strtol(writeValue_.c_str(),'\0',16);
QualityEnableME2c = ::strtol(writeValue_.c_str(),'\0',16);
if( register_=="CSR_LQE" && chip_=="F4" && muon_=="M1" )
QualityEnableME3a = strtol(writeValue_.c_str(),'\0',16);
QualityEnableME3a = ::strtol(writeValue_.c_str(),'\0',16);
if( register_=="CSR_LQE" && chip_=="F4" && muon_=="M2" )
QualityEnableME3b = strtol(writeValue_.c_str(),'\0',16);
QualityEnableME3b = ::strtol(writeValue_.c_str(),'\0',16);
if( register_=="CSR_LQE" && chip_=="F4" && muon_=="M3" )
QualityEnableME3c = strtol(writeValue_.c_str(),'\0',16);
QualityEnableME3c = ::strtol(writeValue_.c_str(),'\0',16);
if( register_=="CSR_LQE" && chip_=="F5" && muon_=="M1" )
QualityEnableME4a = strtol(writeValue_.c_str(),'\0',16);
QualityEnableME4a = ::strtol(writeValue_.c_str(),'\0',16);
if( register_=="CSR_LQE" && chip_=="F5" && muon_=="M2" )
QualityEnableME4b = strtol(writeValue_.c_str(),'\0',16);
QualityEnableME4b = ::strtol(writeValue_.c_str(),'\0',16);
if( register_=="CSR_LQE" && chip_=="F5" && muon_=="M3" )
QualityEnableME4c = strtol(writeValue_.c_str(),'\0',16);
QualityEnableME4c = ::strtol(writeValue_.c_str(),'\0',16);

if( register_=="CSR_KFL" )
kill_fiber = strtol(writeValue_.c_str(),'\0',16);
kill_fiber = ::strtol(writeValue_.c_str(),'\0',16);

if( register_=="CSR_SFC" && chip_=="SP" ){
unsigned int value = strtol(writeValue_.c_str(),'\0',16);
unsigned int value = ::strtol(writeValue_.c_str(),'\0',16);
singlesTrackOutput = ((value&0x3000)>>12);
}

if( register_=="CNT_ETA" && chip_=="SP" ){
unsigned int value = strtol(writeValue_.c_str(),'\0',16);
unsigned int value = ::strtol(writeValue_.c_str(),'\0',16);
eta_cnt = value;
}


// LATEST VERSION FROM CORE 2010-01-22 at http://www.phys.ufl.edu/~madorsky/sp/2010-01-22
if( register_=="DAT_ETA" && chip_=="SP" ){

unsigned int value = strtol(writeValue_.c_str(),'\0',16);
unsigned int value = ::strtol(writeValue_.c_str(),'\0',16);

//std::cout<<"DAT_ETA SP value:"<<value<<std::endl;

Expand Down
2 changes: 0 additions & 2 deletions DataFormats/CSCDigi/test/testCSCDigis.cpp
Expand Up @@ -10,8 +10,6 @@
* \author A. Tumanov, Rice U.
*/

static const char CVSId[] = "$Id: testCSCDigis.cpp,v 1.23 2008/10/29 18:34:41 elmer Exp $";

#include <cppunit/extensions/HelperMacros.h>
#include "DataFormats/MuonDetId/interface/CSCDetId.h"
#include "DataFormats/FEDRawData/interface/FEDNumbering.h"
Expand Down
4 changes: 4 additions & 0 deletions DataFormats/GeometryVector/test/BasicVector_t.cpp
Expand Up @@ -113,7 +113,11 @@ int main() {
#endif


#ifdef __clang__
std::cout << "biggest alignment " << sizeof(double) << std::endl;
#else
std::cout << "biggest alignment " << __BIGGEST_ALIGNMENT__ << std::endl;
#endif



Expand Down
2 changes: 1 addition & 1 deletion DataFormats/L1Trigger/src/L1ParticleMap.cc
Expand Up @@ -184,7 +184,7 @@ L1ParticleMap::L1ParticleMap(
const L1IndexComboVector& indexCombos )
: triggerType_( triggerType ),
triggerDecision_( triggerDecision ),
indexCombosState_{indexCombos.size()>0? kSet:kUnset},
indexCombosState_{static_cast<char>(indexCombos.size()>0? kSet:kUnset)},
objectTypes_( objectTypes ),
emParticles_( emParticles ),
jetParticles_( jetParticles ),
Expand Down
15 changes: 1 addition & 14 deletions DataFormats/ParticleFlowReco/src/PFCluster.cc
Expand Up @@ -71,20 +71,7 @@ double PFCluster::getDepthCorrection(double energy, bool isBelowPS,
corrA = depthCorAp_;
corrB = depthCorBp_;
}
double depth = 0;
switch(isHadron) {
case 0: // e/gamma
depth = corrA*(corrB + log(energy));
break;
case 1: // hadrons
depth = corrA;
break;
default:
assert(0);
// edm::LogError("PFCluster") << "unknown function for depth correction!"
// << std::endl;
}
return depth;
return isHadron ? corrA : corrA*(corrB + log(energy));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes behaviour: for isHadron not being either 0 or 1 the new code returns some value, while the old code asserts. Not sure if that's acceptable and/or what you wanted ...:) As it's not really my area of expertise, I'll still +1 for DB.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isHadron is a bool, though, which casts to either 0 or 1.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, did not see that one. Thanks ! :)

On Wed, Apr 30, 2014 at 9:59 PM, Giulio Eulisse notifications@github.comwrote:

In DataFormats/ParticleFlowReco/src/PFCluster.cc:

@@ -71,20 +71,7 @@ double PFCluster::getDepthCorrection(double energy, bool isBelowPS,
corrA = depthCorAp_;
corrB = depthCorBp_;
}

  • double depth = 0;
  • switch(isHadron) {
  • case 0: // e/gamma
  • depth = corrA*(corrB + log(energy));
  • break;
  • case 1: // hadrons
  • depth = corrA;
  • break;
  • default:
  • assert(0);
  • // edm::LogError("PFCluster") << "unknown function for depth correction!"
  • // << std::endl;
  • }
  • return depth;
  • return isHadron ? corrA : corrA*(corrB + log(energy));

isHadron is a bool, though, which casts to either 0 or 1.


Reply to this email directly or view it on GitHubhttps://github.com//pull/3592/files#r12162598
.

Thanks,
cheers, andreas

}

void PFCluster::setLayer( PFLayer::Layer layer) {
Expand Down
10 changes: 0 additions & 10 deletions DataFormats/TrackReco/src/TrackResiduals.cc
Expand Up @@ -126,16 +126,6 @@ unsigned char TrackResiduals::pack_pull (double pull)
return sgn + mag;
}

static const double residual_char_to_double[8][2] = {
{ 0, 0.5 },
{ 0.5, 1 },
{ 1, 1.5 },
{ 1.5, 2 },
{ 2, 2.5 },
{ 2.5, 3.5 },
{ 3.5, 4.5 },
{ 4.5, 5.5 },
};

double TrackResiduals::unpack_residual (unsigned char pull)
{
Expand Down
2 changes: 1 addition & 1 deletion DataFormats/TrackerCommon/src/ClusterSummary.cc
Expand Up @@ -8,7 +8,7 @@ ClusterSummary::ClusterSummary()

ClusterSummary::~ClusterSummary()
{
delete userContent;
delete userContent.load();
userContent = nullptr;
}

Expand Down