From 90ea873dcb7875eca8e15692feaa91440ca44271 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Fri, 17 May 2024 22:36:57 +0900 Subject: [PATCH] Fix compiling warnings Signed-off-by: Michele Calgaro --- src/newlines/class_colon_pos.cpp | 2 +- src/newlines/oc_msg.cpp | 10 ++++++---- src/output.cpp | 16 +++++----------- src/tokenizer/EnumStructUnionParser.cpp | 1 + 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/newlines/class_colon_pos.cpp b/src/newlines/class_colon_pos.cpp index e1b3a3ff07..142345cd97 100644 --- a/src/newlines/class_colon_pos.cpp +++ b/src/newlines/class_colon_pos.cpp @@ -9,8 +9,8 @@ #include "align/stack.h" #include "chunk.h" -#include "log_rules.h" #include "keywords.h" +#include "log_rules.h" #include "mark_change.h" #include "newlines/add.h" #include "newlines/force.h" diff --git a/src/newlines/oc_msg.cpp b/src/newlines/oc_msg.cpp index 646b49ef29..b02feb429a 100644 --- a/src/newlines/oc_msg.cpp +++ b/src/newlines/oc_msg.cpp @@ -88,10 +88,12 @@ void newline_oc_msg(Chunk *start) { should_nl_msg = true; } - bool finish_multi_line = options::nl_oc_msg_args_finish_multi_line(); - if (finish_multi_line) { - size_t prev_line = -1; + + if (finish_multi_line) + { + size_t prev_line = 0; + for (Chunk *pc = start->GetNextNcNnl(); pc->IsNotNullChunk(); pc = pc->GetNextNcNnl()) { if (pc->GetLevel() <= start->GetLevel()) @@ -99,7 +101,7 @@ void newline_oc_msg(Chunk *start) break; } - if (prev_line != -1 && pc->GetOrigLine() != prev_line) + if (prev_line > 0 && pc->GetOrigLine() != prev_line) { should_nl_msg = true; } diff --git a/src/output.cpp b/src/output.cpp index 0bf40141ab..3d1ab747c3 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -2266,18 +2266,12 @@ static std::map > get_reflow_fo while (it_regex != it_regex_end) { - std::wsmatch match = *it_regex; + std::wsmatch match = *it_regex; + auto &&index = std::stoi(match[3].str()); + std::wregex *p_wregex = (match[1].length() > 0) ? ®ex_map[index].second + : ®ex_map[index].first; + *p_wregex = match[4].str(); - if ( (( match[1].matched - || match[2].matched)) - && match[3].matched - && match[4].matched) - { - auto &&index = std::stoi(match[3].str()); - std::wregex *p_wregex = match[1].matched ? ®ex_map[index].second - : ®ex_map[index].first; - *p_wregex = match[4].str(); - } ++it_regex; } } diff --git a/src/tokenizer/EnumStructUnionParser.cpp b/src/tokenizer/EnumStructUnionParser.cpp index 67622024fe..94650eba9a 100644 --- a/src/tokenizer/EnumStructUnionParser.cpp +++ b/src/tokenizer/EnumStructUnionParser.cpp @@ -1624,6 +1624,7 @@ void EnumStructUnionParser::mark_constructors() { break; // Issue #4250 } + if ( std::strcmp(prev->Text(), name) == 0 && prev->GetLevel() == level && next->IsParenOpen())