mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-10-30 08:42:00 +00:00 
			
		
		
		
	build : suppress gcc15 compile warnings (#14261)
* Change _contains_any() substrs to std::string_view and fix the find comparison logic.
This commit is contained in:
		| @@ -706,11 +706,17 @@ bool fs_validate_filename(const std::string & filename) { | |||||||
|         // disable C++17 deprecation warning for std::codecvt_utf8 |         // disable C++17 deprecation warning for std::codecvt_utf8 | ||||||
| #    pragma clang diagnostic push | #    pragma clang diagnostic push | ||||||
| #    pragma clang diagnostic ignored "-Wdeprecated-declarations" | #    pragma clang diagnostic ignored "-Wdeprecated-declarations" | ||||||
|  | #elif defined(__GNUC__) | ||||||
|  | #    pragma GCC diagnostic push | ||||||
|  | #    pragma GCC diagnostic ignored "-Wdeprecated-declarations" | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|         std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> converter; |         std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> converter; | ||||||
|  |  | ||||||
| #if defined(__clang__) | #if defined(__clang__) | ||||||
| #    pragma clang diagnostic pop | #    pragma clang diagnostic pop | ||||||
|  | #elif defined(__GNUC__) | ||||||
|  | #    pragma GCC diagnostic pop | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|         filename_utf32 = converter.from_bytes(filename); |         filename_utf32 = converter.from_bytes(filename); | ||||||
|   | |||||||
| @@ -69,6 +69,9 @@ | |||||||
| #if defined(__clang__) | #if defined(__clang__) | ||||||
| #    pragma clang diagnostic push | #    pragma clang diagnostic push | ||||||
| #    pragma clang diagnostic ignored "-Wdeprecated-declarations" | #    pragma clang diagnostic ignored "-Wdeprecated-declarations" | ||||||
|  | #elif defined(__GNUC__) | ||||||
|  | #    pragma GCC diagnostic push | ||||||
|  | #    pragma GCC diagnostic ignored "-Wdeprecated-declarations" | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| namespace fs = std::filesystem; | namespace fs = std::filesystem; | ||||||
| @@ -91,6 +94,8 @@ static std::string path_str(const fs::path & path) { | |||||||
|  |  | ||||||
| #if defined(__clang__) | #if defined(__clang__) | ||||||
| #    pragma clang diagnostic pop | #    pragma clang diagnostic pop | ||||||
|  | #elif defined(__GNUC__) | ||||||
|  | #    pragma GCC diagnostic pop | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
|   | |||||||
| @@ -2060,9 +2060,9 @@ void llama_vocab::impl::load(llama_model_loader & ml, const LLM_KV & kv) { | |||||||
|     //NOTE: Per token attributes are missing from the GGUF file. |     //NOTE: Per token attributes are missing from the GGUF file. | ||||||
|     //TODO: Extract attributes from GGUF file. |     //TODO: Extract attributes from GGUF file. | ||||||
|     { |     { | ||||||
|         auto _contains_any = [] (const std::string & str, const std::vector<std::string> & substrs) -> bool { |         auto _contains_any = [] (const std::string & str, const std::vector<std::string_view> & substrs) -> bool { | ||||||
|             for (const auto & substr : substrs) { |             for (const auto & substr : substrs) { | ||||||
|                 if (str.find(substr) < std::string::npos) { |                 if (str.find(substr) != std::string::npos) { | ||||||
|                     return true; |                     return true; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -204,12 +204,17 @@ static inline std::wstring unicode_wstring_from_utf8(const std::string & s) { | |||||||
|     // disable C++17 deprecation warning for std::codecvt_utf8 |     // disable C++17 deprecation warning for std::codecvt_utf8 | ||||||
| #    pragma clang diagnostic push | #    pragma clang diagnostic push | ||||||
| #    pragma clang diagnostic ignored "-Wdeprecated-declarations" | #    pragma clang diagnostic ignored "-Wdeprecated-declarations" | ||||||
|  | #elif defined(__GNUC__) | ||||||
|  | #    pragma GCC diagnostic push | ||||||
|  | #    pragma GCC diagnostic ignored "-Wdeprecated-declarations" | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|     std::wstring_convert<std::codecvt_utf8<wchar_t>> conv; |     std::wstring_convert<std::codecvt_utf8<wchar_t>> conv; | ||||||
|  |  | ||||||
| #if defined(__clang__) | #if defined(__clang__) | ||||||
| #    pragma clang diagnostic pop | #    pragma clang diagnostic pop | ||||||
|  | #elif defined(__GNUC__) | ||||||
|  | #    pragma GCC diagnostic pop | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|     return conv.from_bytes(s); |     return conv.from_bytes(s); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 fanyang
					fanyang