Skip to content

Commit

Permalink
Merge pull request #5204 from NREL/ObjexxFCL_Update
Browse files Browse the repository at this point in the history
ObjexxFCL Update for Visual C++ 2015 and Intel C++ 2016 Compatibility
  • Loading branch information
Myoldmopar committed Sep 17, 2015
2 parents 0d9b058 + f5552ed commit 988cb91
Show file tree
Hide file tree
Showing 20 changed files with 74 additions and 238 deletions.
41 changes: 25 additions & 16 deletions cmake/CompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,36 @@ IF ( MSVC AND NOT ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" ) ) # Visual C++
ELSEIF ( CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) # g++/Clang
option(ENABLE_THREAD_SANITIZER "Enable thread sanitizer testing in gcc/clang" FALSE)
set(LINKER_FLAGS "")
if(ENABLE_THREAD_SANITIZER)
ADD_CXX_DEFINITIONS(-fsanitize=thread )
add_definitions(-ggdb -fno-omit-frame-pointer)
if (ENABLE_THREAD_SANITIZER)
ADD_CXX_DEFINITIONS("-fsanitize=thread")
ADD_DEFINITIONS("-ggdb -fno-omit-frame-pointer")
set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=thread -ggdb")
endif()

option(ENABLE_ADDRESS_SANITIZER "Enable address sanitizer testing in gcc/clang" FALSE)
if(ENABLE_ADDRESS_SANITIZER)
ADD_CXX_DEFINITIONS(-fsanitize=address)
add_definitions(-ggdb -fno-omit-frame-pointer)
if (ENABLE_ADDRESS_SANITIZER)
ADD_CXX_DEFINITIONS("-fsanitize=address")
ADD_DEFINITIONS("-ggdb -fno-omit-frame-pointer")
set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=address -ggdb")
endif()

option(ENABLE_MEMORY_SANITIZER "Enable reads of unintialized memory sanitizer testing in gcc/clang" FALSE)
if (ENABLE_MEMORY_SANITIZER)
ADD_CXX_DEFINITIONS("-fsanitize=memory")
ADD_DEFINITIONS("-ggdb -fno-omit-frame-pointer")
set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=memory -ggdb")
endif()

option(ENABLE_UNDEFINED_SANITIZER "Enable undefined behavior sanitizer testing in gcc/clang" FALSE)
if(ENABLE_UNDEFINED_SANITIZER)
ADD_CXX_DEFINITIONS(-fsanitize=undefined )
add_definitions(-ggdb -fno-omit-frame-pointer)
if (ENABLE_UNDEFINED_SANITIZER)
ADD_CXX_DEFINITIONS("-fsanitize=undefined")
ADD_DEFINITIONS("-ggdb -fno-omit-frame-pointer")
set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=undefined -ggdb")
endif()

option(ENABLE_COVERAGE "Enable Coverage Reporting in GCC" FALSE)
if(ENABLE_COVERAGE)
add_definitions(--coverage -O0)
if (ENABLE_COVERAGE)
ADD_DEFINITIONS("--coverage -O0")
set(LINKER_FLAGS "${LINKER_FLAGS} --coverage")
endif()

Expand All @@ -71,7 +78,7 @@ ELSEIF ( CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"
if(CMAKE_HOST_UNIX)
if(NOT APPLE)
set(LINKER_FLAGS "${LINKER_FLAGS} -pthread")
add_definitions(-pthread)
ADD_DEFINITIONS("-pthread")
endif()
endif()

Expand All @@ -86,7 +93,7 @@ ELSEIF ( CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"
ADD_CXX_DEFINITIONS("-ffor-scope")
ADD_CXX_DEFINITIONS("-Wall -Wextra") # Turn on warnings
ADD_CXX_DEFINITIONS("-Wno-unknown-pragmas")
if( CMAKE_COMPILER_IS_GNUCXX ) # g++
if ( CMAKE_COMPILER_IS_GNUCXX ) # g++
ADD_CXX_DEFINITIONS("-Wno-unused-but-set-parameter -Wno-unused-but-set-variable") # Suppress unused-but-set warnings until more serious ones are addressed
ADD_CXX_DEFINITIONS("-Wno-maybe-uninitialized")
elseif( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
Expand All @@ -98,7 +105,7 @@ ELSEIF ( CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"
ADD_CXX_DEBUG_DEFINITIONS("-ffloat-store") # Improve debug run solution stability
ADD_CXX_DEBUG_DEFINITIONS("-fsignaling-nans") # Disable optimizations that may have concealed NaN behavior
ADD_CXX_DEBUG_DEFINITIONS("-D_GLIBCXX_DEBUG") # Standard container debug mode (bounds checking, ...)
endif ()
endif()

ADD_CXX_DEBUG_DEFINITIONS("-ggdb") # Produces debugging information specifically for gdb

Expand All @@ -107,6 +114,7 @@ ELSEIF ( WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" )
# Disabled Warnings: Enable some of these as more serious warnings are addressed
# 177 Variable declared but never referenced
# 488 Template parameter not used ...
# 809 Exception specification consistency warnings that fire in gtest code
# 869 Parameter never referenced
# 1786 Use of deprecated items
# 2259 Non-pointer conversions may lose significant bits
Expand All @@ -119,7 +127,7 @@ ELSEIF ( WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" )
ADD_CXX_DEFINITIONS("/Qcxx-features") # Enables standard C++ features without disabling Microsoft extensions
ADD_CXX_DEFINITIONS("/Wall") # Enable "all" warnings
ADD_CXX_DEFINITIONS("/Wp64") # 64-bit warnings
ADD_CXX_DEFINITIONS("/Qdiag-disable:177,488,869,1786,2259,3280,11074,11075") # Disable warnings listed above
ADD_CXX_DEFINITIONS("/Qdiag-disable:177,488,809,869,1786,2259,3280,11074,11075") # Disable warnings listed above
ADD_CXX_DEFINITIONS("/DNOMINMAX") # Avoid build errors due to STL/Windows min-max conflicts
ADD_CXX_DEFINITIONS("/DWIN32_LEAN_AND_MEAN") # Excludes rarely used services and headers from compilation

Expand Down Expand Up @@ -151,6 +159,7 @@ ELSEIF ( UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" )
# Disabled Warnings: Enable some of these as more serious warnings are addressed
# 177 Variable declared but never referenced
# 488 Template parameter not used ...
# 809 Exception specification consistency warnings that fire in gtest code
# 869 Parameter never referenced
# 1786 Use of deprecated items
# 2259 Non-pointer conversions may lose significant bits
Expand All @@ -162,7 +171,7 @@ ELSEIF ( UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" )
ADD_CXX_DEFINITIONS("-std=c++11") # Specify C++11 language
ADD_CXX_DEFINITIONS("-Wall") # Enable "all" warnings
ADD_CXX_DEFINITIONS("-Wp64") # 64-bit warnings
ADD_CXX_DEFINITIONS("-diag-disable:177,488,869,1786,2259,3280,11074,11075") # Disable warnings listed above
ADD_CXX_DEFINITIONS("-diag-disable:177,488,809,869,1786,2259,3280,11074,11075") # Disable warnings listed above

IF(NOT APPLE)
ADD_CXX_DEFINITIONS(-pthread)
Expand Down
10 changes: 0 additions & 10 deletions third_party/ObjexxFCL/src/ObjexxFCL/Array.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1712,16 +1712,6 @@ public: // Modifier
return *this;
}

// Assign Default Value to all Elements
inline
virtual
Array &
to_default()
{
if ( data_ ) std::fill_n( data_, size_, Traits::initial_array_value() );
return *this;
}

// Assign Zero to all Elements
// Can't be virtual (for covariant return) or will try to instantiate for all value types
inline
Expand Down
9 changes: 0 additions & 9 deletions third_party/ObjexxFCL/src/ObjexxFCL/Array1.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1594,15 +1594,6 @@ public: // Modifier
return *this;
}

// Assign Default Value to all Elements
inline
Array1 &
to_default()
{
Super::to_default();
return *this;
}

// Normalize to Unit Length
inline
Array1 &
Expand Down
9 changes: 0 additions & 9 deletions third_party/ObjexxFCL/src/ObjexxFCL/Array2.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1292,15 +1292,6 @@ public: // Modifier
return *this;
}

// Assign Default Value to all Elements
inline
Array2 &
to_default()
{
Super::to_default();
return *this;
}

// Set to the Identity Matrix
inline
Array2 &
Expand Down
9 changes: 0 additions & 9 deletions third_party/ObjexxFCL/src/ObjexxFCL/Array3.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1483,15 +1483,6 @@ public: // Modifier
return *this;
}

// Assign Default Value to all Elements
inline
Array3 &
to_default()
{
Super::to_default();
return *this;
}

public: // MArray Generators

// Template Helpers
Expand Down
9 changes: 0 additions & 9 deletions third_party/ObjexxFCL/src/ObjexxFCL/Array4.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1850,15 +1850,6 @@ public: // Modifier
return *this;
}

// Assign Default Value to all Elements
inline
Array4 &
to_default()
{
Super::to_default();
return *this;
}

public: // MArray Generators

// Template Helpers
Expand Down
9 changes: 0 additions & 9 deletions third_party/ObjexxFCL/src/ObjexxFCL/Array5.hh
Original file line number Diff line number Diff line change
Expand Up @@ -2535,15 +2535,6 @@ public: // Modifier
return *this;
}

// Assign Default Value to all Elements
inline
Array5 &
to_default()
{
Super::to_default();
return *this;
}

public: // MArray Generators

// Template Helpers
Expand Down
9 changes: 0 additions & 9 deletions third_party/ObjexxFCL/src/ObjexxFCL/Array6.hh
Original file line number Diff line number Diff line change
Expand Up @@ -3766,15 +3766,6 @@ public: // Modifier
return *this;
}

// Assign Default Value to all Elements
inline
Array6 &
to_default()
{
Super::to_default();
return *this;
}

public: // MArray Generators

// Template Helpers
Expand Down
11 changes: 0 additions & 11 deletions third_party/ObjexxFCL/src/ObjexxFCL/MArray1.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1113,17 +1113,6 @@ public: // Inspector

public: // Modifier

// Assign Default Value to all Elements
inline
MArray1 &
to_default()
{
for ( int i = 1, e = u(); i <= e; ++i ) {
operator ()( i ) = Traits::initial_value();
}
return *this;
}

// Normalize to Unit Length
inline
MArray1 &
Expand Down
15 changes: 0 additions & 15 deletions third_party/ObjexxFCL/src/ObjexxFCL/MArray2.hh
Original file line number Diff line number Diff line change
Expand Up @@ -539,21 +539,6 @@ public: // Inspector
return array_.isize2();
}

public: // Modifier

// Assign Default Value to all Elements
inline
MArray2 &
to_default()
{
for ( int i1 = 1, e1 = u1(); i1 <= e1; ++i1 ) {
for ( int i2 = 1, e2 = u2(); i2 <= e2; ++i2 ) {
operator ()( i1, i2 ) = Traits::initial_value();
}
}
return *this;
}

public: // MArray Generators

// Template Helpers
Expand Down
17 changes: 0 additions & 17 deletions third_party/ObjexxFCL/src/ObjexxFCL/MArray3.hh
Original file line number Diff line number Diff line change
Expand Up @@ -623,23 +623,6 @@ public: // Inspector
return array_.isize3();
}

