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)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus /utf-8")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
||||
endif()
|
||||
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
|
10
peglib.h
10
peglib.h
@ -635,7 +635,7 @@ struct ErrorInfo {
|
||||
if (message_pos) {
|
||||
auto line = line_info(s, message_pos);
|
||||
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()) {
|
||||
msg = replace_all(message, "%t", unexpected_token);
|
||||
} else {
|
||||
@ -652,7 +652,7 @@ struct ErrorInfo {
|
||||
msg = "syntax error";
|
||||
|
||||
// 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()) {
|
||||
msg += ", unexpected '";
|
||||
msg += unexpected_token;
|
||||
@ -690,7 +690,7 @@ struct ErrorInfo {
|
||||
}
|
||||
|
||||
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 {
|
||||
auto len = n - std::distance(s, error_pos);
|
||||
if (len) {
|
||||
@ -2684,8 +2684,8 @@ inline size_t PrecedenceClimbing::parse_expression(const char *s, size_t n,
|
||||
return i;
|
||||
}
|
||||
|
||||
inline size_t Recovery::parse_core(const char *s, size_t n, SemanticValues &vs,
|
||||
Context &c, std::any &dt) const {
|
||||
inline size_t Recovery::parse_core(const char *s, size_t n, SemanticValues &/*vs*/,
|
||||
Context &c, std::any &/*dt*/) const {
|
||||
auto save_log = c.log;
|
||||
c.log = nullptr;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user