nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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