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

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