public: // Modifier

// Assign Default Value to all Elements
inline
MArray3 &
to_default()
{
for ( int i1 = 1, e1 = u1(); i1 <= e1; ++i1 ) {
for ( int i2 = 1, e2 = u2(); i2 <= e2; ++i2 ) {
for ( int i3 = 1, e3 = u3(); i3 <= e3; ++i3 ) {
operator ()( i1, i2, i3 ) = Traits::initial_value();
}
}
}
return *this;
}

public: // MArray Generators

// Template Helpers
Expand Down
19 changes: 0 additions & 19 deletions third_party/ObjexxFCL/src/ObjexxFCL/MArray4.hh
Original file line number Diff line number Diff line change
Expand Up @@ -705,25 +705,6 @@ public: // Inspector
return array_.isize4();
}

public: // Modifier

// Assign Default Value to all Elements
inline
MArray4 &
to_default()
{
for ( int i1 = 1, e1 = u1(); i1 <= e1; ++i1 ) {
for ( int i2 = 1, e2 = u2(); i2 <= e2; ++i2 ) {
for ( int i3 = 1, e3 = u3(); i3 <= e3; ++i3 ) {
for ( int i4 = 1, e4 = u4(); i4 <= e4; ++i4 ) {
operator ()( i1, i2, i3, i4 ) = Traits::initial_value();
}
}
}
}
return *this;
}

