[PATCH] Fix gcc-4.5.2 "statement with no effect" warnings in UBIFS

Russ Dill russ.dill at gmail.com
Mon Apr 11 20:27:22 EDT 2011


On Mon, Apr 11, 2011 at 5:12 PM, Russ Dill <russ.dill at gmail.com> wrote:
> On Mon, Apr 11, 2011 at 2:50 PM,  <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; })
>>
>> Signed-off-by: Maksim Rayskiy <maksim.rayskiy at gmail.com>
>> ---
>>  fs/ubifs/debug.h |   50 +++++++++++++++++++++++++-------------------------
>>  1 files changed, 25 insertions(+), 25 deletions(-)
>>
>> diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h
>> index 919f0de..e30a629 100644
>> --- a/fs/ubifs/debug.h
>> +++ b/fs/ubifs/debug.h
>> @@ -425,34 +425,34 @@ void dbg_debugfs_exit_fs(struct ubifs_info *c);
>>  #define dbg_dump_index(c)                      ({})
>>  #define dbg_dump_lpt_lebs(c)                   ({})
>>
>> -#define dbg_walk_index(c, leaf_cb, znode_cb, priv) 0
>> -#define dbg_old_index_check_init(c, zroot)         0
>> +#define dbg_walk_index(c, leaf_cb, znode_cb, priv) ({0; })
>> +#define dbg_old_index_check_init(c, zroot)         ({0; })
>>  #define dbg_save_space_info(c)                     ({})
>> -#define dbg_check_space_info(c)                    0
>> -#define dbg_check_old_index(c, zroot)              0
>> -#define dbg_check_cats(c)                          0
>> -#define dbg_check_ltab(c)                          0
>> -#define dbg_chk_lpt_free_spc(c)                    0
>> -#define dbg_chk_lpt_sz(c, action, len)             0
>> -#define dbg_check_synced_i_size(inode)             0
>> -#define dbg_check_dir_size(c, dir)                 0
>> -#define dbg_check_tnc(c, x)                        0
>> -#define dbg_check_idx_size(c, idx_size)            0
>> -#define dbg_check_filesystem(c)                    0
>> +#define dbg_check_space_info(c)                    ({0; })
>> +#define dbg_check_old_index(c, zroot)              ({0; })
>> +#define dbg_check_cats(c)                          ({0; })
>> +#define dbg_check_ltab(c)                          ({0; })
>> +#define dbg_chk_lpt_free_spc(c)                    ({0; })
>> +#define dbg_chk_lpt_sz(c, action, len)             ({0; })
>> +#define dbg_check_synced_i_size(inode)             ({0; })
>> +#define dbg_check_dir_size(c, dir)                 ({0; })
>> +#define dbg_check_tnc(c, x)                        ({0; })
>> +#define dbg_check_idx_size(c, idx_size)            ({0; })
>> +#define dbg_check_filesystem(c)                    ({0; })
>>  #define dbg_check_heap(c, heap, cat, add_pos)      ({})
>> -#define dbg_check_lprops(c)                        0
>> -#define dbg_check_lpt_nodes(c, cnode, row, col)    0
>> -#define dbg_check_inode_size(c, inode, size)       0
>> -#define dbg_check_data_nodes_order(c, head)        0
>> -#define dbg_check_nondata_nodes_order(c, head)     0
>> -#define dbg_force_in_the_gaps_enabled              0
>> -#define dbg_force_in_the_gaps()                    0
>> -#define dbg_failure_mode                           0
>> -
>> -#define dbg_debugfs_init()                         0
>> +#define dbg_check_lprops(c)                        ({0; })
>> +#define dbg_check_lpt_nodes(c, cnode, row, col)    ({0; })
>> +#define dbg_check_inode_size(c, inode, size)       ({0; })
>> +#define dbg_check_data_nodes_order(c, head)        ({0; })
>> +#define dbg_check_nondata_nodes_order(c, head)     ({0; })
>> +#define dbg_force_in_the_gaps_enabled              ({0; })
>> +#define dbg_force_in_the_gaps()                    ({0; })
>> +#define dbg_failure_mode                           ({0; })
>> +
>> +#define dbg_debugfs_init()                         ({0; })
>>  #define dbg_debugfs_exit()
>> -#define dbg_debugfs_init_fs(c)                     0
>> -#define dbg_debugfs_exit_fs(c)                     0
>> +#define dbg_debugfs_init_fs(c)                     ({0; })
>> +#define dbg_debugfs_exit_fs(c)                     ({0; })
>>
>>  #endif /* !CONFIG_UBIFS_FS_DEBUG */
>>  #endif /* !__UBIFS_DEBUG_H__ */
>> --
>> 1.7.1
>>
>
> Should these all just be:
>
>  do {} while(0)

never-mind, I see while the ({0;}) format is preferable.

> Stuff like:
>
> #define dbg_debugfs_exit()
>
> looks particularly dangerous.

but this still stands



More information about the linux-mtd mailing list