esp-adf icon indicating copy to clipboard operation
esp-adf copied to clipboard

Changed order of definitions in i2s_stream to be compatible with cpp. (AUD-5329)

Open tank104 opened this issue 10 months ago • 4 comments

Changed order of definitions in i2s_stream to be compatible with c++. C++ requires define of struct to match the order.

We are getting errors like:

components/audio_stream/include/i2s_stream.h:232:1: error: designator order for field 'i2s_stream_cfg_t::transmit_mode' does not match declaration order in 'i2s_stream_cfg_t'

See issue: https://github.com/espressif/esp-adf/issues/1190

tank104 avatar Apr 08 '24 21:04 tank104

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Apr 08 '24 21:04 CLAassistant

I think those macros should die (see comment in the linked issue). You're correcting one issue here (and thank you), but many other are pending underneath for the other structures you haven't used yet. This technique of construction by macro is dumb and should be avoided. The compiler is telling you so too, just listen to it.

X-Ryl669 avatar Apr 12 '24 21:04 X-Ryl669

Sure I agree - but up to you if you want to put it in - it does solve my issues though, and the samples.

tank104 avatar Apr 15 '24 03:04 tank104

Would love to see this merged. It's bugging me too. Either way, this fix should go in.

As for macro based construction... is there an alternate pattern for C?

From a pure compat perspective, maybe the ADF team should adopt a pattern that any macro initializer list has to have a unittest with a .cc extension so it is run through the C++ compiler. That would likely lock in the ordering during CI in a "good enough" way.

awong-dev avatar Apr 28 '24 08:04 awong-dev