Convert C_ASSERT to static_assert throughout codebase #880
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.
This PR converts all
C_ASSERTusages to modernstatic_assertthroughout the XDP for Windows codebase. Modern build toolchains supportstatic_assertwhich provides better error messages and is part of the C11/C++11 standards.Changes Made
static_assertconsistently for all files (C, C++, and headers)Files Updated
API Headers (25 instances)
published/external/xdpapi.h- XDP API size assertionspublished/external/afxdp.h- AF_XDP structure size assertionspublished/external/xdp/*.hheaders - Extension and datapath structure assertionsTest Files (21 instances)
test/functional/taef/tests.cpp- API version assertionstest/functional/lib/tests.cpp- Buffer and connection structure assertionstest/pktfuzz/pktfuzz.c- Frame and buffer layout assertionstest/fakendis/polldpc.c- NDIS structure size assertionsSource Files (26 instances)
src/xdplwf/- LWF driver alignment and offset assertionssrc/xdp/xsk.c- XSK/XDP structure compatibility assertionssrc/rtl/inc/xdprefcount.h- Reference counting size assertionsExample Changes
Before:
After:
The conversion maintains identical functionality while providing better error messages and using modern C/C++ standards consistently across the entire codebase.
Fixes #765.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.