
Hi Marcel,
On 19 August 2015 at 10:00, Marcel Ziswiler marcel@ziswiler.com wrote:
On 18 August 2015 14:44:01 CEST, Simon Glass sjg@chromium.org wrote:
No I think you misunderstand. Another way of explaining this is sorting fruit and animals:
apple grapefruit orange elephant lion zebra
We don't want to mix up the fruit and animals, so each has its own position in the table.We can then easily see what animals are in the table.
I see but I still don't think your example matches our problem at hand quite that accurately.
This is not a case of running 'sort' on the includes. The 'asm' files are arch-specific includes and should go after all the 'generic' includes, like <bbb.c>, etc.
So to repeat, the ordering should be:
<common.h> <- most general <others.h> <asm/...> <arch/arm/...> <linux/...> "local.h" <- least general
Your proposal sounds quite honourable but the problem I see with it is that your order is based on some generality rule I don't quite see where it could be looked up.
At the end I believe the order actually does not even matter apart from U-Boot's special common.h having to go first. And even that could be worked around by the build system itself (see e.g. Linux kernel for that matter).
So for me such ordering is just cosmetic and might at best help us humble programmers when comparing stuff or looking through to make sure a certain include is indeed already there or the like.
The only practical way I see to achieve this would be to plain simply alphabetically sort them.
As I don't think this is much worth discussing any further I'm fine with dropping this patch even though I actually think the actual file in question is seriously buggy as it does not put common.h first.
As you say the compiler doesn't care about the order apart from common.h. But the code is written as much for us software engineers as the compiler. Linux puts the asm includes at the end and we more-or-less follow this in U-Boot.
I don't want to be annoying and this is Tegra code so I will leave it to you and Tom to sort out.
Regards, Simon