-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
fix(scripts): initialize reserved fields of lv_image_dsc_t and lv_image_header_t to prevent compiler warnings #7799
base: master
Are you sure you want to change the base?
Conversation
…ge_header_t to prevent compiler warnings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the correction, this source of warning could be a pain on projects that promotes warnings to errors.
We need some feedback on this pull request. Now we mark this as "Abandoned" because there was no activity here for 14 days. Remove the "Abandoned" label or comment else this will be closed in 7 days. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just had a thought. If we replace these reserved
fields someday, they will actually have to be anonymous unions so that old code assigning a value to reserved
will still compile.
typedef struct {
lv_image_header_t header; /**< A header describing the basics of the image*/
uint32_t data_size; /**< Size of the image in bytes*/
const uint8_t * data; /**< Pointer to the data of the image*/
union {const void * reserved; void * some_new_field};
} lv_image_dsc_t;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be automatically initialized to zero. https://en.cppreference.com/w/c/language/struct_initialization
If the compiler you used generates warning, then we can do the simple fix.
So looks good to me.
Previously the LVGLImage.py script did not initialize reserved fields of the lv_image_dsc_t and lv_image_header_t. This led to a flood of compiler warnings about uninitialized variables.
This PR sets these variables to zero and NULL respectively.