Skip to contentSkip to conversation

module-verifier: make it possible to run checkers on grub-module-verifierxx.c

PATCH Superseded Javier Martinez Canillas 2 participants 3 messages Mar 13, 2020 – Apr 6, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 10/10 module-verifier: make it possible to run checkers on grub-module-verifierxx.c

From: Peter Jones <[email protected]>

This makes it so you can treat grub-module-verifierxx.c as a file you can build directly, so syntax checkers like vim's "syntastic" plugin, which uses "gcc -x c -fsyntax-only" to build it, will work.

One still has to do whatever setup is required to make it pick the right include dirs, which -W options we use, etc., but this makes it so you can do the checking on the file you're editing, rather than on a different file.

---

 util/grub-module-verifier32.c | 2 ++
 util/grub-module-verifier64.c | 2 ++
 util/grub-module-verifierXX.c | 9 +++++++++
 3 files changed, 13 insertions(+)
util/grub-module-verifier32.c +2 -0
index 257229f8f08..ba7d41aafea 100644
@@ -1,2 +1,4 @@
 #define MODULEVERIFIER_ELF32 1
+#ifndef GRUB_MODULE_VERIFIERXX
 #include "grub-module-verifierXX.c"
+#endif
util/grub-module-verifier64.c +2 -0
index 4db6b4bedd1..fc23ef800b3 100644
@@ -1,2 +1,4 @@
 #define MODULEVERIFIER_ELF64 1
+#ifndef GRUB_MODULE_VERIFIERXX
 #include "grub-module-verifierXX.c"
+#endif
util/grub-module-verifierXX.c +9 -0
index ceb24309aec..a98e2f9b1ac 100644
@@ -1,3 +1,12 @@
+#define GRUB_MODULE_VERIFIERXX
+#if !defined(MODULEVERIFIER_ELF32) && !defined(MODULEVERIFIER_ELF64)
+#if __SIZEOF_POINTER__ == 8
+#include "grub-module-verifier64.c"
+#else
+#include "grub-module-verifier32.c"
+#endif
+#endif
+
 #include <string.h>
 
 #include <grub/elf.h>
Signature · 1 line
2.24.1
#1 lore raw
Quoted 13 lines · Javier Martinez Canillas

From: Peter Jones <[email protected]>

This makes it so you can treat grub-module-verifierxx.c as a file you can build directly, so syntax checkers like vim's "syntastic" plugin, which uses "gcc -x c -fsyntax-only" to build it, will work.

One still has to do whatever setup is required to make it pick the right include dirs, which -W options we use, etc., but this makes it so you can do the checking on the file you're editing, rather than on a different file.

Quoted 6 lines

---

 util/grub-module-verifier32.c | 2 ++
 util/grub-module-verifier64.c | 2 ++
 util/grub-module-verifierXX.c | 9 +++++++++
 3 files changed, 13 insertions(+)

Comments for this patch are here:
https://lists.gnu.org/archive/html/grub-devel/2018-09/msg00006.html

Daniel

#2 lore raw

Hello Daniel,

Quoted 16 lines · Daniel Kiper
Quoted 15 lines · Javier Martinez Canillas

From: Peter Jones <[email protected]>

This makes it so you can treat grub-module-verifierxx.c as a file you can build directly, so syntax checkers like vim's "syntastic" plugin, which uses "gcc -x c -fsyntax-only" to build it, will work.

One still has to do whatever setup is required to make it pick the right include dirs, which -W options we use, etc., but this makes it so you can do the checking on the file you're editing, rather than on a different file.

---

Quoted 8 lines
Quoted 4 lines
 util/grub-module-verifier32.c | 2 ++
 util/grub-module-verifier64.c | 2 ++
 util/grub-module-verifierXX.c | 9 +++++++++
 3 files changed, 13 insertions(+)

Comments for this patch are here:
https://lists.gnu.org/archive/html/grub-devel/2018-09/msg00006.html

I missed that this patch was posted before by Peter, sorry. I'll address these before sending a v2.

Quoted 7 lines

Daniel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Best regards,

Signature · 3 lines
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat