Skip to content

Commit

Permalink
fix: disable -Wshadow on gcc + fix useless cast warning
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Oct 23, 2024
1 parent ac41cdd commit e1f0804
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ project_options(ENABLE_CACHE ENABLE_COMPILE_COMMANDS_SYMLINK)
file(GLOB_RECURSE SOURCES "./src/*.cc")
add_library(addon SHARED ${SOURCES})

target_link_libraries(addon PRIVATE project_options) # project_warnings
if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
target_compile_options(project_warnings INTERFACE "-Wno-shadow")
endif()
target_link_libraries(addon PRIVATE project_options project_warnings)


if(ZMQ_DRAFT)
target_compile_definitions(addon PRIVATE ZMQ_BUILD_DRAFT_API)
Expand Down
2 changes: 1 addition & 1 deletion src/outgoing_msg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ OutgoingMsg::OutgoingMsg(Napi::Value value, Module& module) {
but once converted we do not have to copy a second time. */
auto string_send = [&](std::string* str) {
auto length = str->size();
auto* data = const_cast<char*>(str->data());
auto* data = str->data();

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

0 comments on commit e1f0804

Please sign in to comment.