google / emboss

Emboss is a tool for generating code that reads and writes binary data structures.
Apache License 2.0
67 stars 20 forks source link

Update code to not have deprecated-copy warnings #148

Open studgeek opened 1 month ago

studgeek commented 1 month ago

Currently emboss generates code that has some deprecated-copy warnings. It would be good to update generated code so that warning can be enabled. Since emboss is header-only this is important since any code that uses emboss has to also disable deprecated-copy warnings.

Sample warning:

15:15:22 INF ../../../environment/packages/emboss/runtime/cpp/emboss_memory_util.h:415:3: error: definition of implicit copy assignment operator for 'ContiguousBuffer<const unsigned char, 1, 0>' is deprecated because it has a user-declared copy constructor [-Werror,-Wdeprecated-copy]
15:15:22 INF 415 |   ContiguousBuffer(const ContiguousBuffer &other) = default;
15:15:22 INF |   ^
15:15:22 INF pw_strict_host_clang_debug/gen/pw_bluetooth/public/pw_bluetooth/hci_events.emb.h:39465:7: note: in implicit copy assignment operator for 'emboss::support::ContiguousBuffer<const unsigned char, 1, 0>' first required here
15:15:22 INF 39465 | class GenericInquiryResultWithRssiView final {
15:15:22 INF |       ^
15:15:22 INF ../../../environment/packages/emboss/runtime/cpp/emboss_array_view.h:69:11: note: in implicit move assignment operator for 'pw::bluetooth::emboss::GenericInquiryResultWithRssiView<emboss::support::ContiguousBuffer<const unsigned char, 1, 0>>' first required here
15:15:22 INF 69 |     view_ = array_view_[index_];
15:15:22 INF |           ^
15:15:22 INF ../../../environment/packages/emboss/runtime/cpp/emboss_array_view.h:76:11: note: in instantiation of member function 'emboss::support::ElementViewIterator<emboss::support::GenericArrayView<pw::bluetooth::emboss::GenericInquiryResultWithRssiView<emboss::support::ContiguousBuffer<const unsigned char, 1, 0>>, emboss::support::ContiguousBuffer<const unsigned char, 1, 0>, 14, 8>, emboss::support::ElementViewIteratorDirection::kForward>::operator+=' requested here
15:15:22 INF 76 |     *this += 1;
15:15:22 INF |           ^