[lxc-devel] [PATCH] clang: Fix build warnings for 3.4
Serge Hallyn
serge.hallyn at ubuntu.com
Wed Apr 30 17:00:02 UTC 2014
Quoting Stéphane Graber (stgraber at ubuntu.com):
> Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
> ---
> src/lxc/log.h | 11 +++++++++--
> src/lxc/lxc_autostart.c | 2 +-
> src/lxc/lxc_start.c | 2 +-
> src/lxc/lxccontainer.c | 2 +-
> 4 files changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/src/lxc/log.h b/src/lxc/log.h
> index 5252869..d9f3ebc 100644
> --- a/src/lxc/log.h
> +++ b/src/lxc/log.h
> @@ -44,6 +44,13 @@
> #define LXC_LOG_PREFIX_SIZE 32
> #define LXC_LOG_BUFFER_SIZE 512
>
> +/* This attribute is required to silence clang warnings */
> +#if defined(__GNUC__)
> +#define ATTR_UNUSED __attribute__ ((unused))
> +#else
> +#define ATTR_UNUSED
> +#endif
> +
> /* predefined priorities. */
> enum lxc_loglevel {
> LXC_LOG_PRIORITY_TRACE,
> @@ -180,10 +187,10 @@ __lxc_log(const struct lxc_log_category* category,
> */
> #define lxc_log_priority_define(acategory, PRIORITY) \
> \
> -static inline void LXC_##PRIORITY(struct lxc_log_locinfo *, \
> +ATTR_UNUSED static inline void LXC_##PRIORITY(struct lxc_log_locinfo *, \
> const char *, ...) __attribute__ ((format (printf, 2, 3))); \
> \
> -static inline void LXC_##PRIORITY(struct lxc_log_locinfo* locinfo, \
> +ATTR_UNUSED static inline void LXC_##PRIORITY(struct lxc_log_locinfo* locinfo, \
> const char* format, ...) \
> { \
> if (lxc_log_priority_is_enabled(acategory, \
> diff --git a/src/lxc/lxc_autostart.c b/src/lxc/lxc_autostart.c
> index ec9d9ba..1e0c608 100644
> --- a/src/lxc/lxc_autostart.c
> +++ b/src/lxc/lxc_autostart.c
> @@ -220,7 +220,7 @@ int main(int argc, char *argv[])
> struct lxc_list *it, *next;
> char *const default_start_args[] = {
> "/sbin/init",
> - '\0',
> + NULL,
> };
>
> if (lxc_arguments_parse(&my_args, argc, argv))
> diff --git a/src/lxc/lxc_start.c b/src/lxc/lxc_start.c
> index 157bea9..9b47e8c 100644
> --- a/src/lxc/lxc_start.c
> +++ b/src/lxc/lxc_start.c
> @@ -207,7 +207,7 @@ int main(int argc, char *argv[])
> char *rcfile = NULL;
> char *const default_args[] = {
> "/sbin/init",
> - '\0',
> + NULL,
> };
> struct lxc_container *c;
>
> diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
> index c90b564..270b8fc 100644
> --- a/src/lxc/lxccontainer.c
> +++ b/src/lxc/lxccontainer.c
> @@ -555,7 +555,7 @@ static bool lxcapi_start(struct lxc_container *c, int useinit, char * const argv
> FILE *pid_fp = NULL;
> char *default_args[] = {
> "/sbin/init",
> - '\0',
> + NULL,
> };
>
> /* container exists */
> --
> 1.9.1
>
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel
More information about the lxc-devel
mailing list