Skip to content
Snippets Groups Projects
Commit 034b17bb authored by Sam Yates's avatar Sam Yates
Browse files

Infrastructure for compiler-specific options

* Add file cmake/CompilerOptions.cmake for setting up compiler
  specific options
* Disable 'missing-braces' warning on Clang
* Avoid defect in g++ 4.9.2 standard library that omits move
  constructor for `stdd::ifstream`
* Remove signed/unsigned warning in test_optional.cpp
parent 422a7073
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,10 @@ enable_language(CXX)
set(SAVED_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
# compilation flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -std=c++11 -pthread -Wall")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
include("CompilerOptions")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXXOPT_DEBUG} ${CXXOPT_CXX11} ${CXXOPT_PTHREAD} ${CXXOPT_WALL}")
# -g -std=c++11 -pthread -Wall")
# this generates a .json file with full compilation command for each file
set(CMAKE_EXPORT_COMPILE_COMMANDS "YES")
......
# Compiler-aware compiler options
set(CXXOPT_DEBUG "-g")
set(CXXOPT_PTHREAD "-pthread")
set(CXXOPT_CXX11 "-std=c++11")
set(CXXOPT_WALL "-Wall")
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
# Disable 'missing-braces' warning: this will inappropriately
# flag initializations such as
# std::array<int,3> a={1,2,3};
set(CXXOPT_WALL "${CXXOPT_WALL} -Wno-missing-braces")
endif()
......@@ -7,7 +7,7 @@
#if defined(__clang__)
// refer: https://llvm.org/bugs/show_bug.cgi?id=21629
#pragma clang diagnostic ignored "-Wmissing-braces"
//#pragma clang diagnostic ignored "-Wmissing-braces"
#endif
using namespace nest::mc::util;
......@@ -66,7 +66,7 @@ TEST(optionalm,deref) {
TEST(optionalm,ctor_conv) {
optional<std::array<int,3>> x{{1,2,3}};
EXPECT_EQ(3,x->size());
EXPECT_EQ(3u,x->size());
}
TEST(optionalm,ctor_ref) {
......
......@@ -60,7 +60,7 @@ nlohmann::json
load_spike_data(const std::string& input_name)
{
nlohmann::json cell_data;
auto fid = std::ifstream(input_name);
std::ifstream fid(input_name);
if(!fid.is_open()) {
std::cerr << "error : unable to open file " << input_name
<< " : run the validation generation script first\n";
......
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