Received: from list by lists.gnu.org with archive (Exim 4.71) id 1eoaud-0006GM-OP for mharc-grub-devel@gnu.org; Wed, 21 Feb 2018 15:22:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53499) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoatY-0005ys-Eu for grub-devel@gnu.org; Wed, 21 Feb 2018 15:22:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eoasW-0003N6-AH for grub-devel@gnu.org; Wed, 21 Feb 2018 15:21:40 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49412 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eoasV-0003M6-Ct for grub-devel@gnu.org; Wed, 21 Feb 2018 15:20:35 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F2F1DEB6ED; Wed, 21 Feb 2018 20:20:34 +0000 (UTC) Received: from trillian.uncooperative.org.com (dhcp-10-20-1-221.bss.redhat.com [10.20.1.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id C8FFD10A970C; Wed, 21 Feb 2018 20:20:34 +0000 (UTC) From: Peter Jones To: grub-devel@gnu.org Cc: Daniel Kiper , Peter Jones Subject: [PATCH v3 2/7] mkimage: make it easier to run syntax checkers on grub-mkimagexx.c Date: Wed, 21 Feb 2018 15:20:24 -0500 Message-Id: <20180221202029.31419-2-pjones@redhat.com> In-Reply-To: <20180221202029.31419-1-pjones@redhat.com> References: <20180221201833.prjf4yvfldjltptp@redhat.com> <20180221202029.31419-1-pjones@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 21 Feb 2018 20:20:35 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 21 Feb 2018 20:20:35 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'pjones@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 20:22:46 -0000 This makes it so you can treat grub-mkimagexx.c as a file you can build directly, so syntax checkers like vim's "syntastic" plugin, which uses "gcc -x c -fsyntax-only" to build it, will work. One still has to do whatever setup is required to make it pick the right include dirs, which -W options we use, etc., but this makes it so you can do the checking on the file you're editing, rather than on a different file. Signed-off-by: Peter Jones --- util/grub-mkimage32.c | 2 ++ util/grub-mkimage64.c | 2 ++ util/grub-mkimagexx.c | 9 +++++++++ 3 files changed, 13 insertions(+) diff --git a/util/grub-mkimage32.c b/util/grub-mkimage32.c index 9b31397bc40..1f2ccccd225 100644 --- a/util/grub-mkimage32.c +++ b/util/grub-mkimage32.c @@ -19,4 +19,6 @@ # define ELF_ST_TYPE(val) ELF32_ST_TYPE(val) #define XEN_NOTE_SIZE 132 +#ifndef GRUB_MKIMAGEXX #include "grub-mkimagexx.c" +#endif diff --git a/util/grub-mkimage64.c b/util/grub-mkimage64.c index d8334592470..4ff72a625e0 100644 --- a/util/grub-mkimage64.c +++ b/util/grub-mkimage64.c @@ -19,4 +19,6 @@ # define ELF_ST_TYPE(val) ELF64_ST_TYPE(val) #define XEN_NOTE_SIZE 120 +#ifndef GRUB_MKIMAGEXX #include "grub-mkimagexx.c" +#endif diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c index a2bb05439f0..10d7b41e3bf 100644 --- a/util/grub-mkimagexx.c +++ b/util/grub-mkimagexx.c @@ -50,6 +50,15 @@ #pragma GCC diagnostic ignored "-Wcast-align" +#define GRUB_MKIMAGEXX +#if !defined(MKIMAGE_ELF32) && !defined(MKIMAGE_ELF64) +#if __SIZEOF_POINTER__ == 8 +#include "grub-mkimage64.c" +#else +#include "grub-mkimage32.c" +#endif +#endif + /* These structures are defined according to the CHRP binding to IEEE1275, "Client Program Format" section. */ -- 2.15.0