-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
drivers: adc: fix warning when using ADC_DT_SPEC_GET
macro on C++
#69419
drivers: adc: fix warning when using ADC_DT_SPEC_GET
macro on C++
#69419
Conversation
Hello @ArchieAtkinson, and thank you very much for your first pull request to the Zephyr project! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A similar, recent change broke one of our toolchains:
Please hold this back until the corresponding policy has been discussed and approved and this flag added in CI.
This policy should be either enforced everywhere or nowhere.
See also:
8b1a9b3
to
aff8bd0
Compare
Enforcing this policy could be as simple as making sure CI compiles every .h file with https://github.com/zephyrproject-rtos/zephyr/pull/69486/files explains why. This would of course catch ALL OTHER C++ compatibility issues, not just this initializer warning. |
As someone who uses Zephyr with C++20 in production code, I would love to see these compatibility issues solved and be part of the effort to do so. However, I think there would have to be an appetite for it within the project as macros like |
aff8bd0
to
54092f3
Compare
Modifies the `ADC_CHANNEL_CFG_DT` macro to always initialise the `differential` property to prevent the `-Wmissing-field-initializers` warning when using `ADC_DT_SPEC_GET` macros in C++ when not using a `differential` ADC. Signed-off-by: Archie Atkinson <archieatkinson97@gmail.com>
54092f3
to
f2a6c20
Compare
This could be as simple as compiling a file with a lot of EDIT: except... macros. Unused C/C++ macros are parsed but obviously not "compiled" unless you use them :-( |
It's a bit more complicated because unused macros are parsed but not compiled. It can be done though, see how I'm adding C++ compilation of See if you can actually compile ADC_CHANNEL_CFG_DT() in C++ using some EDIT: I thoroughly documented this type of compatibility issue between C and C++ in: |
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
Modifies the
ADC_CHANNEL_CFG_DT
macro to always initialise thedifferential
property to prevent the-Wmissing-field-initializers
warning when usingADC_DT_SPEC_GET
macros in C++ when not using a differential ADC.