Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shadowing Issues in Generated Headers #356

Open
emrainey opened this issue Nov 18, 2024 · 0 comments
Open

Shadowing Issues in Generated Headers #356

emrainey opened this issue Nov 18, 2024 · 0 comments
Labels
bug Something isn't working minor Something that needs to be done but isn't urgent.

Comments

@emrainey
Copy link

On 3.0.0 preview, many fields in generated header seem to be shadowing other variables.

[build] /include/uavcan/_register/Name_1_0.hpp: In constructor 'uavcan::_register::Name_1_0::Name_1_0(const _traits_::TypeOf::name&, const allocator_type&)':
[build] /include/uavcan/_register/Name_1_0.hpp:205:39: error: declaration of 'name' shadows a member of 'uavcan::_register::Name_1_0' [-Werror=shadow]
[build]   205 |         const _traits_::TypeOf::name& name,
[build]       |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
[build] /include/uavcan/_register/Name_1_0.hpp:248:28: note: shadowed declaration is here
[build]   248 |     _traits_::TypeOf::name name;
[build]       |                            ^~~~
[build] /include/uavcan/_register/Name_1_0.hpp: In constructor 'uavcan::_register::Name_1_0::Name_1_0(const _traits_::TypeOf::name&, const allocator_type&)':
[build] /include/uavcan/_register/Name_1_0.hpp:205:39: error: declaration of 'name' shadows a member of 'uavcan::_register::Name_1_0' [-Werror=shadow]
[build]   205 |         const _traits_::TypeOf::name& name,
[build]       |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
[build] /include/uavcan/_register/Name_1_0.hpp:248:28: note: shadowed declaration is here
[build]   248 |     _traits_::TypeOf::name name;
[build]       |                            ^~~~
[build] /include/uavcan/_register/Name_1_0.hpp: In constructor 'uavcan::_register::Name_1_0::Name_1_0(const _traits_::TypeOf::name&, const allocator_type&)':
[build] /include/uavcan/_register/Name_1_0.hpp:205:39: error: declaration of 'name' shadows a member of 'uavcan::_register::Name_1_0' [-Werror=shadow]
[build]   205 |         const _traits_::TypeOf::name& name,
[build]       |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
[build] /include/uavcan/_register/Name_1_0.hpp:248:28: note: shadowed declaration is here
[build]   248 |     _traits_::TypeOf::name name;
[build]       |                            ^~~~
[build] /include/uavcan/_register/Name_1_0.hpp: In function 'nunavut::support::SerializeResult uavcan::_register::serialize(const Name_1_0&, nunavut::support::bitspan)':
[build] /include/uavcan/_register/Name_1_0.hpp:276:24: error: declaration of '_result3_' shadows a previous local [-Werror=shadow]
[build]   276 |             const auto _result3_ = out_buffer.setUxx(obj.name[_index2_], 8U);
[build]       |                        ^~~~~~~~~
[build] /include/uavcan/_register/Name_1_0.hpp:268:20: note: shadowed declaration is here
[build]   268 |         const auto _result3_ = out_buffer.setUxx(obj.name.size(), 8U);
[build]       |                    ^~~~~~~~~
[build] In file included from /include/uavcan/_register/Value_1_0.hpp:51,
[build]                  from /repo/external/libcyphal/include/libcyphal/application/registry/register.hpp:17:
[build] /include/uavcan/primitive/String_1_0.hpp: In constructor 'uavcan::primitive::String_1_0::String_1_0(const _traits_::TypeOf::value&, const allocator_type&)':
[build] /include/uavcan/primitive/String_1_0.hpp:206:40: error: declaration of 'value' shadows a member of 'uavcan::primitive::String_1_0' [-Werror=shadow]
[build]   206 |         const _traits_::TypeOf::value& value,
[build]       |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
[build] /include/uavcan/primitive/String_1_0.hpp:249:29: note: shadowed declaration is here
[build]   249 |     _traits_::TypeOf::value value;
[build]       |                             ^~~~~
[build] /include/uavcan/primitive/String_1_0.hpp: In constructor 'uavcan::primitive::String_1_0::String_1_0(const _traits_::TypeOf::value&, const allocator_type&)':
[build] /include/uavcan/primitive/String_1_0.hpp:206:40: error: declaration of 'value' shadows a member of 'uavcan::primitive::String_1_0' [-Werror=shadow]
[build]   206 |         const _traits_::TypeOf::value& value,
[build]       |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
[build] /include/uavcan/primitive/String_1_0.hpp:249:29: note: shadowed declaration is here
[build]   249 |     _traits_::TypeOf::value value;
[build]       |                             ^~~~~

This will suppress the warning for trivial issues.

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow" 
#include ....
#pragma GCC diagnostic pop
@emrainey emrainey added bug Something isn't working minor Something that needs to be done but isn't urgent. labels Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working minor Something that needs to be done but isn't urgent.
Projects
None yet
Development

No branches or pull requests

1 participant