[vlc-devel] [PATCH] sunstudio fix for unsupported sizeof({})
Rémi Denis-Courmont
remi at remlab.net
Mon Jun 14 19:07:00 CEST 2010
On Mon, 14 Jun 2010 18:36:56 +0200, Francois Cartegnie <fcvlcdev at free.fr>
wrote:
> diff --git a/include/vlc_plugin.h b/include/vlc_plugin.h
> index c1a150e..2f7f45c 100644
> --- a/include/vlc_plugin.h
> +++ b/include/vlc_plugin.h
> @@ -196,9 +196,12 @@ enum vlc_module_properties
> goto error;
>
> #define add_shortcut( ... ) \
> - if (vlc_module_set (p_submodule, VLC_MODULE_SHORTCUT, \
> - sizeof((const char*[]){__VA_ARGS__})/sizeof(const char*),
> __VA_ARGS__)) \
> - goto error;
> + do {\
> + const char* foo [] = {__VA_ARGS__};\
> + if ( vlc_module_set (p_submodule, VLC_MODULE_SHORTCUT, \
> + sizeof(foo)/sizeof(const char*), __VA_ARGS__)) \
> + goto error;\
> + } while(0);
In my opinion, this is wrong and so is the original code. __VA_ARGS__
should be expanded only once.
And then, this particular patch seems to lack one 'const'.
--
Rémi Denis-Courmont
http://www.remlab.net
http://fi.linkedin.com/in/remidenis
More information about the vlc-devel
mailing list