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

bootutil: replace C specific static assert #1797

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tito97sp
Copy link
Contributor

@tito97sp tito97sp commented Sep 4, 2023

Defect detected

_Static_assert defined in C11.

Error log

Compilation raises the following compilation error in this line:

https://github.com/mcu-tools/mcuboot/blob/main/boot/bootutil/include/bootutil/image.h#L163-L164

mcuboot/boot/bootutil/include/bootutil/image.h:163:15: error: expected constructor, destructor, or type conversion before '(' token
  163 | _Static_assert(sizeof(struct image_header) == IMAGE_HEADER_SIZE,
      |               ^
compilation terminated due to -Wfatal-errors.

Proposed Fix

Following modification fixes the issue.

static_assert((sizeof(struct image_header)) == IMAGE_HEADER_SIZE, 
                "struct image_header not required size\n");

Change Log

Change added in this commit e3cbbec

Comments

Please @d3zd3z can you check this?

Signed-off-by: Andrés Sánchez Pascual <tito97_sp@hotmail.com>
@d3zd3z d3zd3z self-requested a review December 14, 2023 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant