canutils/candump: guard SOF_TIMESTAMPING macros with ifndef - #3788
Merged
Merged
Conversation
wenquan2015
pushed a commit
to wenquan2015/nuttx
that referenced
this pull request
Sep 17, 2026
depends-on: apache/nuttx-apps/pull/3788 Signed-off-by: wenquan1 <wenquan1@xiaomi.com>
Author
|
@xiaoxiang781216 This is a companion fix for apache/nuttx#20161. Could you please review? |
xiaoxiang781216
previously approved these changes
Sep 17, 2026
candump.c locally defines SOF_TIMESTAMPING_SOFTWARE, SOF_TIMESTAMPING_RX_SOFTWARE and SOF_TIMESTAMPING_RAW_HARDWARE. After nuttx added these macros to sys/socket.h, the build fails with -Werror=redefine. Wrap the local defines with #ifndef guards so they are only used when the system header does not provide them. Signed-off-by: wenquan1 <wenquan1@xiaomi.com>
wenquan2015
force-pushed
the
so-timestamping-fix
branch
from
September 18, 2026 02:17
6392fdd to
2ff27e3
Compare
wenquan2015
dismissed stale reviews from GUIDINGLI and xiaoxiang781216
via
September 18, 2026 03:16
c19b365
wenquan2015
force-pushed
the
so-timestamping-fix
branch
2 times, most recently
from
September 18, 2026 06:30
0056cc6 to
2ff27e3
Compare
Author
|
The CI nxstyle check fails because the entire |
Contributor
Ok, let's ignore the style check in candump.c |
xiaoxiang781216
approved these changes
Sep 18, 2026
GUIDINGLI
approved these changes
Sep 18, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
candump.c locally defines SOF_TIMESTAMPING_SOFTWARE, SOF_TIMESTAMPING_RX_SOFTWARE and SOF_TIMESTAMPING_RAW_HARDWARE for use with CAN
socket timestamping. After apache/nuttx#20161 (apache/nuttx#20161) added these macros to sys/socket.h as
part of the SO_TIMESTAMPING support, the build fails with -Werror=redefine:
candump.c:82: error: "SOF_TIMESTAMPING_SOFTWARE" redefined [-Werror]
/nuttx/include/sys/socket.h:240: note: this is the location of the previous definition
Wrap the local defines with #ifndef guards so they are only used when the system header does not provide them.
Impact
No behavioral change. The same macro values are used regardless of whether they come from the system header or the local fallback
definitions.
This is a companion fix for apache/nuttx#20161 (apache/nuttx#20161) (net: add SO_TIMESTAMPING support for
PKT sockets). Both PRs should be merged together.
Testing
Build: sim:can with CONFIG_NET_TIMESTAMP=y
Before: build fails with -Werror=redefine on SOF_TIMESTAMPING_SOFTWARE and SOF_TIMESTAMPING_RAW_HARDWARE.
After: build succeeds, no warnings.