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

Remove boost lexical_cast dependency in FWCore #34976

Merged
merged 2 commits into from Aug 24, 2021
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
5 changes: 0 additions & 5 deletions FWCore/Modules/src/EventContentAnalyzer.cc
Expand Up @@ -436,11 +436,6 @@ namespace edm {
for (nameMap::const_iterator it = cumulates_.begin(), itEnd = cumulates_.end(); it != itEnd; ++it) {
LogAbsolute("EventContent") << std::setw(6) << it->second << " occurrences of key " << it->first << std::endl;
}

// Test boost::lexical_cast We don't need this right now so comment it out.
// int k = 137;
// std::string ktext = boost::lexical_cast<std::string>(k);
// std::cout << "\nInteger " << k << " expressed as a string is |" << ktext << "|" << std::endl;
}

void EventContentAnalyzer::fillDescriptions(ConfigurationDescriptions& descriptions) {
Expand Down
5 changes: 2 additions & 3 deletions FWCore/ParameterSet/src/types.cc
Expand Up @@ -8,7 +8,6 @@

#include "FWCore/ParameterSet/interface/types.h"

#include "boost/lexical_cast.hpp"
#include "FWCore/ParameterSet/src/split.h"
#include "FWCore/Utilities/interface/Parse.h"
#include <cctype>
Expand Down Expand Up @@ -459,9 +458,9 @@ bool edm::decode(double& to, std::string const& from) {
else {
try {
// std::cerr << "from:" << from << std::endl;
to = boost::lexical_cast<double>(from);
to = std::stod(from);
// std::cerr << "to:" << to << std::endl;
} catch (boost::bad_lexical_cast&) {
} catch (const std::exception&) {
return false;
}
}
Expand Down
13 changes: 6 additions & 7 deletions FWCore/Services/plugins/ProcInfoFetcher.cc
Expand Up @@ -23,7 +23,6 @@
#include <sstream>
//#include <stdio.h>
#include <string>
#include <boost/lexical_cast.hpp>

#include <fcntl.h>
#include <unistd.h>
Expand Down Expand Up @@ -96,27 +95,27 @@ namespace {
int getInt() {
const char* t = getItem();
//std::cout <<"int '"<<t <<"'"<<std::endl;
return boost::lexical_cast<int>(t);
return std::stoi(t);
}
long getLong() {
const char* t = getItem();
//std::cout <<"long '"<<t <<"'"<<std::endl;
return boost::lexical_cast<long>(t);
return std::stol(t);
}
unsigned int getUInt() {
const char* t = getItem();
//std::cout <<"uint '"<<t <<"'"<<std::endl;
return boost::lexical_cast<unsigned int>(t);
return std::stoul(t);
}
unsigned long getULong() {
const char* t = getItem();
//std::cout <<"ulong '"<<t <<"'"<<std::endl;
return boost::lexical_cast<unsigned long>(t);
return std::stoul(t);
}
unsigned long long getULongLong() {
const char* t = getItem();
//std::cout <<"ulong '"<<t <<"'"<<std::endl;
return boost::lexical_cast<unsigned long long>(t);
return std::stoull(t);
}
char getChar() { return *getItem(); }
std::string getString() { return std::string(getItem()); }
Expand Down Expand Up @@ -210,7 +209,7 @@ namespace edm {
pinfo.num_threads >> pinfo.itrealvalue >> pinfo.starttime >> pinfo.vsize >> pinfo.rss >> pinfo.rlim >>
pinfo.startcode >> pinfo.endcode >> pinfo.startstack >> pinfo.kstkesp >> pinfo.kstkeip >> pinfo.signal >>
pinfo.blocked >> pinfo.sigignore >> pinfo.sigcatch >> pinfo.wchan;
} catch (boost::bad_lexical_cast& iE) {
} catch (const std::exception& iE) {
LogWarning("ProcInfoFetcher") << "Parsing of Prof file failed:" << iE.what() << std::endl;
return ProcInfo();
}
Expand Down
1 change: 0 additions & 1 deletion FWCore/Services/plugins/SimpleMemoryCheck.cc
Expand Up @@ -52,7 +52,6 @@
//#include <stdio.h>
#include <string>
//#include <string.h>
#include <boost/lexical_cast.hpp>

#include <cstdio>
#include <atomic>
Expand Down
11 changes: 5 additions & 6 deletions FWCore/Utilities/src/ReleaseVersion.cc
@@ -1,7 +1,6 @@
#include "FWCore/Utilities/interface/ReleaseVersion.h"

#include "boost/algorithm/string.hpp"
#include "boost/lexical_cast.hpp"

#include <algorithm>
#include <cassert>
Expand Down Expand Up @@ -33,17 +32,17 @@ namespace edm {
/*
if(parts.size() == 4) {
if(releaseVersion.find("patch") != std::string::npos) {
patch_ = boost::lexical_cast<unsigned int>(parts[3]);
patch_ = std::stoul(parts[3]);
} else if(releaseVersion.find("pre") != std::string::npos) {
pre_ = boost::lexical_cast<unsigned int>(parts[3]);
pre_ = std::stoul(parts[3]);
} else {
return;
}
}
*/
major_ = boost::lexical_cast<unsigned int>(parts[0]);
minor_ = boost::lexical_cast<unsigned int>(parts[1]);
// point_ = boost::lexical_cast<unsigned int>(parts[2]);
major_ = std::stoul(parts[0]);
minor_ = std::stoul(parts[1]);
// point_ = std::stoul(parts[2]);
irregular_ = false;
} catch (std::exception const&) {
}
Expand Down