Skip to content

Commit

Permalink
Merge pull request cms-sw#5711 from Dr15Jones/fixClangProblemsInFWCore
Browse files Browse the repository at this point in the history
Fix clang problems in FWCore
  • Loading branch information
ktf committed Oct 7, 2014
2 parents 386a0cc + 276be4d commit a2eb259
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 51 deletions.
42 changes: 21 additions & 21 deletions FWCore/FWLite/test/ref_t.cppunit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,29 +388,29 @@ void testRefInROOT::testThinning() {

CPPUNIT_ASSERT(trackD.refVector1[0]->a == 10 + offset);
CPPUNIT_ASSERT(trackD.refVector1[4]->a == 14 + offset);
CPPUNIT_ASSERT_THROW(trackD.refVector1[8]->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackD.refVector1[8].operator->(), cms::Exception);
CPPUNIT_ASSERT(!trackD.refVector1.isAvailable());
CPPUNIT_ASSERT(trackD.refVector1[0]->a == 10 + offset);
CPPUNIT_ASSERT(trackD.refVector1[4]->a == 14 + offset);
CPPUNIT_ASSERT_THROW(trackD.refVector1[8]->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackD.refVector1[8].operator->(), cms::Exception);

CPPUNIT_ASSERT(trackD.ptrVector1[0]->a == 10 + offset);
CPPUNIT_ASSERT(trackD.ptrVector1[4]->a == 14 + offset);
CPPUNIT_ASSERT_THROW(trackD.ptrVector1[8]->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackD.ptrVector1[8].operator->(), cms::Exception);
CPPUNIT_ASSERT(trackD.ptrVector1[9]->a == 21 + offset);
CPPUNIT_ASSERT(!trackD.ptrVector1.isAvailable());
CPPUNIT_ASSERT(trackD.ptrVector1[0]->a == 10 + offset);
CPPUNIT_ASSERT(trackD.ptrVector1[4]->a == 14 + offset);
CPPUNIT_ASSERT_THROW(trackD.ptrVector1[8]->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackD.ptrVector1[8].operator->(), cms::Exception);
CPPUNIT_ASSERT(trackD.ptrVector1[9]->a == 21 + offset);

CPPUNIT_ASSERT(trackD.refToBaseVector1[0]->a == 10 + offset);
CPPUNIT_ASSERT(trackD.refToBaseVector1[4]->a == 14 + offset);
CPPUNIT_ASSERT_THROW(trackD.refToBaseVector1[8]->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackD.refToBaseVector1[8].operator->(), cms::Exception);
CPPUNIT_ASSERT(!trackD.refToBaseVector1.isAvailable());
CPPUNIT_ASSERT(trackD.refToBaseVector1[0]->a == 10 + offset);
CPPUNIT_ASSERT(trackD.refToBaseVector1[4]->a == 14 + offset);
CPPUNIT_ASSERT_THROW(trackD.refToBaseVector1[8]->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackD.refToBaseVector1[8].operator->(), cms::Exception);

// In the G branch this tests accessing a value in
// thinned collection made from a master collection.
Expand Down Expand Up @@ -462,11 +462,11 @@ void testRefInROOT::testThinning() {

edmtest::TrackOfThings const& trackM0 = vTracks->at(0);
CPPUNIT_ASSERT(!trackM0.ref1.isAvailable());
CPPUNIT_ASSERT_THROW(trackM0.ref1->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackM0.ref1.operator->(), cms::Exception);
CPPUNIT_ASSERT(!trackM0.ptr1.isAvailable());
CPPUNIT_ASSERT_THROW(trackM0.ptr1->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackM0.ptr1.operator->(), cms::Exception);
CPPUNIT_ASSERT(!trackM0.refToBase1.isAvailable());
CPPUNIT_ASSERT_THROW(trackM0.refToBase1->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackM0.refToBase1.operator->(), cms::Exception);

edmtest::TrackOfThings const& trackM1 = vTracks->at(1);
CPPUNIT_ASSERT(trackM1.ref1.isAvailable());
Expand All @@ -477,29 +477,29 @@ void testRefInROOT::testThinning() {
CPPUNIT_ASSERT(trackM1.refToBase1->a == 44 + offset);

edmtest::TrackOfThings const& trackM = vTracks->at(0);
CPPUNIT_ASSERT_THROW(trackM.refVector1[0]->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackM.refVector1[0].operator->(), cms::Exception);
CPPUNIT_ASSERT(trackM.refVector1[4]->a == 44 + offset);
CPPUNIT_ASSERT_THROW(trackM.refVector1[8]->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackM.refVector1[8].operator->(), cms::Exception);
CPPUNIT_ASSERT(!trackM.refVector1.isAvailable());
CPPUNIT_ASSERT_THROW(trackM.refVector1[0]->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackM.refVector1[0].operator->(), cms::Exception);
CPPUNIT_ASSERT(trackM.refVector1[4]->a == 44 + offset);
CPPUNIT_ASSERT_THROW(trackM.refVector1[8]->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackM.refVector1[8].operator->(), cms::Exception);

CPPUNIT_ASSERT_THROW(trackM.ptrVector1[0]->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackM.ptrVector1[0].operator->(), cms::Exception);
CPPUNIT_ASSERT(trackM.ptrVector1[4]->a == 44 + offset);
CPPUNIT_ASSERT_THROW(trackM.ptrVector1[8]->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackM.ptrVector1[8].operator->(), cms::Exception);
CPPUNIT_ASSERT(!trackM.ptrVector1.isAvailable());
CPPUNIT_ASSERT_THROW(trackM.ptrVector1[0]->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackM.ptrVector1[0].operator->(), cms::Exception);
CPPUNIT_ASSERT(trackM.ptrVector1[4]->a == 44 + offset);
CPPUNIT_ASSERT_THROW(trackM.ptrVector1[8]->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackM.ptrVector1[8].operator->(), cms::Exception);

CPPUNIT_ASSERT_THROW(trackM.refToBaseVector1[0]->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackM.refToBaseVector1[0].operator->(), cms::Exception);
CPPUNIT_ASSERT(trackM.refToBaseVector1[4]->a == 44 + offset);
CPPUNIT_ASSERT_THROW(trackM.refToBaseVector1[8]->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackM.refToBaseVector1[8].operator->(), cms::Exception);
CPPUNIT_ASSERT(!trackM.refToBaseVector1.isAvailable());
CPPUNIT_ASSERT_THROW(trackM.refToBaseVector1[0]->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackM.refToBaseVector1[0].operator->(), cms::Exception);
CPPUNIT_ASSERT(trackM.refToBaseVector1[4]->a == 44 + offset);
CPPUNIT_ASSERT_THROW(trackM.refToBaseVector1[8]->a, cms::Exception);
CPPUNIT_ASSERT_THROW(trackM.refToBaseVector1[8].operator->(), cms::Exception);
}
}

Expand Down
2 changes: 1 addition & 1 deletion FWCore/Framework/src/SystemTimeKeeper.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace edm {
class PathContext;
class HLTPathStatus;
class ModuleCallingContext;
class TriggerTimingReport;
struct TriggerTimingReport;
namespace service {
class TriggersNameService;
}
Expand Down
6 changes: 4 additions & 2 deletions FWCore/Framework/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<library file="DummyData.cc,DummyRecord.cc,DepRecord.cc,Dummy2Record.cc,DepOn2Record.cc" name="FWCoreFrameworkTestDummyForEventSetup">
<use name="FWCore/Framework"/>
</library>
<library file="MockEventProcessor.cc" name="FWCoreFrameworkTest">
<library file="MockEventProcessor.cc,stubs/TestBeginEndJobAnalyzer.cc" name="FWCoreFrameworkTest">
<use name="FWCore/Framework"/>
</library>
<library file="stubs/TestOutputModule.cc" name="TestOutputModule">
Expand Down Expand Up @@ -131,8 +131,9 @@
<use name="FWCore/Framework"/>
<use name="cppunit"/>
</library>
<library file="stubs/TestBeginEndJobAnalyzer.cc,stubs/TestBeginEndJobAnalyzerModule.cc" name="FWCoreFrameworkTestBeginEndJobAnalyzer">
<library file="stubs/TestBeginEndJobAnalyzerModule.cc" name="FWCoreFrameworkTestBeginEndJobAnalyzer">
<flags EDM_PLUGIN="1"/>
<lib name="FWCoreFrameworkTest"/>
<use name="FWCore/Framework"/>
</library>
<library file="stubs/TestFailuresAnalyzer.cc" name="FWCoreFrameworkTestFailuresAnalyzer">
Expand Down Expand Up @@ -169,6 +170,7 @@
<use name="cppunit"/>
</bin>
<bin name="TestFWCoreFrameworkeventprocessor" file="testRunner.cpp,eventprocessor2_t.cppunit.cc,eventprocessor_t.cppunit.cc">
<lib name="FWCoreFrameworkTest"/>
<use name="DataFormats/Provenance"/>
<use name="DataFormats/WrappedStdDictionaries"/>
<use name="FWCore/Framework"/>
Expand Down
10 changes: 5 additions & 5 deletions FWCore/Framework/test/iovsyncvalue_t.cppunit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ testIOVSyncValue::invalidComparisonTest()

CPPUNIT_ASSERT(! timeBased.comparable(eventBased));
CPPUNIT_ASSERT(! eventBased.comparable(timeBased));
CPPUNIT_ASSERT_THROW( (timeBased < eventBased) , cms::Exception);
CPPUNIT_ASSERT_THROW( (timeBased <= eventBased) , cms::Exception);
CPPUNIT_ASSERT_THROW( [&](){return timeBased < eventBased;}() , cms::Exception);
CPPUNIT_ASSERT_THROW( [&](){return timeBased <= eventBased;}() , cms::Exception);
CPPUNIT_ASSERT( !(timeBased == eventBased));
CPPUNIT_ASSERT( (timeBased != eventBased));
CPPUNIT_ASSERT_THROW( (timeBased > eventBased) , cms::Exception);
CPPUNIT_ASSERT_THROW( (timeBased >= eventBased) , cms::Exception);
CPPUNIT_ASSERT( timeBased != eventBased);
CPPUNIT_ASSERT_THROW( [&]() {return timeBased > eventBased;}() , cms::Exception);
CPPUNIT_ASSERT_THROW( [&]() {return timeBased >= eventBased;}() , cms::Exception);
}
6 changes: 6 additions & 0 deletions FWCore/Framework/test/stubs/TestBeginEndJobAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ void hello(const char * hi) {
//std::cout << "IN " << hi << std::endl;
}

TestBeginEndJobAnalyzer::Control &
TestBeginEndJobAnalyzer::control() {
static Control l;
return l;
}

TestBeginEndJobAnalyzer::TestBeginEndJobAnalyzer(const edm::ParameterSet& /* iConfig */) {
hello("constr");
}
Expand Down
35 changes: 16 additions & 19 deletions FWCore/Framework/test/stubs/TestBeginEndJobAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,28 @@ class TestBeginEndJobAnalyzer : public edm::EDAnalyzer {
~TestBeginEndJobAnalyzer();


virtual void analyze(const edm::Event&, const edm::EventSetup&);
virtual void analyze(const edm::Event&, const edm::EventSetup&) override;

virtual void beginJob();
virtual void endJob();
virtual void beginRun(edm::Run const&, edm::EventSetup const&);
virtual void endRun(edm::Run const&, edm::EventSetup const&);
virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&);
virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&);
virtual void beginJob() override;
virtual void endJob() override;
virtual void beginRun(edm::Run const&, edm::EventSetup const&) override;
virtual void endRun(edm::Run const&, edm::EventSetup const&) override;
virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;



