nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0089-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
b35c50
index 257229f8f0..ba7d41aafe 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
b35c50
index 4db6b4bedd..fc23ef800b 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
b35c50
index ceb24309ae..a98e2f9b1a 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>