Blame SOURCES/0106-module-verifier-make-it-possible-to-run-checkers-on-.patch

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