From patchwork Thu Aug 13 17:17:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zanoni, Paulo R" X-Patchwork-Id: 7009541 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A8A4C9F373 for ; Thu, 13 Aug 2015 17:18:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA525203AA for ; Thu, 13 Aug 2015 17:18:23 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A78882037C for ; Thu, 13 Aug 2015 17:18:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 346DE6E55A; Thu, 13 Aug 2015 10:18:21 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 9B1086E55A for ; Thu, 13 Aug 2015 10:18:19 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 13 Aug 2015 10:18:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,671,1432623600"; d="scan'208";a="541352830" Received: from jamtsfi1-mobl1.amr.corp.intel.com (HELO panetone.amr.corp.intel.com) ([10.254.187.138]) by FMSMGA003.fm.intel.com with ESMTP; 13 Aug 2015 10:18:18 -0700 From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Thu, 13 Aug 2015 14:17:47 -0300 Message-Id: <1439486267-18516-1-git-send-email-paulo.r.zanoni@intel.com> X-Mailer: git-send-email 2.4.6 Subject: [Intel-gfx] [PATCH igt] lib/igt_core: use print("%s", #expr) instead of print(#expr) X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 If I have a program with the following: igt_skip_on(i % 2 == 0); igt_skip_on_f(i % 2 == 0, "i:%d\n", i); igt_require(i % 2 == 0); igt_require_f(i % 2 == 0, "i:%d\n", i); then I'll get compiler error messages complaining about format conversions related to the '%' character used in the mod operation. So put the whole string as a %s argument to avoid interpreting '%' and any other possible chars. Signed-off-by: Paulo Zanoni Reviewed-by: Dave Gordon --- lib/igt_core.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/igt_core.h b/lib/igt_core.h index 1d77f45..f8bfbf0 100644 --- a/lib/igt_core.h +++ b/lib/igt_core.h @@ -491,7 +491,7 @@ void igt_exit(void) __attribute__((noreturn)); */ #define igt_require(expr) do { \ if (!(expr)) igt_skip_check(#expr , NULL); \ - else igt_debug("Test requirement passed: "#expr"\n"); \ + else igt_debug("Test requirement passed: %s\n", #expr); \ } while (0) /** @@ -506,7 +506,7 @@ void igt_exit(void) __attribute__((noreturn)); */ #define igt_skip_on(expr) do { \ if ((expr)) igt_skip_check("!(" #expr ")" , NULL); \ - else igt_debug("Test requirement passed: !("#expr")\n"); \ + else igt_debug("Test requirement passed: !(%s)\n", #expr); \ } while (0) /** @@ -525,7 +525,7 @@ void igt_exit(void) __attribute__((noreturn)); */ #define igt_require_f(expr, f...) do { \ if (!(expr)) igt_skip_check(#expr , f); \ - else igt_debug("Test requirement passed: "#expr"\n"); \ + else igt_debug("Test requirement passed: %s\n", #expr); \ } while (0) /** @@ -544,7 +544,7 @@ void igt_exit(void) __attribute__((noreturn)); */ #define igt_skip_on_f(expr, f...) do { \ if ((expr)) igt_skip_check("!("#expr")", f); \ - else igt_debug("Test requirement passed: !("#expr")\n"); \ + else igt_debug("Test requirement passed: !(%s)\n", #expr); \ } while (0) /* fork support code */