[Mesa-dev] [PATCH 1/3] xmlconfig: use the portable __VA_ARGS__

Eric Engestrom eric.engestrom at imgtec.com
Tue Aug 22 11:07:14 UTC 2017


On Tuesday, 2017-08-22 11:39:35 +0100, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
> 
> Follow the example used through mesa and use "..." + "__VA_ARGS__".
> The former tends to be more common and portable.
> 
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
>  src/util/xmlconfig.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/util/xmlconfig.c b/src/util/xmlconfig.c
> index d3f47ecda0c..7d1c524a955 100644
> --- a/src/util/xmlconfig.c
> +++ b/src/util/xmlconfig.c
> @@ -466,11 +466,11 @@ __driUtilMessage(const char *f, ...)
>                        (int) XML_GetCurrentLineNumber(data->parser), \
>                        (int) XML_GetCurrentColumnNumber(data->parser)); \
>  } while (0)
> -#define XML_WARNING(msg,args...) do { \
> +#define XML_WARNING(msg, ...) do { \
>      __driUtilMessage ("Warning in %s line %d, column %d: "msg, data->name, \
>                        (int) XML_GetCurrentLineNumber(data->parser), \
>                        (int) XML_GetCurrentColumnNumber(data->parser), \
> -                      args); \
> +                      _VA_ARGS__); \

Missing underscore here, and these should be `##__VA_ARGS__` if we want
to allow trivial `msg` with no argument (which I assume we do?)

With that, series is
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>

>  } while (0)
>  /** \brief Output an error message. */
>  #define XML_ERROR1(msg) do { \
> @@ -478,11 +478,11 @@ __driUtilMessage(const char *f, ...)
>                        (int) XML_GetCurrentLineNumber(data->parser), \
>                        (int) XML_GetCurrentColumnNumber(data->parser)); \
>  } while (0)
> -#define XML_ERROR(msg,args...) do { \
> +#define XML_ERROR(msg, ...) do { \
>      __driUtilMessage ("Error in %s line %d, column %d: "msg, data->name, \
>                        (int) XML_GetCurrentLineNumber(data->parser), \
>                        (int) XML_GetCurrentColumnNumber(data->parser), \
> -                      args); \
> +                      __VA_ARGS__); \
>  } while (0)
>  /** \brief Output a fatal error message and abort. */
>  #define XML_FATAL1(msg) do { \
> @@ -492,12 +492,12 @@ __driUtilMessage(const char *f, ...)
>               (int) XML_GetCurrentColumnNumber(data->parser)); \
>      abort();\
>  } while (0)
> -#define XML_FATAL(msg,args...) do { \
> +#define XML_FATAL(msg, ...) do { \
>      fprintf (stderr, "Fatal error in %s line %d, column %d: "msg"\n", \
>               data->name, \
>               (int) XML_GetCurrentLineNumber(data->parser), \
>               (int) XML_GetCurrentColumnNumber(data->parser), \
> -             args); \
> +             __VA_ARGS__); \
>      abort();\
>  } while (0)
>  
> -- 
> 2.14.0
> 


More information about the mesa-dev mailing list