UniversalRobots / Universal_Robots_Client_Library

A C++ library for accessing the UR interfaces that facilitate the use of UR robotic manipulators by external applications.
Apache License 2.0
117 stars 88 forks source link

Fix unique_ptr type #124

Closed RobertWilbrandt closed 1 year ago

RobertWilbrandt commented 1 year ago

gcc 12 warns about this:

In file included from /usr/include/c++/12/memory:76,
                 from /home/wilbrandt/FZI/robot_folders/checkout/ur_humble/colcon_ws/src/Universal_Robots_Client_Library/include/ur_client_library/log.h:21,
                 from /home/wilbrandt/FZI/robot_folders/checkout/ur_humble/colcon_ws/src/Universal_Robots_Client_Library/src/log.cpp:31:
In member function ‘void std::default_delete<_Tp>::operator()(_Tp*) const [with _Tp = char]’,
    inlined from ‘void std::__uniq_ptr_impl<_Tp, _Dp>::reset(pointer) [with _Tp = char; _Dp = std::default_delete<char>]’ at /usr/include/c++/12/bits/unique_ptr.h:203:16,
    inlined from ‘void std::unique_ptr<_Tp, _Dp>::reset(pointer) [with _Tp = char; _Dp = std::default_delete<char>]’ at /usr/include/c++/12/bits/unique_ptr.h:501:12,
    inlined from ‘void urcl::log(const char*, int, LogLevel, const char*, ...)’ at /home/wilbrandt/FZI/robot_folders/checkout/ur_humble/colcon_ws/src/Universal_Robots_Client_Library/src/log.cpp:124:19:
/usr/include/c++/12/bits/unique_ptr.h:95:9: warning: ‘void operator delete(void*, std::size_t)’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
   95 |         delete __ptr;
      |         ^~~~~~~~~~~~
/home/wilbrandt/FZI/robot_folders/checkout/ur_humble/colcon_ws/src/Universal_Robots_Client_Library/src/log.cpp: In function ‘void urcl::log(const char*, int, LogLevel, const char*, ...)’:
/home/wilbrandt/FZI/robot_folders/checkout/ur_humble/colcon_ws/src/Universal_Robots_Client_Library/src/log.cpp:112:38: note: returned from ‘void* operator new [](std::size_t)’
  112 |     buffer.reset(new char[buffer_size]);
      |
codecov[bot] commented 1 year ago

Codecov Report

Base: 51.23% // Head: 51.19% // Decreases project coverage by -0.03% :warning:

Coverage data is based on head (409bca1) compared to base (cd6f4a7). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #124 +/- ## ========================================== - Coverage 51.23% 51.19% -0.04% ========================================== Files 82 82 Lines 2467 2465 -2 Branches 279 278 -1 ========================================== - Hits 1264 1262 -2 - Misses 1072 1073 +1 + Partials 131 130 -1 ``` | [Impacted Files](https://codecov.io/gh/UniversalRobots/Universal_Robots_Client_Library/pull/124?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots) | Coverage Δ | | |---|---|---| | [src/log.cpp](https://codecov.io/gh/UniversalRobots/Universal_Robots_Client_Library/pull/124/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots#diff-c3JjL2xvZy5jcHA=) | `55.81% <100.00%> (ø)` | | | [include/ur\_client\_library/queue/atomicops.h](https://codecov.io/gh/UniversalRobots/Universal_Robots_Client_Library/pull/124/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots#diff-aW5jbHVkZS91cl9jbGllbnRfbGlicmFyeS9xdWV1ZS9hdG9taWNvcHMuaA==) | `50.00% <0.00%> (-3.34%)` | :arrow_down: | | [tests/test\_tcp\_server.cpp](https://codecov.io/gh/UniversalRobots/Universal_Robots_Client_Library/pull/124/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots#diff-dGVzdHMvdGVzdF90Y3Bfc2VydmVyLmNwcA==) | `99.23% <0.00%> (+0.75%)` | :arrow_up: | | [include/ur\_client\_library/comm/producer.h](https://codecov.io/gh/UniversalRobots/Universal_Robots_Client_Library/pull/124/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots#diff-aW5jbHVkZS91cl9jbGllbnRfbGlicmFyeS9jb21tL3Byb2R1Y2VyLmg=) | `40.00% <0.00%> (+1.90%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UniversalRobots)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.