Browse Source

Fixed gcc warnings

pipelines/235045657
eidheim 5 years ago
parent
commit
965a9fec3a
  1. 2
      .gitlab-ci.yml
  2. 6
      src/cmake.cpp
  3. 4
      src/meson.cpp
  4. 8
      src/source.cpp

2
.gitlab-ci.yml

@ -9,7 +9,7 @@ stages:
stage: test
script:
- mkdir build && cd build
- cmake -DBUILD_TESTING=1 ..
- CXXFLAGS=-Werror cmake -DBUILD_TESTING=1 ..
- make -j$(nproc)
- broadwayd & CTEST_OUTPUT_ON_FAILURE=1 make test

6
src/cmake.cpp

@ -151,7 +151,7 @@ boost::filesystem::path CMake::get_executable(const boost::filesystem::path &bui
});
}
boost::optional<size_t> best_match_size;
ssize_t best_match_size = -1;
boost::filesystem::path best_match_executable;
for(auto &cmake_executable : cmake_executables) {
@ -163,7 +163,7 @@ boost::filesystem::path CMake::get_executable(const boost::filesystem::path &bui
return maybe_executable;
auto command_file_directory = command_file.parent_path();
if(filesystem::file_in_path(file_path, command_file_directory)) {
auto size = static_cast<size_t>(std::distance(command_file_directory.begin(), command_file_directory.end()));
auto size = std::distance(command_file_directory.begin(), command_file_directory.end());
if(size > best_match_size) {
best_match_size = size;
best_match_executable = maybe_executable;
@ -182,7 +182,7 @@ boost::filesystem::path CMake::get_executable(const boost::filesystem::path &bui
return maybe_executable;
auto command_file_directory = command_file.parent_path();
if(filesystem::file_in_path(file_path, command_file_directory)) {
auto size = static_cast<size_t>(std::distance(command_file_directory.begin(), command_file_directory.end()));
auto size = std::distance(command_file_directory.begin(), command_file_directory.end());
if(size > best_match_size) {
best_match_size = size;
best_match_executable = maybe_executable;

4
src/meson.cpp

@ -99,7 +99,7 @@ bool Meson::update_debug_build(const boost::filesystem::path &debug_build_path,
boost::filesystem::path Meson::get_executable(const boost::filesystem::path &build_path, const boost::filesystem::path &file_path) {
CompileCommands compile_commands(build_path);
boost::optional<size_t> best_match_size;
ssize_t best_match_size = -1;
boost::filesystem::path best_match_executable;
for(auto &command : compile_commands.commands) {
auto command_file = filesystem::get_normal_path(command.file);
@ -113,7 +113,7 @@ boost::filesystem::path Meson::get_executable(const boost::filesystem::path &bui
return executable;
auto command_file_directory = command_file.parent_path();
if(filesystem::file_in_path(file_path, command_file_directory)) {
auto size = static_cast<size_t>(std::distance(command_file_directory.begin(), command_file_directory.end()));
auto size = std::distance(command_file_directory.begin(), command_file_directory.end());
if(size > best_match_size) {
best_match_size = size;
best_match_executable = executable;

8
src/source.cpp

@ -233,7 +233,7 @@ Source::View::View(const boost::filesystem::path &file_path, const Glib::RefPtr<
--line_end;
bool lines_commented = true;
bool extra_spaces = true;
boost::optional<int> min_indentation;
int min_indentation = std::numeric_limits<int>::max();
for(auto line = line_start; line <= line_end; ++line) {
auto iter = get_buffer()->get_iter_at_line(line);
bool line_added = false;
@ -279,8 +279,7 @@ Source::View::View(const boost::filesystem::path &file_path, const Glib::RefPtr<
if(line_added) {
lines_commented &= line_commented;
extra_spaces &= extra_space;
if(!min_indentation || indentation < min_indentation)
min_indentation = indentation;
min_indentation = std::min(min_indentation, indentation);
}
}
if(lines.size()) {
@ -288,7 +287,8 @@ Source::View::View(const boost::filesystem::path &file_path, const Glib::RefPtr<
get_buffer()->begin_user_action();
for(auto &line : lines) {
auto iter = get_buffer()->get_iter_at_line(line);
iter.forward_chars(min_indentation.value_or(0));
if(min_indentation != std::numeric_limits<int>::max())
iter.forward_chars(min_indentation);
if(lines_commented) {
auto end_iter = iter;
end_iter.forward_chars(comment_characters.size() + static_cast<int>(extra_spaces));

Loading…
Cancel
Save