Re: [PATCH] CodingStyle: Add a chapter on conditional compilation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/29/14 12:12, Geert Uytterhoeven wrote:
> On Wed, Oct 29, 2014 at 7:15 PM, Josh Triplett <josh@xxxxxxxxxxxxxxxx> wrote:
>> Document several common practices and conventions regarding conditional
>> compilation, most notably the preference for ifdefs in headers rather
>> than .c files.
>>
>> Signed-off-by: Josh Triplett <josh@xxxxxxxxxxxxxxxx>
> 
>> +If you have a function or variable which may potentially go unused in a
>> +particular configuration, and the compiler would warn about its definition
>> +going unused, mark the definition as __maybe_unused rather than wrapping it in
>> +a preprocessor conditional.  (However, if a function or variable *always* goes
>> +unused, delete it.)
> 
> Personally, I don't like __maybe_unused. Once it's there, the compiler
> will stop warning about it, even if it really becomes unused.
> 
> Apart from that:
> Acked-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>

Is the compiler smart enough to delete (discard) the code or data instance
if it is unused or is the code or data actually wasting space?


-- 
~Randy
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux