Conversation
…ated tests Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
…hance tests Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
- Introduced test for misaligned buffer pointer in VehicleEventFlags to verify correct handling of misalignment. - Added new test cases for inline read functions to check misaligned access scenarios. - Updated test headers to include new test functions for misaligned access. - Ensured existing tests maintain functionality while adding necessary padding for alignment safety. Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
…of J2735_INTERNAL_ROOT_SIZE_* for non-extensible types Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
- Added Doxygen code blocks for wire format documentation in multiple DE headers to improve clarity and consistency. - Introduced static assertions in various DF headers to ensure consistency between internal choice index bits and defined widths. - Updated templates for generating DE and DF code to include new documentation formats and static assertions. - Added unit tests to validate the presence of static assertions in generated code for both DE and DF types. Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
…T STRING macros Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
…oss multiple header files Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
…ents Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
…ons across multiple header files and templates Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
This PR is a cross-cutting cleanup of the J2735 code generator/templates and generated C headers/tests, focused on making wire-format docs render correctly in Doxygen, unifying bit-width constant usage (J2735_BW_*), tightening generator validation, and expanding misalignment coverage.
Changes:
- Unified generated headers/templates to prefer canonical
J2735_BW_*constants (removing per-header ROOT_SIZE usage for non-extensible BIT STRINGs) and added new compile-time_Static_assertchecks for DF/CHOICE/SEQUENCE invariants. - Improved Doxygen comment structure for ASN.1 blocks and wire-format sections; normalized range/hex-width formatting in BIT STRING docs.
- Hardened Python tooling (StrictUndefined Jinja env, cached env creation, improved filters) and added/updated unit tests plus multiple C misalignment tests (DF, DE, UPER primitives).
Reviewed changes
Copilot reviewed 70 out of 70 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/tests/c_generator/test_wire_format_variants.py | Adds coverage for _sum_field_bits() erroring on unresolved fields. |
| tools/tests/c_generator/test_jinja_filters.py | Adds hyphenated ASN.1 name tests and unresolved TypeReference behavior tests. |
| tools/tests/c_generator/test_choice_type.py | Validates generated _Static_assert for CHOICE index bits. |
| tools/tests/c_generator/test_bitstring_size.py | Updates expectations to use J2735_BW_* instead of ROOT_SIZE. |
| tools/tests/c_generator/test_bitstring_internal_raw_read.py | Updates expectations so RAW_READ uses J2735_BW_* for non-extensible types. |
| tools/tests/c_generator/test_assemble_df_sequence.py | New SEQUENCE assembly tests covering _Static_assert emission/guards. |
| tools/tests/c_generator/test_assemble_de_bitstring.py | Adds assertions about banners/constants and Doxygen tag structure in assembled DE output. |
| tools/templates/wire_format_sequence_section.j2 | Switches ASN.1 definition block to @verbatim for Doxygen rendering. |
| tools/templates/bitwidth_constants.j2 | Uses BIT STRING root_size for BW comment derivation. |
| tools/templates/bitstring/bitstring_size.j2 | Non-extensible size macro now returns J2735_BW_*. |
| tools/templates/bitstring/bitstring_is_extended.j2 | Doc unification/formatting changes in template header comment. |
| tools/templates/bitstring/bitstring_internal_raw_read.j2 | Non-extensible RAW_READ now reads J2735_BW_* bits. |
| tools/templates/bitstring/bitstring_internal_get_one.j2 | Doc unification/formatting changes in template header comment. |
| tools/templates/bitstring/bitstring_internal_get_all.j2 | Fixes hex range formatting width based on computed return_type. |
| tools/templates/bitstring/bitstring_get_one.j2 | Doc unification/formatting changes in template header comment. |
| tools/templates/bitstring/bitstring_get.j2 | Doc unification/formatting changes in template header comment. |
| tools/templates/assemble_df_sequence.j2 | Adds SEQUENCE _Static_assert guards and consistent includes/indentation. |
| tools/templates/assemble_df_choice.j2 | Uses shared asn1_definition.j2 and adds CHOICE _Static_assert. |
| tools/templates/assemble_de_bitstring.j2 | Refactors DE BIT STRING doc blocks, adds @par sections, and conditions constants section on extensibility. |
| tools/templates/asn1_definition.j2 | Unifies ASN.1 rendering for SEQUENCE/CHOICE/BIT STRING via branching. |
| tools/j2735_spec_constraints.py | Introduces named UPER overhead constants used by tooling logic. |
| tools/j2735_c_generator_wire_format.py | Changes _sum_field_bits() to raise on unresolved widths (no silent None→0). |
| tools/j2735_c_generator_size_constants.py | Renames template-name constant for consistency. |
| tools/j2735_c_generator_jinja.py | Adds cached Jinja env, StrictUndefined, and improves filters (incl. hyphenated name support). |
| tests/J2735_internal_DF_PathPrediction_test.h | Updates brief/wording for DF PathPrediction tests. |
| tests/J2735_internal_DF_PathPrediction_test.c | Cleans includes/suppressions, normalizes padding comments, keeps misalignment test. |
| tests/J2735_internal_DF_IntersectionReferenceID_test.h | Updates brief and fixes grammar (“optional field”). |
| tests/J2735_internal_DF_IntersectionReferenceID_test.c | Cleans includes/suppressions, keeps misalignment test. |
| tests/J2735_internal_DF_BSMcoreData_test.h | Updates brief wording. |
| tests/J2735_internal_DF_BSMcoreData_test.c | Cleans includes/suppressions and retains misalignment test. |
| tests/J2735_internal_DF_ApproachOrLane_test.h | Updates brief wording. |
| tests/J2735_internal_DF_ApproachOrLane_test.c | Cleans includes/suppressions and retains misalignment test. |
| tests/J2735_internal_DE_VerticalAccelerationThreshold_test.h | Fixes header guard naming to match internal convention. |
| tests/J2735_internal_DE_VehicleEventFlags_test.h | Fixes header guard naming and adds misalignment test prototype. |
| tests/J2735_internal_DE_VehicleEventFlags_test.c | Adds misalignment test and reduces redundant per-test derivation blocks. |
| tests/J2735_internal_DE_UserSizeAndBehaviour_test.h | Fixes header guard naming to match internal convention. |
| tests/J2735_internal_DE_TransitStatus_test.h | Fixes header guard naming to match internal convention. |
| tests/J2735_internal_DE_TrafficLightOperationStatus_test.h | Fixes header guard naming to match internal convention. |
| tests/J2735_internal_DE_PublicSafetyDirectingTrafficSubType_test.h | Fixes header guard naming to match internal convention. |
| tests/J2735_internal_DE_PublicSafetyAndRoadWorkerActivity_test.h | Fixes header guard naming to match internal convention. |
| tests/J2735_internal_DE_PersonalDeviceUsageState_test.h | Fixes header guard naming to match internal convention. |
| tests/J2735_internal_DE_PersonalAssistive_test.h | Fixes header guard naming to match internal convention. |
| tests/J2735_internal_DE_LaneSharing_test.h | Fixes header guard naming to match internal convention. |
| tests/J2735_internal_DE_LaneDirection_test.h | Fixes header guard naming to match internal convention. |
| tests/J2735_internal_DE_GNSSstatus_test.h | Fixes header guard naming to match internal convention. |
| tests/J2735_internal_DE_ExteriorLights_test.h | Fixes header guard naming to match internal convention. |
| tests/J2735_internal_DE_BrakeAppliedStatus_test.h | Fixes header guard naming to match internal convention. |
| tests/J2735_internal_DE_AllowedManeuvers_test.h | Fixes header guard naming to match internal convention. |
| tests/J2735_UPER_test.h | Adds misalignment test declarations for UPER primitive helpers. |
| tests/J2735_UPER_test.c | Expands Doxygen wire-format docs and adds UPER misalignment tests; updates vectors/comments. |
| src/J2735_internal_DF_PathPrediction.h | Switches ASN.1 block to @verbatim and adds root-size _Static_assert. |
| src/J2735_internal_DF_IntersectionReferenceID.h | Switches ASN.1 block to @verbatim. |
| src/J2735_internal_DF_BSMcoreData.h | Switches ASN.1 block to @verbatim and adds offset-chain _Static_assert. |
| src/J2735_internal_DF_ApproachOrLane.h | Switches ASN.1 block to @verbatim and adds CHOICE index-bits _Static_assert. |
| src/J2735_internal_DE_VerticalAccelerationThreshold.h | Removes ROOT_SIZE constant usage in macros; improves doc blocks and hex ranges. |
| src/J2735_internal_DE_VehicleEventFlags.h | Improves doc blocks and note formatting; keeps constants section for extensible type. |
| src/J2735_internal_DE_UserSizeAndBehaviour.h | Improves doc blocks and hex ranges in GET_ALL return docs. |
| src/J2735_internal_DE_TransitStatus.h | Removes ROOT_SIZE constant usage in macros; improves doc blocks and hex ranges. |
| src/J2735_internal_DE_TrafficLightOperationStatus.h | Improves doc blocks and hex ranges in GET_ALL return docs. |
| src/J2735_internal_DE_PublicSafetyDirectingTrafficSubType.h | Improves doc blocks and hex ranges in GET_ALL return docs. |
| src/J2735_internal_DE_PublicSafetyAndRoadWorkerActivity.h | Improves doc blocks and hex ranges in GET_ALL return docs. |
| src/J2735_internal_DE_PersonalDeviceUsageState.h | Improves doc blocks and note formatting. |
| src/J2735_internal_DE_PersonalAssistive.h | Improves doc blocks and hex ranges in GET_ALL return docs. |
| src/J2735_internal_DE_LaneSharing.h | Removes ROOT_SIZE constant usage in macros; improves doc blocks and note formatting. |
| src/J2735_internal_DE_LaneDirection.h | Removes ROOT_SIZE constant usage in macros; improves doc blocks and hex ranges. |
| src/J2735_internal_DE_GNSSstatus.h | Removes ROOT_SIZE constant usage in macros; improves doc blocks and hex ranges. |
| src/J2735_internal_DE_ExteriorLights.h | Improves doc blocks and note formatting. |
| src/J2735_internal_DE_BrakeAppliedStatus.h | Removes ROOT_SIZE constant usage in macros; improves doc blocks and hex ranges. |
| src/J2735_internal_DE_AllowedManeuvers.h | Removes ROOT_SIZE constant usage in macros; improves doc blocks and note formatting. |
| .github/instructions/license_header.instructions.md | Adds explicit .j2 license header example and normalizes placeholders. |
You can also share your feedback on Copilot code review. Take the survey.
…verbatim Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
…ding test Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
…ltiple files Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
Signed-off-by: Yogev Neumann <xqgex@users.noreply.github.com>
Contributor
Python CI ReportCommit: Python TestsTest Output✅ All tests passed Coverage: 96%Per-file coverage (10 modules)
Details (936 statements, 41 missed)
Python Static Analysis
mypypylintflake8ruffcodespell |
Contributor
CI ReportCommit: Static Analysis
cppcheckClick to expandclang-tidyClick to expandSanitizers (ASan + UBSan)Test Output✅ No issues detected Valgrind Memory CheckTest Output✅ No memory issues detected |
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.
Pull Request
Description
Systematic quality sweep across generated headers, Jinja2 templates, Python tooling, and C tests to resolve naming inconsistencies, improve Doxygen output, harden the code generator, and expand test coverage.
ROOT_SIZE→J2735_BW_*constant unification: Removed per-headerJ2735_INTERNAL_ROOT_SIZE_<TYPE>constants from all 15 non-extensible DE headers._RAW_READand_SIZEmacros now reference the canonicalJ2735_BW_*constants fromJ2735_internal_constants.h, eliminating the dual-name problem._Static_assertfor non-extensible DE headers: Added compile-time assertions to 7 non-extensible DE headers that were missing them, ensuring the root bitstring size matches theJ2735_BW_*constant at compile time.@code/@endcodewith@verbatim/@endverbatimfor ASCII-art wire diagrams across all 15 DE headers and 4 DF headers (Doxygen was mangling box-drawing characters as C code). Added@parsection prefixes for proper Doxygen section grouping.bitstring_internal_get_all.j2template to derive hex format width fromreturn_type, fixing 10 headers whereuint8_treturn types incorrectly showed0x0000–0x00FFinstead of0x00–0xFF.filter_screaming_snake()andfilter_snake_case()to handle hyphenated ASN.1 names (e.g.,Offset-B10→OFFSET_B_10,Node-LL-24B→NODE_LL_24_B) with 4 new doctests._sum_field_bits()validation: Replaced silentNone → 0coercion with an explicitValueErrorfor unresolved field types, preventing silent corruption of wire-format calculations.hasattr/getattrchains withisinstancechecks infilter_format_range()andfilter_is_signed(); added@lru_cachetocreate_jinja_env(); addedStrictUndefinedto the Jinja2 environment; replaced magic numbers1/7with_UPER_EXTENSION_MARKER_BITS/_UPER_NSNNWN_SMALL_BITSnamed constants.test_vehicle_event_flags_misaligned_access()and 3 UPER misalignment tests (read_length_determinant,read_nsnnwn,skip_extensions) per testing standards requirement.Context variables:/Filters used:/Output format:sections..j2files: Added explicit Jinja2 template example tolicense_header.instructions.mdand normalized indentation in 6 bitstring templates.cppcheck-suppresscomments in 4 DF test files (replaced with block-levelcppcheck-suppress-begin/end); removed unused<inttypes.h>and<stdbool.h>includes from 5 DF/UPER test files; clarified test header@briefdescriptions across 15 DE test headers.asn1_definition.j2unification: Generalized the ASN.1 definition template to handle SEQUENCE, CHOICE, and BIT STRING viatypedef.type_class.namebranching; removed inline ASN.1 blocks fromassemble_df_choice.j2andassemble_de_bitstring.j2._TEMPLATE_NAME→_SIZE_CONSTANTS_TEMPLATE_NAMEfor consistency with other module-level constants; addedkw_only=Trueto 2 wire-format dataclasses; split long@notebox lines inassemble_de_bitstring.j2.Related Issue
N/A
Additional Notes
N/A
Type of Change
Checklist
make pre-pushand all checks passgit commit -s