mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2024-12-22 11:55:30 +00:00
Fixed warnings
This commit is contained in:
parent
82512d5002
commit
1c00fa77fa
@ -6,6 +6,8 @@ set(CMAKE_CXX_EXTENSIONS OFF)
|
|||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus /utf-8")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus /utf-8")
|
||||||
|
else()
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
|
10
peglib.h
10
peglib.h
@ -635,7 +635,7 @@ struct ErrorInfo {
|
|||||||
if (message_pos) {
|
if (message_pos) {
|
||||||
auto line = line_info(s, message_pos);
|
auto line = line_info(s, message_pos);
|
||||||
std::string msg;
|
std::string msg;
|
||||||
if (auto unexpected_token = heuristic_error_token(log, s, n, message_pos);
|
if (auto unexpected_token = heuristic_error_token(s, n, message_pos);
|
||||||
!unexpected_token.empty()) {
|
!unexpected_token.empty()) {
|
||||||
msg = replace_all(message, "%t", unexpected_token);
|
msg = replace_all(message, "%t", unexpected_token);
|
||||||
} else {
|
} else {
|
||||||
@ -652,7 +652,7 @@ struct ErrorInfo {
|
|||||||
msg = "syntax error";
|
msg = "syntax error";
|
||||||
|
|
||||||
// unexpected token
|
// unexpected token
|
||||||
if (auto unexpected_token = heuristic_error_token(log, s, n, error_pos);
|
if (auto unexpected_token = heuristic_error_token(s, n, error_pos);
|
||||||
!unexpected_token.empty()) {
|
!unexpected_token.empty()) {
|
||||||
msg += ", unexpected '";
|
msg += ", unexpected '";
|
||||||
msg += unexpected_token;
|
msg += unexpected_token;
|
||||||
@ -690,7 +690,7 @@ struct ErrorInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string heuristic_error_token(const Log &log, const char *s, size_t n,
|
std::string heuristic_error_token(const char *s, size_t n,
|
||||||
const char *error_pos) const {
|
const char *error_pos) const {
|
||||||
auto len = n - std::distance(s, error_pos);
|
auto len = n - std::distance(s, error_pos);
|
||||||
if (len) {
|
if (len) {
|
||||||
@ -2684,8 +2684,8 @@ inline size_t PrecedenceClimbing::parse_expression(const char *s, size_t n,
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t Recovery::parse_core(const char *s, size_t n, SemanticValues &vs,
|
inline size_t Recovery::parse_core(const char *s, size_t n, SemanticValues &/*vs*/,
|
||||||
Context &c, std::any &dt) const {
|
Context &c, std::any &/*dt*/) const {
|
||||||
auto save_log = c.log;
|
auto save_log = c.log;
|
||||||
c.log = nullptr;
|
c.log = nullptr;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user