[LEDE-DEV] [PATCH 1/2] libubox: Add pure attribute to several functions.

Felix Fietkau nbd at nbd.name
Fri Nov 4 05:14:34 PDT 2016


On 2016-11-02 04:03, Rosen Penev wrote:
> Manually adding pure allows the compiler to optimize several
> functions for better performance. All were found with gcc's
> -Wsuggest-attribute=pure. The switch is conservative meaning there are
> more such functions.
> 
> Signed-off by: Rosen Penev <rosenp at gmail.com>
Please linewrap your commit description.
You should also leave out __pure in .c files, it won't do anything
useful there, since it's relevant to callers only.
Also, you can leave out out of comparator functions for avl and kvlist.
Since they're stored as a function pointer in the tree struct and called
from there, there's no way that this can ever help the compiler make a
better decision.

- Felix



More information about the Lede-dev mailing list