diff --git a/include/grub/crypto.h b/include/grub/crypto.h index b0d7add1d..6ab021cb8 100644 --- a/include/grub/crypto.h +++ b/include/grub/crypto.h @@ -245,6 +245,14 @@ typedef struct gcry_md_spec struct gcry_md_spec *next; } gcry_md_spec_t; +/* + * Clang defaults to flagging type redefinitions as warnings. + * A few "forward declarations" in this file are needed due + * to inter-relationship complexities between GRUB and libgcrypt. + */ +#ifdef __clang__ +#pragma GCC diagnostic ignored "-Wtypedef-redefinition" +#endif typedef struct gcry_md_handle*gcry_md_hd_t; struct gcry_mpi; diff --git a/util/import_gcry.py b/util/import_gcry.py index 086bde77c..1e23ee760 100644 --- a/util/import_gcry.py +++ b/util/import_gcry.py @@ -608,7 +608,11 @@ with codecs.open (os.path.join (cipher_dir_out, "crypto.lst"), "w", "utf-8") as continue with codecs.open (infile, "r", "utf-8") as f: if src == "types.h": - fw.write (f.read ().replace ("float f;", "").replace ("double g;", "")) + fw.write (f.read ().replace ("float f;", "").replace ("double g;", "") \ + .replace("#ifndef HAVE_BYTE", + "#ifdef __clang__\n" \ + "#pragma GCC diagnostic ignored \"-Wtypedef-redefinition\"\n#endif\n" \ + "#ifndef HAVE_BYTE")) continue if src == "cipher-proto.h":