-
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
device.h: C++20 compatibility #70403
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
bd3f595
device.h: conditionally remove init braces for C++20 compatibility
marc-hb 7902ce8
tests: cpp: add some C++ coverage for device.h / Device Tree
marc-hb f9de7f8
pm: device.h: fix pm_device designated initializers order for C++
marc-hb efa14ae
tests: cpp: add C++ coverage for pm/device.h
marc-hb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (c) 2024 Intel Corporation | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Application overlay for creating a fake device instance we can use to | ||
* test. Subset of tests/kernel/device/app.overlay and other app.overlay | ||
* files. | ||
*/ | ||
|
||
/ { | ||
test_dev0_boot: dev0 { | ||
compatible = "fake-cpp-driver"; | ||
status = "okay"; | ||
}; | ||
|
||
test_dev1_dfr: dev1 { | ||
compatible = "fake-cpp-driver"; | ||
status = "okay"; | ||
|
||
zephyr,deferred-init; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Copyright (c) 2024, Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
include: [base.yaml] | ||
|
||
description: | | ||
When this file is missing _or_ the include above is missing, then | ||
test coverage is _quietly_ reduced! Code that should fail turns | ||
green. Nasty. | ||
|
||
compatible: "fake-cpp-driver" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Odd to find this macro defined after it was "used" above. Not strictly required, of course.
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.
This places the macro closer to the two locations where it's used.
It's also a lower-level implementation detail, so I think it it reads better last - that's subjective of course.
EDIT: I wrote too fast, I was referring to
Z_DEVICE_INIT_ENTRY_DEV()
. Then I wanted to preserve the "top-down" order for the next macro.I think it's "odd" only if you're tainted by C compilation which requires "forward" declarations. Maybe dating all the way back to when compilation was performed in a single pass? Funny how the pre-processor is in some respect more advanced that C itself... https://stackoverflow.com/questions/3136686/is-the-c99-preprocessor-turing-complete