Conversation
|
@copilot try again |
- alarm_factory.cpp: Remove std::move from const reference parameter to avoid use-after-move warning (COV_CPP_USE_AFTER_MOVE) - basic_decoration.cpp: Reorder buffer_format member declaration to appear before buffer stream members, ensuring it's initialized before create_buffer_stream() uses it (COV_CPP_UNINIT) Co-authored-by: Saviq <231077+Saviq@users.noreply.github.com>
Fixed in 25054f1:
|
|
@copilot there's more cases in the original bug:
|
- emitter.cpp:116: Remove std::move from const& parameter - client.cpp:46: Fix mismatched iterator by using member functions consistently - display.cpp:420: Initialize transformation with identity matrix - desktop_file_manager.cpp:265: Fix memory leak with g_autofree - egl_output.cpp:86: Fix mmap leak by adding munmap in destructor - optional_value.h: Value-initialize the value_ member to fix uninitialized value warnings in input_method_v1.cpp Co-authored-by: Saviq <231077+Saviq@users.noreply.github.com>
Fixed in ba2b319. I've addressed the full list of 20 violations: Fixed:
False positives (no changes needed):
|
TICS Quality Gate✔️ Passedmir
|
src/wayland/client.cpp
Outdated
| map->erase(remove_if( | ||
| begin(*map), | ||
| end(*map), | ||
| map->erase(std::remove_if( | ||
| map->begin(), | ||
| map->end(), | ||
| [&](auto& item){ return item.first == raw; }), | ||
| end(*map)); | ||
| map->end()); |
There was a problem hiding this comment.
OK, assuming that begin()/end() are resolved to the ones from std that changes nothing. Does it really fix a TICS violation?
I suspect the violation comes from elsewhere: not "knowing" that operator*() returns a reference to the same container. (It isn't clear that switching to operator->() should be any better.)
We can do better since C++20...
std::erase_if(*map, [&](auto const& item){ return item.first == raw; });39740d9 to
43ac49a
Compare
Related: #4503
What's new?
Fixes TICS static analysis violations across the codebase:
Fixed violations:
COV_CPP_USE_AFTER_MOVE in alarm_factory.cpp:35: Changed
cb = std::move(callback)tocb = callbackto avoid the analyzer warning about usingstd::moveon a const reference parameter.COV_CPP_UNINIT in basic_decoration.cpp:124: Reordered the
buffer_formatmember declaration in theBufferStreamsclass to appear before the buffer stream members, ensuring proper initialization order.COV_CPP_USE_AFTER_MOVE in emitter.cpp:116: Removed
std::movefrom const& parameter (same pattern as alarm_factory.cpp).COV_CPP_MISMATCHED_ITERATOR in client.cpp:46: Changed from
begin(*map)/end(*map)tomap->begin()/map->end()for consistent iterator usage.COV_CPP_UNINIT in display.cpp:420: Initialize
glm::mat2 transformationto identity matrix{1}.COV_CPP_RESOURCE_LEAK in desktop_file_manager.cpp:265: Added
g_autofreeto prevent memory leak ofsandboxed_app_id.COV_CPP_RESOURCE_LEAK in egl_output.cpp:86: Store mmap pointer and size as members, call
munmapin destructor.COV_CPP_UNINIT in input_method_v1.cpp:453,496,543: Changed
T value_;toT value_{};in optional_value.h to value-initialize the member.False positives (no changes needed):
weak_ptr::lock()result is correctly stored in the shared_ptr member.stream, not the moved-from parameter.data_bufferdoesn't own memory; the shm_pool does.event.nameis null-terminated.How to test
Checklist
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.