SICKAG / sick_safetyscanners_base

CPP (C++) Driver for SICK safety laser scanners
https://www.sick.com/de/en/opto-electronic-protective-devices/safety-laser-scanners/c/g187225
Apache License 2.0
12 stars 32 forks source link

Build with Clang failed #9

Closed GuillaumeFanene closed 11 months ago

GuillaumeFanene commented 2 years ago

When building the library with Clang instead of gcc, following errors are raised.

/sick/sick_safetyscanners_base/src/SickSafetyscanners.cpp:54:7: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
      std::move(sick::make_unique<sick::communication::TCPClient>(m_sensor_ip, sensor_tcp_port)))
      ^
/sick/sick_safetyscanners_base/src/SickSafetyscanners.cpp:54:7: note: remove std::move call here
      std::move(sick::make_unique<sick::communication::TCPClient>(m_sensor_ip, sensor_tcp_port)))

According to the documentation :

This warning warns when a call to std::move prevents copy elision. A typical scenario when copy elision can occur is when returning in a function with a class return type, when the expression being returned is the name of a non-volatile automatic object, and is not a function parameter, and has the same type as the function return type.

puck-fzi commented 2 years ago

Hi thanks for noticing. I will have a look into it and update it accordingly

Entropy512 commented 2 years ago

There are also some unused private members that clang errors on.

I've got a patch here internally that fixes this, I'm pursuing permission from management/legal to upstream it.

puck-fzi commented 1 year ago

Hi, did you get permissions to upstream the fixes?

Entropy512 commented 1 year ago

It's going to take a while unfortunately, we've got much higher priority requests to our IT and legal departments we're already waiting on before adding to the list.