$ g++ --version
g++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Message: ROS2 tf2_msgs/msg/TFMessage in Humble
$ ros2 interface show tf2_msgs/msg/TFMessage
geometry_msgs/TransformStamped[] transforms
#
#
std_msgs/Header header
builtin_interfaces/Time stamp
int32 sec
uint32 nanosec
string frame_id
string child_frame_id
Transform transform
Vector3 translation
float64 x
float64 y
float64 z
Quaternion rotation
float64 x 0
float64 y 0
float64 z 0
float64 w 1
IDL:
$ find /opt/ros/humble | grep TFMessage.idl | xargs cat
// generated from rosidl_adapter/resource/msg.idl.em
// with input from tf2_msgs/msg/TFMessage.msg
// generated code does not contain a copyright notice
#include "geometry_msgs/msg/TransformStamped.idl"
module tf2_msgs {
module msg {
struct TFMessage {
sequence<geometry_msgs::msg::TransformStamped> transforms;
};
};
};
When compiling it with g++ with -Wall, -Wpedantic, I get the following warning.
libraries/AP_DDS/generated/tf2_msgs/msg/TFMessage.c: In function ‘tf2_msgs_msg_TFMessage_serialize_topic’:
libraries/AP_DDS/generated/tf2_msgs/msg/TFMessage.c:32:26: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare]
32 | for(int i = 0; i < topic->transforms_size; ++i)
| ^
libraries/AP_DDS/generated/tf2_msgs/msg/TFMessage.c: In function ‘tf2_msgs_msg_TFMessage_deserialize_topic’:
libraries/AP_DDS/generated/tf2_msgs/msg/TFMessage.c:50:30: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare]
50 | for(int i = 0; i < topic->transforms_size; ++i)
| ^
libraries/AP_DDS/generated/tf2_msgs/msg/TFMessage.c: In function ‘tf2_msgs_msg_TFMessage_size_of_topic’:
libraries/AP_DDS/generated/tf2_msgs/msg/TFMessage.c:62:26: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare]
62 | for(int i = 0; i < topic->transforms_size; ++i)
This is preventing me from using -Werr in my build.
For the for loops, perhaps use a uint32_t or a size_t type?
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*!
* @file TFMessage.h
* This header file contains the declaration of the described types in the IDL file.
*
* This file was generated by the tool gen.
*/
#ifndef _TFMessage_H_
#define _TFMessage_H_
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdint.h>
#include <stdbool.h>
#include "geometry_msgs/msg/TransformStamped.h"
typedef struct tf2_msgs_msg_TFMessage
{
uint32_t transforms_size;
geometry_msgs_msg_TransformStamped transforms[100];
} tf2_msgs_msg_TFMessage;
struct ucdrBuffer;
bool tf2_msgs_msg_TFMessage_serialize_topic(struct ucdrBuffer* writer, const tf2_msgs_msg_TFMessage* topic);
bool tf2_msgs_msg_TFMessage_deserialize_topic(struct ucdrBuffer* reader, tf2_msgs_msg_TFMessage* topic);
uint32_t tf2_msgs_msg_TFMessage_size_of_topic(const tf2_msgs_msg_TFMessage* topic, uint32_t size);
#ifdef __cplusplus
}
#endif
#endif // _TFMessage_H_
OS: Ubuntu 22.04 g++
Message: ROS2 tf2_msgs/msg/TFMessage in Humble
IDL:
When compiling it with g++ with -Wall, -Wpedantic, I get the following warning.
This is preventing me from using
-Werr
in my build.For the
for
loops, perhaps use auint32_t
or asize_t
type?