Skip to content

Commit

Permalink
eliminate [-Wformat-zero-length] and [-Wunused-but-set-variable] warn…
Browse files Browse the repository at this point in the history
…ing message

```
In file included from /__w/mros2-mbed/mros2-mbed/mros2/include/mros2.h:9,
                 from /__w/mros2-mbed/mros2-mbed/workspace/mturtle_teleop/app.cpp:17:
/__w/mros2-mbed/mros2-mbed/workspace/mturtle_teleop/app.cpp: In function 'int main()':
/__w/mros2-mbed/mros2-mbed/workspace/mturtle_teleop/app.cpp:116:18: warning: zero-length gnu_printf format string [-Wformat-zero-length]
  116 |       MROS2_INFO("");
      |                  ^~
/__w/mros2-mbed/mros2-mbed/mros2/include/mros2/logging.h:46:12: note: in definition of macro 'MROS2_INFO'
   46 |     printf(__VA_ARGS__); \
      |            ^~~~~~~~~~~
/__w/mros2-mbed/mros2-mbed/workspace/mturtle_teleop/app.cpp:88:10: warning: variable 'fds' set but not used [-Wunused-but-set-variable]
   88 |   pollfh fds[1];
      |          ^~~
/__w/mros2-mbed/mros2-mbed/workspace/mturtle_teleop/app.cpp:95:8: warning: unused variable 'c' [-Wunused-variable]
   95 |   char c;
      |        ^
```
  • Loading branch information
takasehideki committed Oct 5, 2023
1 parent e8fa0e2 commit 2997f0f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions workspace/mturtle_teleop/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ int main()
auto publish_count = 10;
double speed = 0.5;
double turn = 1.0;
char c;
while (1)
{
if (publish_count < 10)
Expand All @@ -111,9 +110,8 @@ int main()
MROS2_INFO("q/z : increase/decrease max speeds by 10 percent");
MROS2_INFO("w/x : increase/decrease only linear speed by 10 percent");
MROS2_INFO("e/c : increase/decrease only angular speed by 10 percent");
MROS2_INFO("currently: speed %s / turn %s",
MROS2_INFO("currently: speed %s / turn %s\r\n",
double_to_string(speed).c_str(), double_to_string(turn).c_str());
MROS2_INFO("");
}

char c;
Expand Down

0 comments on commit 2997f0f

Please sign in to comment.