struct dso_export Control {
bool beginJobCalled;
bool endJobCalled;
bool beginRunCalled;
bool endRunCalled;
bool beginLumiCalled;
bool endLumiCalled;
bool destructorCalled;
struct Control {
bool beginJobCalled = false;
bool endJobCalled = false;
bool beginRunCalled = false;
bool endRunCalled = false;
bool beginLumiCalled = false;
bool endLumiCalled = false;
bool destructorCalled = false;
};

static Control & control() dso_export {
static Control l;
return l;
}
static Control & control();


private:
Expand Down
3 changes: 1 addition & 2 deletions FWCore/Integration/test/ThingAlgorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
namespace edmtest {
class ThingAlgorithm {
public:
ThingAlgorithm(long iOffsetDelta = 0, int nThings = 20) : theDebugLevel(0), offset(0), offsetDelta(iOffsetDelta),
ThingAlgorithm(long iOffsetDelta = 0, int nThings = 20) : offset(0), offsetDelta(iOffsetDelta),
nThings_(nThings) {}

/// Runs the algorithm and returns a list of Things
/// The user declares the vector and calls this method.
void run(ThingCollection& thingCollection);
private:
int theDebugLevel;
long offset;
long offsetDelta;
int nThings_;
Expand Down
1 change: 0 additions & 1 deletion FWCore/Integration/test/TrackOfThingsProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ namespace edmtest {
// and have no meaning other than that we will later check that we can
// read out what we put in here.
std::vector<unsigned int>::const_iterator key = keysToReference_.begin();
std::vector<unsigned int>::const_iterator keyEnd = keysToReference_.end();
for(unsigned int i = 0; i < 5; ++i) {


Expand Down

0 comments on commit a2eb259

Please sign in to comment.