diff options
author | thegeorg <thegeorg@yandex-team.ru> | 2022-02-23 11:43:35 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.ru> | 2022-02-23 11:43:35 +0300 |
commit | dc607d4bdea3e3fd300a1b96c14989024ae4370b (patch) | |
tree | 9bb9326da2ea21cab63ed845051b293ca5317420 | |
parent | 73db9ea237def2c2635db24388affcc401da6e3e (diff) | |
download | ydb-dc607d4bdea3e3fd300a1b96c14989024ae4370b.tar.gz |
clang-cl: Enable yet another warning with the very long name
ref:878ef48a386627a1eb0325b0ccff820b1d627900
-rwxr-xr-x | build/ymake_conf.py | 1 | ||||
-rw-r--r-- | util/CMakeLists.txt | 3 | ||||
-rw-r--r-- | util/network/interface.cpp | 10 | ||||
-rw-r--r-- | util/ya.make | 4 |
4 files changed, 13 insertions, 5 deletions
diff --git a/build/ymake_conf.py b/build/ymake_conf.py index 198fd65315..97e98795e6 100755 --- a/build/ymake_conf.py +++ b/build/ymake_conf.py @@ -2469,7 +2469,6 @@ class MSVCCompiler(MSVC, Compiler): '-Wno-macro-redefined', '-Wno-parentheses', '-Wno-pragma-pack', - '-Wno-tautological-constant-out-of-range-compare', '-Wno-unknown-argument', '-Wno-unknown-warning-option', )) diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt index e61a0c6777..7dfb4b6db8 100644 --- a/util/CMakeLists.txt +++ b/util/CMakeLists.txt @@ -1,4 +1,7 @@ add_library(yutil) +target_compile_options(yutil PRIVATE + -Wnarrowing +) target_link_libraries(yutil PUBLIC contrib-libs-cxxsupp util-charset diff --git a/util/network/interface.cpp b/util/network/interface.cpp index 256776c6d3..03c3ccd98d 100644 --- a/util/network/interface.cpp +++ b/util/network/interface.cpp @@ -1,5 +1,7 @@ #include "interface.h" +#include <util/string/ascii.h> + #if defined(_unix_) #include <ifaddrs.h> #endif @@ -44,10 +46,10 @@ namespace NAddr { TNetworkInterface networkInterface; // Not very efficient but straightforward - for (size_t i = 0; ptr->FriendlyName[i] != 0; i++) { - CHAR w = ptr->FriendlyName[i]; - char c = (w < 0x80) ? char(w) : '?'; - networkInterface.Name.append(1, c); + wchar_t* it = ptr->FriendlyName; + while (*it != '\0') { + networkInterface.Name += IsAscii(*it) ? static_cast<char>(*it) : '?'; + ++it; } networkInterface.Address = new TOpaqueAddr(a); diff --git a/util/ya.make b/util/ya.make index 6ebe7e40cf..ab34124774 100644 --- a/util/ya.make +++ b/util/ya.make @@ -238,6 +238,10 @@ JOIN_SRCS( string/vector.cpp ) +IF (GCC OR CLANG OR CLANG_CL) + CFLAGS(-Wnarrowing) +ENDIF() + IF (ARCH_ARM) CFLAGS(-D_FORTIFY_SOURCE=0) ENDIF() |