public: // MArray Generators

// Template Helpers
Expand Down
21 changes: 0 additions & 21 deletions third_party/ObjexxFCL/src/ObjexxFCL/MArray5.hh
Original file line number Diff line number Diff line change
Expand Up @@ -787,27 +787,6 @@ public: // Inspector
return array_.isize5();
}

public: // Modifier

// Assign Default Value to all Elements
inline
MArray5 &
to_default()
{
for ( int i1 = 1, e1 = u1(); i1 <= e1; ++i1 ) {
for ( int i2 = 1, e2 = u2(); i2 <= e2; ++i2 ) {
for ( int i3 = 1, e3 = u3(); i3 <= e3; ++i3 ) {
for ( int i4 = 1, e4 = u4(); i4 <= e4; ++i4 ) {
for ( int i5 = 1, e5 = u5(); i5 <= e5; ++i5 ) {
operator ()( i1, i2, i3, i4, i5 ) = Traits::initial_value();
}
}
}
}
}
return *this;
}

public: // MArray Generators

// Template Helpers
Expand Down
23 changes: 0 additions & 23 deletions third_party/ObjexxFCL/src/ObjexxFCL/MArray6.hh
Original file line number Diff line number Diff line change
Expand Up @@ -869,29 +869,6 @@ public: // Inspector
return array_.isize6();
}

