webots icon indicating copy to clipboard operation
webots copied to clipboard

Warning on building GPS controller

Open ShuffleWire opened this issue 3 years ago • 1 comments

Hello,

I'm using the GPS node from an external controller, and building it with cause this warning :

/home/user/webots/include/controller/c/webots/gps.h:35:1: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
   35 | const double wb_gps_get_speed(WbDeviceTag tag);

Note that it because I'm using the flag -Wextra during my build process

The line could be found here : https://github.com/cyberbotics/webots/blob/8b90e794e9c5a29cab163afbcd90a8f260c20ff0/include/controller/c/webots/gps.h#L35

As far as I understand, their is no need of const when returning a simple value, as it's actually impossible to modify it anyway.

Do I miss something ?

I'm building that main.c :

#include <webots/gps.h>
int main()
{
    return 0;
}

with gcc main.c -I/home/user/webots/include/controller/c -Wall -Wextra

gcc version 10.2.1 20210110 (Debian 10.2.1-6)

ShuffleWire avatar Sep 16 '22 09:09 ShuffleWire

You are perfectly right. Feel free to open a new PR to remove this wrong const keyword.

omichel avatar Sep 16 '22 09:09 omichel