Skip to content
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

json: Improve tolerance to uncovered C members during JSON encoding #53333

Commits on Jul 26, 2023

  1. sys: Introduce SIZEOF_FIELD helper macro in util.h

    This macro is used to get the size of a specific field in a structure type.
    It will return the size of the field in bytes.
    
    Signed-off-by: Lucas Dietrich <[email protected]>
    lucasdietrich committed Jul 26, 2023
    Configuration menu
    Copy the full SHA
    0c3bb8f View commit details
    Browse the repository at this point in the history
  2. json: Introduce struct_size descriptor member

    Enable the computation of a struct member's size during compile-time to
    enhance accuracy, removing the need for speculative size determinations
    during runtime.
    
    Signed-off-by: Lucas Dietrich <[email protected]>
    lucasdietrich committed Jul 26, 2023
    Configuration menu
    Copy the full SHA
    e3963a3 View commit details
    Browse the repository at this point in the history
  3. json: Improve tolerance to uncovered C members during JSON encoding

    Add special handling for nested arrays
    
    This enhancement fix encoding of JSON objects for which descriptors do
    not covers all members of the C structure represented.
    
    Fixes zephyrproject-rtos#50976
    
    Signed-off-by: Lucas Dietrich <[email protected]>
    lucasdietrich committed Jul 26, 2023
    Configuration menu
    Copy the full SHA
    0b5133e View commit details
    Browse the repository at this point in the history
  4. test: Add unused members to test structs in JSON test suite

    This commit updates various structs in the JSON test suite to include
    unused members. These additions aim to test the improved tolerance of
    JSON encoding for C struct members that may not be fully described by
    JSON descriptors.
    
    As a consequence of the addition of unused fields,
    prefer designated initializers instead of postionnal ones.
    
    Add a note about a test which constantly fails with a unused field.
    
    Signed-off-by: Lucas Dietrich <[email protected]>
    lucasdietrich committed Jul 26, 2023
    Configuration menu
    Copy the full SHA
    5b088a1 View commit details
    Browse the repository at this point in the history