[llvmlinux] VLAIS cleanup
renato.golin at linaro.org
Mon Mar 24 15:45:39 UTC 2014
I'm having a look on how to clean up the VLAIS issue in the list of
As far as I could tell, they're *all* related to the same pattern:
struct shash_desc desc;
ctx = ...;
whatever = another_function(&sdesc.desc, ...);
// sometimes, less often
I'm not a kernel expert, but I couldn't find any of those functions
receiving the address of the first member modifying anything past the
sizeof(desc), which is the only way it could be using the ctx member
without clearly stated in the code.
Assuming none of the functions receiving a member's address will write
past it (and use the next member's memory), there are three
1. The VLAIS use is dead code.
ctx is never used (nor passed forward) in that function, and being a
local type, it can be removed, and probably is, by the compiler.
In those cases, the patch should be to just remove the VLAIS usage,
coalesce the outer struct into the inner struct, struct shash_desc
The files that fall into those cases are:
2. The VLA can easily be separated from the structure.
Same example as above, but separated use of the context. In that case,
just split the structure and use the desc and the context by
Files in this category are:
3. The VLA is an integral part of the structure.
In this case, we'll need some patch to re-encode the structure in a
dynamic way. Marc's idea to use headers isn't too far off from the
ugliness already present in the files, especially on a file that has
already a comment "Today's hack".
Files in this category:
Am I missing something?
More information about the LLVMLinux