-
-
Notifications
You must be signed in to change notification settings - Fork 307
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
style: Replace use of Variable Length Arrays in C code #3323
Conversation
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.
Oh, they were mandatory in C99, but are optional in C11. Well, we can do without them.
This is really not any real-life problem: some of them were introduced already in the early 2010s. But we have no actual benefit for using them either. For comparison, the use of VLAs were deliberately and actively removed from the Linux kernel, for security and efficiency reasons. |
And, I might add, VLAs will still be optional for also for C23. It was never really a popular addition to the standard. |
For me, it's the first time we see the auto-labeller working ;) I was wondering about what should the imagery code be considered. Is it at the same level as raster and vector? Here, the labeller added
libraries
, and
module
for the files in top level imagery and inside lib/imagery. |
Yes, along with eg.
There is imagery code both in libraries as well as in modules, so this is working as intended. A proper label description might be added though and some m&m colour applied. |
So it's missing labels for these. ;)
Yep, the libraries and module match correctly. |
Thanks @wenzeslaus ! |
* CI: add -Wvla * Replace use of Variable Length Arrays * use sizeof(int)
Current C language support for GRASS is C11 with core features, which does not include Variable Length Arrays (VLA). There are, however, a few places in the code that make use of VLAs. This leads us to either update the support directives; insert conditional code (using
__STDC_NO_VLA__
) ; or replace the use of such code.Given the limited range of changes to the code, I will with this PR suggest to remove the use of VLA and make the code adhere to the RFC 7.
In addition to the code fixes, the
-Wvla
CFLAG is added to the Mac and Ubuntu CI builds to prevent VLA code to slip in again.