From patchwork Tue Apr 26 14:52:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 8939591 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D696DBF29F for ; Tue, 26 Apr 2016 14:55:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01D1E20125 for ; Tue, 26 Apr 2016 14:55:11 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D6ECB20120 for ; Tue, 26 Apr 2016 14:55:08 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1av4MO-0007Yy-QS; Tue, 26 Apr 2016 14:53:08 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1av4MM-0007Xj-M0 for xen-devel@lists.xenproject.org; Tue, 26 Apr 2016 14:53:06 +0000 Received: from [85.158.137.68] by server-3.bemta-3.messagelabs.com id 40/F8-03294-1D08F175; Tue, 26 Apr 2016 14:53:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOIsWRWlGSWpSXmKPExsXitHSDve7FBvl wg13TpS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oy/m2cyFXyQrfi87SxbA+MV8S5GTg4JAX+J Df/PMYHYbAI6Ehfn7mTrYuTgEBFQkbi91wAkzCxQLPF1VR8riC0skCAxo+0GC4jNIqAqce7BD HYQm1fAVaK9vY8RYqSuxMndm8DinEDxzQtegY0XEnCRWLLpMVS9oMTJmU9YIOZrSrRu/80OYc tLNG+dzQxRryjRP+8B2DkSAtwSf7vtJzDyz0LSPQtJ9ywk3QsYmVcxahSnFpWlFukamuglFWW mZ5TkJmbm6BoaGOvlphYXJ6an5iQmFesl5+duYgQGIAMQ7GBcsd3zEKMkB5OSKO+9PPlwIb6k /JTKjMTijPii0pzU4kOMMhwcShK8JvVAOcGi1PTUirTMHGAswKQlOHiURHibQNK8xQWJucWZ6 RCpU4yKUuK8U0ASAiCJjNI8uDZY/F1ilJUS5mUEOkSIpyC1KDezBFX+FaM4B6OSMG8IyBSezL wSuOmvgBYzAS2+fEgWZHFJIkJKqoEx1+WnUTPP9jSLUO63i0QCSlS4Xvz6FZ0wQeif4MVPG19 7q3yR3P7szPttLWeu58jGTU9Yxd8tun7y97pDl1RqJj4zdur7+E8yZt/BpLSN0p9DrSPfcB/J rrw/RXLZbq6A6je9T19ZZlmdEi7QFufZLuh1n+uMzkxriaqkH/N3KR+Zxi6YbdmvxFKckWiox VxUnAgA3rW8+boCAAA= X-Env-Sender: prvs=917dd492e=roger.pau@citrix.com X-Msg-Ref: server-5.tower-31.messagelabs.com!1461682370!33860613!6 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 64337 invoked from network); 26 Apr 2016 14:53:04 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-5.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 26 Apr 2016 14:53:04 -0000 X-IronPort-AV: E=Sophos;i="5.24,536,1454976000"; d="scan'208";a="356517711" From: Roger Pau Monne To: Date: Tue, 26 Apr 2016 16:52:19 +0200 Message-ID: <1461682343-20597-11-git-send-email-roger.pau@citrix.com> X-Mailer: git-send-email 2.6.4 (Apple Git-63) In-Reply-To: <1461682343-20597-1-git-send-email-roger.pau@citrix.com> References: <1461682343-20597-1-git-send-email-roger.pau@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Wei Liu , Ian Jackson , Roger Pau Monne Subject: [Xen-devel] [PATCH v2 for-4.7 10/14] libxl: add the printf-like attributes to a couple of functions X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Or else clang complains with: error: format string is not a string literal This looks quite pedantic, but I don't know of any other way to get rid of those errors. Signed-off-by: Roger Pau Monné --- Cc: Ian Jackson Cc: Wei Liu --- tools/libxl/libxl_internal.c | 16 ---------------- tools/libxl/libxl_internal.h | 11 ++++++----- tools/libxl/libxl_save_helper.c | 1 + 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c index e7b765b..3b30f8a 100644 --- a/tools/libxl/libxl_internal.c +++ b/tools/libxl/libxl_internal.c @@ -554,22 +554,6 @@ void libxl__update_domain_configuration(libxl__gc *gc, dst->b_info.video_memkb = src->b_info.video_memkb; } -char *libxl__device_model_xs_path(libxl__gc *gc, uint32_t dm_domid, - uint32_t domid, const char *format, ...) -{ - char *s, *fmt; - va_list ap; - - fmt = GCSPRINTF("/local/domain/%u/device-model/%u%s", dm_domid, - domid, format); - - va_start(ap, format); - s = libxl__vsprintf(gc, fmt, ap); - va_end(ap); - - return s; -} - /* * Local variables: * mode: C diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 8e2cf3e..0879e4c 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -636,7 +636,7 @@ _hidden void *libxl__realloc(libxl__gc *gc_opt, void *ptr, size_t new_size) NN1; /* print @fmt into an allocated string large enoughto contain the result. * (similar to gc'd asprintf(3)). */ _hidden char *libxl__sprintf(libxl__gc *gc_opt, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3) NN1; -_hidden char *libxl__vsprintf(libxl__gc *gc, const char *format, va_list ap); +_hidden char *libxl__vsprintf(libxl__gc *gc, const char *format, va_list ap) PRINTF_ATTRIBUTE(2, 0); /* duplicate the string @c (similar to a gc'd strdup(3)). */ _hidden char *libxl__strdup(libxl__gc *gc_opt, const char *c /* may be NULL */) NN1; @@ -709,7 +709,7 @@ _hidden char *libxl__xs_libxl_path(libxl__gc *gc, uint32_t domid); */ int libxl__xs_vprintf(libxl__gc *gc, xs_transaction_t t, - const char *path, const char *fmt, va_list ap); + const char *path, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(4, 0); int libxl__xs_printf(libxl__gc *gc, xs_transaction_t t, const char *path, const char *fmt, ...) PRINTF_ATTRIBUTE(4, 5); @@ -1995,9 +1995,10 @@ _hidden libxl__json_object *libxl__json_parse(libxl__gc *gc_opt, const char *s); _hidden int libxl__device_model_version_running(libxl__gc *gc, uint32_t domid); /* Return the system-wide default device model */ _hidden libxl_device_model_version libxl__default_device_model(libxl__gc *gc); -_hidden char *libxl__device_model_xs_path(libxl__gc *gc, uint32_t dm_domid, - uint32_t domid, - const char *format, ...) PRINTF_ATTRIBUTE(4, 5); + +#define libxl__device_model_xs_path(gc, dm_domid, domid, fmt, _a...) \ + libxl__sprintf(gc, "/local/domain/%u/device-model/%u" fmt, dm_domid, \ + domid, ##_a) /* * Calling context and GC for event-generating functions: diff --git a/tools/libxl/libxl_save_helper.c b/tools/libxl/libxl_save_helper.c index 5fe642a..d3def6b 100644 --- a/tools/libxl/libxl_save_helper.c +++ b/tools/libxl/libxl_save_helper.c @@ -52,6 +52,7 @@ /*----- logger -----*/ +__attribute__((format(printf, 5, 0))) static void tellparent_vmessage(xentoollog_logger *logger_in, xentoollog_level level, int errnoval,