grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Jones <pjones@redhat.com>
To: grub-devel@gnu.org
Cc: Daniel Kiper <dkiper@net-space.pl>, Peter Jones <pjones@redhat.com>
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	[thread overview]
Message-ID: <20180221202029.31419-2-pjones@redhat.com> (raw)
In-Reply-To: <20180221202029.31419-1-pjones@redhat.com>

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 <pjones@redhat.com>
---
 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



  reply	other threads:[~2018-02-21 20:22 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-31 16:26 [PATCH 1/2] mkimage: avoid copying relocations for sections that won't be copied Peter Jones
2018-01-31 16:27 ` [PATCH 2/2] .mod files: Strip annobin annotations and .eh_frame, and their relocations Peter Jones
2018-02-15 22:03   ` Vladimir 'phcoder' Serbinenko
2018-02-20 14:51   ` Daniel Kiper
2018-02-20 23:29     ` Peter Jones
2018-02-15 21:52 ` [PATCH 1/2] mkimage: avoid copying relocations for sections that won't be copied Peter Jones
2018-02-15 22:03 ` Vladimir 'phcoder' Serbinenko
2018-02-20 14:48 ` Daniel Kiper
2018-02-20 23:25   ` [PATCH v2 1/3] mkimage: refactor a bunch of section data into a struct Peter Jones
2018-02-20 23:25     ` [PATCH v2 2/3] mkimage: avoid copying relocations for sections that won't be copied Peter Jones
2018-02-21 11:18       ` Daniel Kiper
2018-02-20 23:25     ` [PATCH v2 3/3] .mod files: Strip annobin annotations and .eh_frame, and their relocations Peter Jones
2018-02-21 11:22       ` Daniel Kiper
2018-02-21 11:07     ` [PATCH v2 1/3] mkimage: refactor a bunch of section data into a struct Daniel Kiper
2018-02-21 20:18       ` Peter Jones
2018-02-21 20:20         ` [PATCH v3 1/7] aout.h: Fix missing include Peter Jones
2018-02-21 20:20           ` Peter Jones [this message]
2018-02-23 14:27             ` [PATCH v3 2/7] mkimage: make it easier to run syntax checkers on grub-mkimagexx.c Daniel Kiper
2018-02-21 20:20           ` [PATCH v3 3/7] mkimage: rename a couple of things to be less confusing later Peter Jones
2018-02-23 14:29             ` Daniel Kiper
2018-02-21 20:20           ` [PATCH v3 4/7] mkimage: make locate_sections() set up vaddresses as well Peter Jones
2018-02-23 14:38             ` Daniel Kiper
2018-02-21 20:20           ` [PATCH v3 5/7] mkimage: refactor a bunch of section data into a struct Peter Jones
2018-02-23 14:51             ` Daniel Kiper
2018-02-23 15:27               ` Peter Jones
2018-02-21 20:20           ` [PATCH v3 6/7] mkimage: avoid copying relocations for sections that won't be copied Peter Jones
2018-02-23 14:54             ` Daniel Kiper
2018-02-21 20:20           ` [PATCH v3 7/7] .mod files: Strip annobin annotations and .eh_frame, and their relocations Peter Jones
2018-02-23 14:54             ` Daniel Kiper
2018-02-23 14:56               ` Daniel Kiper
2018-02-23 14:15           ` [PATCH v3 1/7] aout.h: Fix missing include Daniel Kiper
2018-02-20 23:26   ` [PATCH 1/2] mkimage: avoid copying relocations for sections that won't be copied Peter Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180221202029.31419-2-pjones@redhat.com \
    --to=pjones@redhat.com \
    --cc=dkiper@net-space.pl \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).