Commit b9bd3eb8 authored by Robert Kimball's avatar Robert Kimball

enable old-style cast warning and fix new warnings

parent e74f448f
......@@ -23,10 +23,9 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-exit-time-destructors")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-prototypes")
# # should remove these
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-old-style-cast")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-old-style-cast")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-float-conversion")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-conversion")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-padded")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-undefined-func-template")
......@@ -46,7 +46,7 @@ bool ngraph::element::Type::operator==(const element::Type& other) const
size_t ngraph::element::Type::size() const
{
return std::ceil((float)m_bitwidth / 8.0f);
return std::ceil(static_cast<float>(m_bitwidth) / 8.0f);
}
std::ostream& ngraph::element::operator<<(std::ostream& out, const ngraph::element::Type& obj)
......
......@@ -39,7 +39,8 @@ void ngraph::dump(ostream& out, const void* _data, size_t _size)
{
if (index + i < len)
{
out << " " << std::hex << std::setw(2) << std::setfill('0') << (uint32_t)data[i];
out << " " << std::hex << std::setw(2) << std::setfill('0')
<< static_cast<uint32_t>(data[i]);
}
else
{
......@@ -51,7 +52,8 @@ void ngraph::dump(ostream& out, const void* _data, size_t _size)
{
if (index + i < len)
{
out << " " << std::hex << std::setw(2) << std::setfill('0') << (uint32_t)data[i];
out << " " << std::hex << std::setw(2) << std::setfill('0')
<< static_cast<uint32_t>(data[i]);
}
else
{
......
......@@ -34,7 +34,7 @@ public:
{
m_data[0] = random_generator();
m_data[1] = random_generator();
uint8_t* p = (uint8_t*)m_data;
uint8_t* p = reinterpret_cast<uint8_t*>(m_data);
p[6] = (p[6] & 0x0F) | 0x40;
p[8] = (p[8] & 0x3F) | 0x80;
}
......@@ -42,21 +42,31 @@ public:
std::string to_string() const
{
std::stringstream ss;
uint8_t* p = (uint8_t*)m_data;
const uint8_t* p = reinterpret_cast<const uint8_t*>(m_data);
for (int i = 0; i < 4; i++)
ss << std::hex << std::setw(2) << std::setfill('0') << (int)*p++;
{
ss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(*p++);
}
ss << "-";
for (int i = 0; i < 2; i++)
ss << std::hex << std::setw(2) << std::setfill('0') << (int)*p++;
{
ss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(*p++);
}
ss << "-";
for (int i = 0; i < 2; i++)
ss << std::hex << std::setw(2) << std::setfill('0') << (int)*p++;
{
ss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(*p++);
}
ss << "-";
for (int i = 0; i < 2; i++)
ss << std::hex << std::setw(2) << std::setfill('0') << (int)*p++;
{
ss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(*p++);
}
ss << "-";
for (int i = 0; i < 6; i++)
ss << std::hex << std::setw(2) << std::setfill('0') << (int)*p++;
{
ss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(*p++);
}
return ss.str();
}
......@@ -68,11 +78,7 @@ public:
return rc;
}
bool operator==(const uuid_type& other) const
{
return memcmp((char*)m_data, (char*)other.m_data, 16) == 0;
}
bool operator==(const uuid_type& other) const { return memcmp(m_data, other.m_data, 16) == 0; }
bool operator!=(const uuid_type& other) const { return !(*this == other); }
friend std::ostream& operator<<(std::ostream& out, const uuid_type& id)
{
......
......@@ -25,7 +25,7 @@ int main(int argc, char** argv)
const char* exclude = "--gtest_filter=-benchmark.*";
vector<char*> argv_vector;
argv_vector.push_back(argv[0]);
argv_vector.push_back((char*)exclude);
argv_vector.push_back(const_cast<char*>(exclude));
for (int i = 1; i < argc; i++)
{
argv_vector.push_back(argv[i]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment