Question

When I'm compiling manufacturer's source code for my smartphone kernel, there's a lot of various unused variables/functions warnings. Is there any option to set to GCC/LD to don't compile these unused stuff?

I found solution here How to remove unused C/C++ symbols with GCC and ld? but it conflicts with incremental linking so I can't use it. Any other solution?

Was it helpful?

Solution

GCC's unused variable warning is just that--it's telling you that code declared a variable but didn't use it. It won't actually compile any code for such a variable, because there is no code to compile, just the declaration. It's a warning because it's often a symptom of sloppy programming.

Removing linker symbols is a completely unrelated issue, and generally not something you want to to. Why do you think you want to do this?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top