libgcrypt itself is compiled with -Wno-sign-compare.
Do the same for consistency

Signed-off-by: Vladimir Serbinenko <phco...@gmail.com>
---
 conf/Makefile.common         |  2 +-
 grub-core/Makefile.core.def  | 10 +++++-----
 grub-core/kern/compiler-rt.c | 32 ++++++++++++++++++--------------
 include/grub/compiler-rt.h   |  4 ++++
 util/import_gcry.py          |  2 +-
 5 files changed, 29 insertions(+), 21 deletions(-)

diff --git a/conf/Makefile.common b/conf/Makefile.common
index 0df4d6e7a..4d38ff034 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -81,7 +81,7 @@ CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/lib/gnulib 
-I$(top_srcdir)/grub-co
 CFLAGS_POSIX = -fno-builtin
 CPPFLAGS_POSIX = -I$(top_srcdir)/grub-core/lib/posix_wrap
 
-CFLAGS_GCRY = -Wno-error=sign-compare -Wno-missing-field-initializers 
-Wno-redundant-decls -Wno-undef $(CFLAGS_POSIX)
+CFLAGS_GCRY = -Wno-sign-compare -Wno-missing-field-initializers 
-Wno-redundant-decls -Wno-undef $(CFLAGS_POSIX)
 CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap $(CPPFLAGS_POSIX) 
-D_GCRYPT_IN_LIBGCRYPT=1 -D_GCRYPT_CONFIG_H_INCLUDED=1 
-I$(top_srcdir)/include/grub/gcrypt
 
 CPPFLAGS_EFIEMU = -I$(top_srcdir)/grub-core/efiemu/runtime
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 770f6e0c5..56e407376 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -975,7 +975,7 @@ module = {
 module = {
   name = pgp;
   common = commands/pgp.c;
-  cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare';
+  cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls';
   cppflags = '$(CPPFLAGS_GCRY)';
 };
 
@@ -2184,7 +2184,7 @@ module = {
   name = dsa_sexp_test;
   common = tests/dsa_sexp_test.c;
 
-  cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare';
+  cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls';
   cppflags = '$(CPPFLAGS_GCRY)';
 };
 
@@ -2192,7 +2192,7 @@ module = {
   name = rsa_sexp_test;
   common = tests/rsa_sexp_test.c;
 
-  cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare';
+  cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls';
   cppflags = '$(CPPFLAGS_GCRY)';
 };
 
@@ -2556,7 +2556,7 @@ module = {
   common = lib/libgcrypt_wrap/mem.c;
   common = lib/libgcrypt-grub/cipher/md.c;
 
-  cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare 
-Wno-unused-but-set-variable';
+  cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-unused-but-set-variable';
   cppflags = '$(CPPFLAGS_GCRY)';
 };
 
@@ -2568,7 +2568,7 @@ module = {
   common = lib/libgcrypt-grub/src/sexp.c;
   common = lib/b64dec.c;
 
-  cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare';
+  cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls';
   cppflags = '$(CPPFLAGS_GCRY)';
 };
 
diff --git a/grub-core/kern/compiler-rt.c b/grub-core/kern/compiler-rt.c
index eda689a0c..c83cf3d2d 100644
--- a/grub-core/kern/compiler-rt.c
+++ b/grub-core/kern/compiler-rt.c
@@ -82,20 +82,6 @@ __modsi3 (grub_int32_t a, grub_int32_t b)
   return ret;
 }
 
-grub_uint64_t
-__udivdi3 (grub_uint64_t a, grub_uint64_t b)
-{
-  return grub_divmod64 (a, b, 0);
-}
-
-grub_uint64_t
-__umoddi3 (grub_uint64_t a, grub_uint64_t b)
-{
-  grub_uint64_t ret;
-  grub_divmod64 (a, b, &ret);
-  return ret;
-}
-
 grub_int64_t
 __divdi3 (grub_int64_t a, grub_int64_t b)
 {
@@ -112,6 +98,24 @@ __moddi3 (grub_int64_t a, grub_int64_t b)
 
 #endif
 
+#if GRUB_DIVISION_IN_SOFTWARE || defined(__mips__)
+
+grub_uint64_t
+__udivdi3 (grub_uint64_t a, grub_uint64_t b)
+{
+  return grub_divmod64 (a, b, 0);
+}
+
+grub_uint64_t
+__umoddi3 (grub_uint64_t a, grub_uint64_t b)
+{
+  grub_uint64_t ret;
+  grub_divmod64 (a, b, &ret);
+  return ret;
+}
+
+#endif
+
 #endif
 
 #ifdef NEED_CTZDI2
diff --git a/include/grub/compiler-rt.h b/include/grub/compiler-rt.h
index 43fd8f4d7..979c3db16 100644
--- a/include/grub/compiler-rt.h
+++ b/include/grub/compiler-rt.h
@@ -45,6 +45,10 @@ EXPORT_FUNC (__divdi3) (grub_int64_t a, grub_int64_t b);
 grub_int64_t
 EXPORT_FUNC (__moddi3) (grub_int64_t a, grub_int64_t b);
 
+#endif
+
+#if (defined(GRUB_DIVISION_IN_SOFTWARE) && GRUB_DIVISION_IN_SOFTWARE) || 
defined(__mips__)
+
 grub_uint64_t
 EXPORT_FUNC (__udivdi3) (grub_uint64_t a, grub_uint64_t b);
 
diff --git a/util/import_gcry.py b/util/import_gcry.py
index 1be18cf91..a4411ecb9 100644
--- a/util/import_gcry.py
+++ b/util/import_gcry.py
@@ -551,7 +551,7 @@ for cipher_file in cipher_files:
                     confutil.write ("  common = 
grub-core/lib/libgcrypt-grub/cipher/%s;\n" % src)
             if modname == "gcry_ecc":
                 conf.write ("  common = lib/libgcrypt-grub/mpi/ec.c;\n")
-                conf.write ("  cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls 
-Wno-sign-compare';\n")
+                conf.write ("  cflags = '$(CFLAGS_GCRY) 
-Wno-redundant-decls';\n")
             elif modname == "gcry_rijndael" or modname == "gcry_md4" or 
modname == "gcry_md5" or modname == "gcry_rmd160" or modname == "gcry_sha1" or 
modname == "gcry_sha256" or modname == "gcry_sha512" or modname == "gcry_tiger":
                 # Alignment checked by hand
                 conf.write ("  cflags = '$(CFLAGS_GCRY) -Wno-cast-align';\n");
-- 
2.49.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to