3e07ee
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
3e07ee
From: Peter Jones <pjones@redhat.com>
3e07ee
Date: Wed, 1 Aug 2018 10:24:52 -0400
3e07ee
Subject: [PATCH] module-verifier: make it possible to run checkers on
3e07ee
 grub-module-verifierxx.c
3e07ee
3e07ee
This makes it so you can treat grub-module-verifierxx.c as a file you can
3e07ee
build directly, so syntax checkers like vim's "syntastic" plugin, which uses
3e07ee
"gcc -x c -fsyntax-only" to build it, will work.
3e07ee
3e07ee
One still has to do whatever setup is required to make it pick the right
3e07ee
include dirs, which -W options we use, etc., but this makes it so you can do
3e07ee
the checking on the file you're editing, rather than on a different file.
3e07ee
3e07ee
v2: fix the typo in the #else clause in util/grub-module-verifierXX.c
3e07ee
3e07ee
Signed-off-by: Peter Jones <pjones@redhat.com>
3e07ee
---
3e07ee
 util/grub-module-verifier32.c | 2 ++
3e07ee
 util/grub-module-verifier64.c | 2 ++
3e07ee
 util/grub-module-verifierXX.c | 9 +++++++++
3e07ee
 3 files changed, 13 insertions(+)
3e07ee
3e07ee
diff --git a/util/grub-module-verifier32.c b/util/grub-module-verifier32.c
3e07ee
index 257229f8f08..ba7d41aafea 100644
3e07ee
--- a/util/grub-module-verifier32.c
3e07ee
+++ b/util/grub-module-verifier32.c
3e07ee
@@ -1,2 +1,4 @@
3e07ee
 #define MODULEVERIFIER_ELF32 1
3e07ee
+#ifndef GRUB_MODULE_VERIFIERXX
3e07ee
 #include "grub-module-verifierXX.c"
3e07ee
+#endif
3e07ee
diff --git a/util/grub-module-verifier64.c b/util/grub-module-verifier64.c
3e07ee
index 4db6b4bedd1..fc23ef800b3 100644
3e07ee
--- a/util/grub-module-verifier64.c
3e07ee
+++ b/util/grub-module-verifier64.c
3e07ee
@@ -1,2 +1,4 @@
3e07ee
 #define MODULEVERIFIER_ELF64 1
3e07ee
+#ifndef GRUB_MODULE_VERIFIERXX
3e07ee
 #include "grub-module-verifierXX.c"
3e07ee
+#endif
3e07ee
diff --git a/util/grub-module-verifierXX.c b/util/grub-module-verifierXX.c
3e07ee
index 1feaafc9b9e..597ded14362 100644
3e07ee
--- a/util/grub-module-verifierXX.c
3e07ee
+++ b/util/grub-module-verifierXX.c
3e07ee
@@ -1,3 +1,12 @@
3e07ee
+#define GRUB_MODULE_VERIFIERXX
3e07ee
+#if !defined(MODULEVERIFIER_ELF32) && !defined(MODULEVERIFIER_ELF64)
3e07ee
+#if __SIZEOF_POINTER__ == 8
3e07ee
+#include "grub-module-verifier64.c"
3e07ee
+#else
3e07ee
+#include "grub-module-verifier32.c"
3e07ee
+#endif
3e07ee
+#endif
3e07ee
+
3e07ee
 #include <string.h>
3e07ee
 
3e07ee
 #include <grub elf.h="">