public: // Modifier

// Assign Default Value to all Elements
inline
MArray6 &
to_default()
{
for ( int i1 = 1, e1 = u1(); i1 <= e1; ++i1 ) {
for ( int i2 = 1, e2 = u2(); i2 <= e2; ++i2 ) {
for ( int i3 = 1, e3 = u3(); i3 <= e3; ++i3 ) {
for ( int i4 = 1, e4 = u4(); i4 <= e4; ++i4 ) {
for ( int i5 = 1, e5 = u5(); i5 <= e5; ++i5 ) {
for ( int i6 = 1, e6 = u6(); i6 <= e6; ++i6 ) {
operator ()( i1, i2, i3, i4, i5, i6 ) = Traits::initial_value();
}
}
}
}
}
}
return *this;
}

public: // MArray Generators

// Template Helpers
Expand Down
10 changes: 10 additions & 0 deletions third_party/ObjexxFCL/src/ObjexxFCL/fmt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
namespace ObjexxFCL {
namespace fmt {

// Globals
fmt::Binary_num_put * binary_num_put( new fmt::Binary_num_put );
fmt::Exponent_num_put * exponent_num_put( new fmt::Exponent_num_put );
fmt::Engineering_num_put * engineering_num_put( new fmt::Engineering_num_put );
fmt::Scientific_num_put * scientific_num_put( new fmt::Scientific_num_put );
std::locale const binary_locale( std::locale(), binary_num_put );
std::locale const exponent_locale( std::locale(), exponent_num_put );
std::locale const engineering_locale( std::locale(), engineering_num_put );
std::locale const scientific_locale( std::locale(), scientific_num_put );

// Input /////

// Input a Skip from Stream
Expand Down
Loading

0 comments on commit 988cb91

Please sign in to comment.