[PATCH] Fix gcc-4.5.2 "statement with no effect" warnings in UBIFS
Maksim Rayskiy
maksim.rayskiy at gmail.com
Mon Apr 11 18:36:55 EDT 2011
On Mon, Apr 11, 2011 at 3:08 PM, Mike Frysinger <vapier.adi at gmail.com> wrote:
> On Mon, Apr 11, 2011 at 17:50, <maksim.rayskiy at gmail.com> wrote:
>> From: Maksim Rayskiy <maksim.rayskiy at gmail.com>
>>
>> When compiling UBIFS with CONFIG_UBIFS_FS_DEBUG not set,
>> gcc-4.5.2 generates a slew of "warning: statement with no effect"
>> on references to non-void functions defined as 0.
>> To avoid these warnings, change appropriate definitions from
>> #define dbg_xxx(a) 0
>> to
>> #define dbg_xxx(a) ({0; })
>
> we probably want to make these inline funcs. otherwise we get
> misbehavior if someone does something like:
> dbg_dump_index(c++);
> -mike
>
I agree that would be a problem, but if such calls existed, we would
be dealing not with compiler warnings but with completely broken code.
I think it is bad style to have side-effects in debug functions.
Thanks,
Maksim.
More information about the linux-mtd
mailing list