Use lower_case for relevant string comparisons

This commit is contained in:
m
2018-04-22 16:51:37 +02:00
parent 591205c2d7
commit 8e07ee87c8
4 changed files with 10 additions and 7 deletions
+3 -2
View File
@@ -21,13 +21,14 @@
#include "debug_utils.hpp"
#include "sys_utils.hpp"
#include "unicode_utils.hpp"
#include <stdexcept>
namespace bcache {
namespace {
bool is_source_file(const std::string& arg) {
const auto ext = file::get_extension(arg);
const auto ext = lower_case(file::get_extension(arg));
return ((ext == ".cpp") || (ext == ".cc") || (ext == ".cxx") || (ext == ".c"));
}
@@ -67,7 +68,7 @@ gcc_wrapper_t::gcc_wrapper_t(cache_t& cache) : program_wrapper_t(cache) {
bool gcc_wrapper_t::can_handle_command(const std::string& program_exe) {
// Is this the right compiler?
const auto cmd = file::get_file_part(program_exe, false);
const auto cmd = lower_case(file::get_file_part(program_exe, false));
return (cmd.find("gcc") != std::string::npos) || (cmd.find("g++") != std::string::npos) ||
(cmd.find("clang++") != std::string::npos) || (cmd == "clang");
}
+2 -2
View File
@@ -20,7 +20,7 @@
#include "ghs_wrapper.hpp"
#include "file_utils.hpp"
#include "hasher.hpp"
#include "unicode_utils.hpp"
#include <stdexcept>
@@ -30,7 +30,7 @@ ghs_wrapper_t::ghs_wrapper_t(cache_t& cache) : gcc_wrapper_t(cache) {
bool ghs_wrapper_t::can_handle_command(const std::string& program_exe) {
// Is this the right compiler?
const auto cmd = file::get_file_part(program_exe, false);
const auto cmd = lower_case(file::get_file_part(program_exe, false));
return (cmd.find("ccarm") != std::string::npos) || (cmd.find("cxarm") != std::string::npos) ||
(cmd.find("ccthumb") != std::string::npos) || (cmd.find("cxthumb") != std::string::npos) ||
(cmd.find("ccintarm") != std::string::npos) || (cmd.find("cxintarm") != std::string::npos);
+2 -1
View File
@@ -26,6 +26,7 @@
#include "program_wrapper.hpp"
#include "string_list.hpp"
#include "sys_utils.hpp"
#include "unicode_utils.hpp"
#include <iostream>
#include <memory>
@@ -58,7 +59,7 @@ bcache::string_list_t get_lua_paths(const bcache::cache_t& cache) {
}
bool is_lua_script(const std::string& script_path) {
return (bcache::file::get_extension(script_path) == ".lua");
return (bcache::lower_case(bcache::file::get_extension(script_path)) == ".lua");
}
[[noreturn]] void clear_cache_and_exit() {
+3 -2
View File
@@ -21,13 +21,14 @@
#include "debug_utils.hpp"
#include "sys_utils.hpp"
#include "unicode_utils.hpp"
#include <stdexcept>
namespace bcache {
namespace {
bool is_source_file(const std::string& arg) {
const auto ext = file::get_extension(arg);
const auto ext = lower_case(file::get_extension(arg));
return ((ext == ".cpp") || (ext == ".cc") || (ext == ".cxx") || (ext == ".c"));
}
@@ -73,7 +74,7 @@ msvc_wrapper_t::msvc_wrapper_t(cache_t& cache) : program_wrapper_t(cache) {
bool msvc_wrapper_t::can_handle_command(const std::string& program_exe) {
// Is this the right compiler?
const auto cmd = file::get_file_part(program_exe, false);
const auto cmd = lower_case(file::get_file_part(program_exe, false));
return (cmd == "cl");
}