Skip to content

Commit e1f0804

Browse files
committed
fix: disable -Wshadow on gcc + fix useless cast warning
1 parent ac41cdd commit e1f0804

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ project_options(ENABLE_CACHE ENABLE_COMPILE_COMMANDS_SYMLINK)
102102
file(GLOB_RECURSE SOURCES "./src/*.cc")
103103
add_library(addon SHARED ${SOURCES})
104104

105-
target_link_libraries(addon PRIVATE project_options) # project_warnings
105+
if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
106+
target_compile_options(project_warnings INTERFACE "-Wno-shadow")
107+
endif()
108+
target_link_libraries(addon PRIVATE project_options project_warnings)
109+
106110

107111
if(ZMQ_DRAFT)
108112
target_compile_definitions(addon PRIVATE ZMQ_BUILD_DRAFT_API)

src/outgoing_msg.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ OutgoingMsg::OutgoingMsg(Napi::Value value, Module& module) {
4444
but once converted we do not have to copy a second time. */
4545
auto string_send = [&](std::string* str) {
4646
auto length = str->size();
47-
auto* data = const_cast<char*>(str->data());
47+
auto* data = str->data();
4848

4949
auto release = [](void*, void* str) {
5050
delete reinterpret_cast<std::string*>(str);

0 commit comments

Comments
 (0)