From patchwork Sat Mar 3 18:07:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Antonio Ospite X-Patchwork-Id: 881077 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=flashrom.org (client-ip=80.81.252.135; helo=mail.coreboot.org; envelope-from=flashrom-bounces@flashrom.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ao2.it Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ztvLb0FxLz9sXg for ; Sun, 4 Mar 2018 05:08:53 +1100 (AEDT) Received: from [127.0.0.1] (helo=ra.coreboot.org) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1esBb4-0001W4-Na; Sat, 03 Mar 2018 19:09:26 +0100 Received: from ao2.it ([92.243.12.208]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.86_2) (envelope-from ) id 1esBau-0001Uf-Cg for flashrom@flashrom.org; Sat, 03 Mar 2018 19:09:25 +0100 Received: from ao2 by ao2.it with local (Exim 4.84_2) (envelope-from ) id 1esBZ4-0007a5-Bg; Sat, 03 Mar 2018 19:07:22 +0100 From: Antonio Ospite To: flashrom@flashrom.org Date: Sat, 3 Mar 2018 19:07:15 +0100 Message-Id: <1520100435-29105-1-git-send-email-ao2@ao2.it> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 X-Face: z*RaLf`X<@C75u6Ig9}{oW$H; 1_\2t5)({*|jhM/Vb; ]yA5\I~93>J<_`<4)A{':UrE X-Spam-Score: -3.0 (---) Subject: [flashrom] [PATCH] Fix compilation with older MinGW versions X-BeenThere: flashrom@flashrom.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: flashrom discussion and development mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Miklos Marton Errors-To: flashrom-bounces@flashrom.org Sender: "flashrom" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff The __MINGW_PRINTF_FORMAT constant has been defined back in 2012 https://sourceforge.net/p/mingw-w64/mingw-w64/ci/77bc5d6103b5fb9f59fbddab1583e69549913312/ However older toolchains are still around and some user reported the following compilation failure: flash.h:336:1: error: '__MINGW_PRINTF_FORMAT' is an unrecognized format function  type [-Werror=format=]  __attribute__((format(__MINGW_PRINTF_FORMAT, 2, 3))); Fix this by defining the constant when it isn't already; the change does not affect other compilers because it's guarded by "#ifdef __MINGW32__". Setting __MINGW_PRINTF_FORMAT to gnu_printf is exactly what newer MinGW versions do when __USE_MINGW_ANSI_STDIO is defined, which it is in flashrom Makefile. Tested-by: Miklos Marton Signed-off-by: Antonio Ospite --- flash.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flash.h b/flash.h index a80a9c2..40a7f1a 100644 --- a/flash.h +++ b/flash.h @@ -360,6 +360,9 @@ int flashrom_print_cb(enum flashrom_log_level level, const char *fmt, va_list ap /* Let gcc and clang check for correct printf-style format strings. */ int print(enum flashrom_log_level level, const char *fmt, ...) #ifdef __MINGW32__ +# ifndef __MINGW_PRINTF_FORMAT +# define __MINGW_PRINTF_FORMAT gnu_printf +# endif __attribute__((format(__MINGW_PRINTF_FORMAT, 2, 3))); #else __attribute__((format(printf, 2, 3)));