Skip to content

Commit 8033351

Browse files
committed
Changed minimum target to be 'c++11'.
1 parent 7ef51f6 commit 8033351

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

CMakeLists.txt

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
11
cmake_minimum_required(VERSION 2.8)
22

3-
# Check if a supported compiler is used and add c++14 flag:
3+
# Check if a supported compiler is used and add c++11 flag:
44
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
55
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
66
message(FATAL_ERROR "Need at least gcc 4.9 to compile.")
77
endif()
8-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
8+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
99
elseif(MSVC)
1010
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19)
1111
message(FATAL_ERROR "Visual Studio 2015 or newer is required.")
1212
endif()
1313
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
14-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
14+
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
15+
message(FATAL_ERROR "Need at least AppleClang 7.0 to compile.")
16+
endif()
17+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
1518
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
1619
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
1720
message(FATAL_ERROR "Clang below version 3.4 will most likely not work. Please upgrade your compiler.")
1821
endif()
19-
20-
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6)
21-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
22-
else()
23-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
24-
endif()
22+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
2523
else() # no GNU, no MSVC, no Clang
2624
message(WARNING "You are using an unsupported compiler. Compilation has only been tested with MSVC, GCC and Clang.")
2725

2826
include(CheckCXXCompilerFlag)
29-
check_cxx_compiler_flag(-std=c++14 HAS_CXX14_FLAG)
30-
if(HAS_CXX14_FLAG)
31-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
27+
check_cxx_compiler_flag(-std=c++11 HAS_CXX11_FLAG)
28+
if(HAS_CXX11_FLAG)
29+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
3230
else()
33-
message(FATAL_ERROR "Your compiler doesn't support the '-std=c++14' flag.")
31+
message(FATAL_ERROR "Your compiler doesn't support the '-std=c++11' flag.")
3432
endif()
3533
endif()
3634

@@ -73,4 +71,4 @@ if(NOT MSVC)
7371
add_subdirectory(lint)
7472
add_subdirectory(language/pl0)
7573
add_subdirectory(language/culebra)
76-
endif()
74+
endif()

lint/peglint.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ int main(int argc, const char** argv)
9191

9292
peg::parser parser;
9393

94-
parser.log = [&](auto ln, auto col, const auto& msg) {
94+
parser.log = [&](size_t ln, size_t col, const string& msg) {
9595
cerr << syntax_path << ":" << ln << ":" << col << ": " << msg << endl;
9696
};
9797

@@ -114,15 +114,21 @@ int main(int argc, const char** argv)
114114
source_path = "[commendline]";
115115
}
116116

117-
parser.log = [&](auto ln, auto col, const auto& msg) {
117+
parser.log = [&](size_t ln, size_t col, const string& msg) {
118118
cerr << source_path << ":" << ln << ":" << col << ": " << msg << endl;
119119
};
120120

121121
if (opt_trace) {
122122
std::cout << "pos:lev\trule/ope" << std::endl;
123123
std::cout << "-------\t--------" << std::endl;
124124
size_t prev_pos = 0;
125-
parser.enable_trace([&](auto name, auto s, auto /*n*/, auto& /*sv*/, auto& c, auto& /*dt*/) {
125+
parser.enable_trace([&](
126+
const char* name,
127+
const char* s,
128+
size_t /*n*/,
129+
const peg::SemanticValues& /*sv*/,
130+
const peg::Context& c,
131+
const peg::any& /*dt*/) {
126132
auto pos = static_cast<size_t>(s - c.s);
127133
auto backtrack = (pos < prev_pos ? "*" : "");
128134
string indent;

0 commit comments

Comments
 (0)