[coreboot] [PATCH] v3: make inline asm declarations consistent

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Sat Sep 6 23:22:40 CEST 2008

On 06.09.2008 22:34, Stefan Reinauer wrote:
> Carl-Daniel Hailfinger wrote:
>> v3 uses all combinations of __asm__, asm, __volatile__, volatile and
>> single variations to declare inline asm statements. "asm" is a GNU C
>> extension, while volatile is ANSI C. That means:
>> - __volatile__ can be replaced by volatile unless you use a pure K&R
>> compiler.
>> - asm is not a reserved keyword and should be replaced by __asm__.
>> As a bonus, grepping for __asm__ returns less hits than asm because asm
>> is also used as a normal word in comments.
> What are the implications of this? I think we should either go __asm__
> __volatile__ or asm volatile for the sake of looking at the code without
> eye cancer, but not mix it.
> We're absolutely gcc specific, so discussing about asm not being
> reserved sounds a bit vain. Also, is __asm__ reserved? Reserved by whom?
> I know more compilers that know about asm than __asm__ if we're really
> trying to become non-GNU-centric.
> What's the goal of your patch?

Two goals:
1. __volatile__ is pointless since 1983 (ANSI-C). No idea why anyone
uses it.
2. Neither __asm__ nor asm are reserved. Grepping for asm turns up lots
of stuff that is not inline asm, so using __asm__ eases grepping.

If you prefer asm volatile, tell me. I'll prepare an updated patch.



More information about the coreboot mailing list