* [PATCH v5 0/1] grub-module-verifierxx.c: enable running standalone checkers
@ 2022-10-05 13:48 Robbie Harwood
2022-10-05 13:48 ` [PATCH v5 1/1] " Robbie Harwood
0 siblings, 1 reply; 3+ messages in thread
From: Robbie Harwood @ 2022-10-05 13:48 UTC (permalink / raw)
To: grub-devel; +Cc: Robbie Harwood, dkiper
(Resend since not all changes were in v4 that were supposed to be.)
Address Daniel's comments on v2/v3.
In particular, gcc (Debian 12.2.0-3) only warns when the redefinition is
to a different value. It gets confused by the space, so just remove it.
This causes
gcc -x c -fsyntax-only -Iinclude -I. util/grub-module-verifierXX.c
to build without warnings.
Interdiff attached.
Peter Jones (1):
grub-module-verifierxx.c: enable running standalone checkers
include/grub/elf.h | 4 ++--
util/grub-module-verifier32.c | 2 ++
util/grub-module-verifier64.c | 2 ++
util/grub-module-verifierXX.c | 9 +++++++++
4 files changed, 15 insertions(+), 2 deletions(-)
Interdiff against v3:
diff --git a/include/grub/elf.h b/include/grub/elf.h
index 0e70651d4b..e6f073bc90 100644
--- a/include/grub/elf.h
+++ b/include/grub/elf.h
@@ -2593,8 +2593,8 @@ typedef Elf64_Word Elf_Word;
typedef Elf64_Xword Elf_Xword;
typedef Elf64_Shnum Elf_Shnum;
-#define ELF_ST_BIND(val) ELF64_ST_BIND (val)
-#define ELF_ST_TYPE(val) ELF64_ST_TYPE (val)
+#define ELF_ST_BIND(val) ELF64_ST_BIND(val)
+#define ELF_ST_TYPE(val) ELF64_ST_TYPE(val)
#define ELF_ST_INFO(a,b) ELF64_ST_INFO(a,b)
#define ELF_R_SYM(val) ELF64_R_SYM(val)
#define ELF_R_TYPE(val) ELF64_R_TYPE(val)
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v5 1/1] grub-module-verifierxx.c: enable running standalone checkers
2022-10-05 13:48 [PATCH v5 0/1] grub-module-verifierxx.c: enable running standalone checkers Robbie Harwood
@ 2022-10-05 13:48 ` Robbie Harwood
2022-10-06 13:19 ` Daniel Kiper
0 siblings, 1 reply; 3+ messages in thread
From: Robbie Harwood @ 2022-10-05 13:48 UTC (permalink / raw)
To: grub-devel; +Cc: Peter Jones, dkiper, Robbie Harwood
From: Peter Jones <pjones@redhat.com>
Allow treating 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 -I 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.
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
---
include/grub/elf.h | 4 ++--
util/grub-module-verifier32.c | 2 ++
util/grub-module-verifier64.c | 2 ++
util/grub-module-verifierXX.c | 9 +++++++++
4 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/include/grub/elf.h b/include/grub/elf.h
index 0e70651d4b..e6f073bc90 100644
--- a/include/grub/elf.h
+++ b/include/grub/elf.h
@@ -2593,8 +2593,8 @@ typedef Elf64_Word Elf_Word;
typedef Elf64_Xword Elf_Xword;
typedef Elf64_Shnum Elf_Shnum;
-#define ELF_ST_BIND(val) ELF64_ST_BIND (val)
-#define ELF_ST_TYPE(val) ELF64_ST_TYPE (val)
+#define ELF_ST_BIND(val) ELF64_ST_BIND(val)
+#define ELF_ST_TYPE(val) ELF64_ST_TYPE(val)
#define ELF_ST_INFO(a,b) ELF64_ST_INFO(a,b)
#define ELF_R_SYM(val) ELF64_R_SYM(val)
#define ELF_R_TYPE(val) ELF64_R_TYPE(val)
diff --git a/util/grub-module-verifier32.c b/util/grub-module-verifier32.c
index 257229f8f0..ba7d41aafe 100644
--- a/util/grub-module-verifier32.c
+++ b/util/grub-module-verifier32.c
@@ -1,2 +1,4 @@
#define MODULEVERIFIER_ELF32 1
+#ifndef GRUB_MODULE_VERIFIERXX
#include "grub-module-verifierXX.c"
+#endif
diff --git a/util/grub-module-verifier64.c b/util/grub-module-verifier64.c
index 4db6b4bedd..fc23ef800b 100644
--- a/util/grub-module-verifier64.c
+++ b/util/grub-module-verifier64.c
@@ -1,2 +1,4 @@
#define MODULEVERIFIER_ELF64 1
+#ifndef GRUB_MODULE_VERIFIERXX
#include "grub-module-verifierXX.c"
+#endif
diff --git a/util/grub-module-verifierXX.c b/util/grub-module-verifierXX.c
index 8e0cd91d90..d5907f268e 100644
--- a/util/grub-module-verifierXX.c
+++ b/util/grub-module-verifierXX.c
@@ -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>
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v5 1/1] grub-module-verifierxx.c: enable running standalone checkers
2022-10-05 13:48 ` [PATCH v5 1/1] " Robbie Harwood
@ 2022-10-06 13:19 ` Daniel Kiper
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Kiper @ 2022-10-06 13:19 UTC (permalink / raw)
To: Robbie Harwood; +Cc: grub-devel, Peter Jones
On Wed, Oct 05, 2022 at 09:48:37AM -0400, Robbie Harwood wrote:
> From: Peter Jones <pjones@redhat.com>
>
> Allow treating 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 -I 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.
>
> Signed-off-by: Peter Jones <pjones@redhat.com>
> Signed-off-by: Robbie Harwood <rharwood@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Daniel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-06 13:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-05 13:48 [PATCH v5 0/1] grub-module-verifierxx.c: enable running standalone checkers Robbie Harwood
2022-10-05 13:48 ` [PATCH v5 1/1] " Robbie Harwood
2022-10-06 13:19 ` Daniel Kiper
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.