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

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