Skip to content

Commit 854ac57

Browse files
authored
Disable deprecation warning for get_resource() (#805)
### Changelog None ### Docs None ### Description See #804 for general description of the issue. Missed another API that was deprecated. This should make the build pass now, verified by enabling the ros2-testing repo in an ubuntu VM and building successfully. Fixes: FLE-165 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Silences deprecated API warnings in `message_definition_cache.cpp` for compatibility across ROS2 distros. > > - Wraps `ament_index_cpp::get_resource("rosidl_interfaces", ...)` with `#pragma GCC diagnostic push/ignored("-Wdeprecated-declarations")` (mirroring existing handling for `get_package_share_directory`) > - No functional logic changes; build noise reduced > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 7aba2b6. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 605f0c2 commit 854ac57

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ros/src/foxglove_bridge/src/message_definition_cache.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,15 @@ const MessageSpec& MessageDefinitionCache::load_message_spec(
223223
#pragma GCC diagnostic pop
224224

225225
// Get the rosidl_interfaces index contents for this package
226+
// TODO: FLE-167: Remove warning once ament_index_cpp is updated and synced across all current
227+
// ROS2 distributions.
228+
#pragma GCC diagnostic push
229+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
226230
std::string index_contents;
227231
if (!ament_index_cpp::get_resource("rosidl_interfaces", package, index_contents)) {
228232
throw DefinitionNotFoundError(definition_identifier.package_resource_name);
229233
}
234+
#pragma GCC diagnostic pop
230235

231236
// Find the first line that ends with the filename we're looking for
232237
const auto lines = split_string(index_contents);

0 commit comments

Comments
 (0)