dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0027-fix-include-loop-on-MinGW-due-to-libintl.h-pulling-s.patch

f725e3
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f725e3
From: Andrey Borzenkov <arvidjaar@gmail.com>
f725e3
Date: Sat, 18 Jan 2014 21:22:57 +0400
f725e3
Subject: [PATCH] fix include loop on MinGW due to libintl.h pulling stdio.h
f725e3
f725e3
In file included from ./include/grub/dl.h:23:0,
f725e3
                 from grub-core/lib/libgcrypt-grub/cipher/rfc2268.c:3:
f725e3
./include/grub/list.h:34:18: warning: conflicting types for 'grub_list_push' [en
f725e3
abled by default]
f725e3
 void EXPORT_FUNC(grub_list_push) (grub_list_t *head, grub_list_t item);
f725e3
                  ^
f725e3
./include/grub/symbol.h:68:25: note: in definition of macro 'EXPORT_FUNC'
f725e3
 # define EXPORT_FUNC(x) x
f725e3
                         ^
f725e3
In file included from ./include/grub/fs.h:30:0,
f725e3
                 from ./include/grub/file.h:25,
f725e3
                 from ./grub-core/lib/posix_wrap/stdio.h:23,
f725e3
                 from c:\mingw\include\libintl.h:314,
f725e3
                 from ./include/grub/i18n.h:33,
f725e3
                 from ./include/grub/misc.h:27,
f725e3
                 from ./include/grub/list.h:25,
f725e3
                 from ./include/grub/dl.h:28,
f725e3
                 from grub-core/lib/libgcrypt-grub/cipher/rfc2268.c:3:
f725e3
./include/grub/partition.h:106:3: note: previous implicit declaration of 'grub_l
f725e3
ist_push' was here
f725e3
   grub_list_push (GRUB_AS_LIST_P (&grub_partition_map_list),
f725e3
   ^
f725e3
list.h needs just ATTRIBUTE_ERROR from misc.h; split compiler features
f725e3
into separate file grub/compiler.h and include it instead.
f725e3
---
f725e3
 grub-core/commands/fileXX.c        |  1 +
f725e3
 grub-core/efiemu/prepare.c         |  1 +
f725e3
 grub-core/loader/i386/xen_file.c   |  1 +
f725e3
 grub-core/loader/i386/xen_fileXX.c |  1 +
f725e3
 grub-core/video/capture.c          |  1 +
f725e3
 include/grub/command.h             |  1 +
f725e3
 include/grub/compiler.h            | 51 ++++++++++++++++++++++++++++++++++++++
f725e3
 include/grub/dl.h                  |  1 +
f725e3
 include/grub/list.h                |  4 +--
f725e3
 include/grub/misc.h                | 29 +---------------------
f725e3
 include/grub/procfs.h              |  1 +
f725e3
 ChangeLog                          | 14 +++++++++++
f725e3
 12 files changed, 76 insertions(+), 30 deletions(-)
f725e3
 create mode 100644 include/grub/compiler.h
f725e3
f725e3
diff --git a/grub-core/commands/fileXX.c b/grub-core/commands/fileXX.c
f725e3
index c9857ff67b1..58e1094c68b 100644
f725e3
--- a/grub-core/commands/fileXX.c
f725e3
+++ b/grub-core/commands/fileXX.c
f725e3
@@ -18,6 +18,7 @@
f725e3
 
f725e3
 #include <grub/fileid.h>
f725e3
 #include <grub/elfload.h>
f725e3
+#include <grub/misc.h>
f725e3
 
f725e3
 #pragma GCC diagnostic ignored "-Wcast-align"
f725e3
 
f725e3
diff --git a/grub-core/efiemu/prepare.c b/grub-core/efiemu/prepare.c
f725e3
index fb1b25d17f2..84c3368a82c 100644
f725e3
--- a/grub-core/efiemu/prepare.c
f725e3
+++ b/grub-core/efiemu/prepare.c
f725e3
@@ -21,6 +21,7 @@
f725e3
 #include <grub/err.h>
f725e3
 #include <grub/mm.h>
f725e3
 #include <grub/types.h>
f725e3
+#include <grub/misc.h>
f725e3
 #include <grub/efiemu/efiemu.h>
f725e3
 #include <grub/crypto.h>
f725e3
 
f725e3
diff --git a/grub-core/loader/i386/xen_file.c b/grub-core/loader/i386/xen_file.c
f725e3
index ebbf6aa11ba..ff23235f064 100644
f725e3
--- a/grub-core/loader/i386/xen_file.c
f725e3
+++ b/grub-core/loader/i386/xen_file.c
f725e3
@@ -18,6 +18,7 @@
f725e3
 
f725e3
 #include <grub/xen_file.h>
f725e3
 #include <grub/i386/linux.h>
f725e3
+#include <grub/misc.h>
f725e3
 
f725e3
 grub_elf_t
f725e3
 grub_xen_file (grub_file_t file)
f725e3
diff --git a/grub-core/loader/i386/xen_fileXX.c b/grub-core/loader/i386/xen_fileXX.c
f725e3
index 6df00157629..73a5f90fdb9 100644
f725e3
--- a/grub-core/loader/i386/xen_fileXX.c
f725e3
+++ b/grub-core/loader/i386/xen_fileXX.c
f725e3
@@ -17,6 +17,7 @@
f725e3
  */
f725e3
 
f725e3
 #include <grub/xen_file.h>
f725e3
+#include <grub/misc.h>
f725e3
 
f725e3
 static grub_err_t
f725e3
 parse_xen_guest (grub_elf_t elf, struct grub_xen_file_info *xi,
f725e3
diff --git a/grub-core/video/capture.c b/grub-core/video/capture.c
f725e3
index 67c8edde824..4f83c744116 100644
f725e3
--- a/grub-core/video/capture.c
f725e3
+++ b/grub-core/video/capture.c
f725e3
@@ -4,6 +4,7 @@
f725e3
 #include <grub/video.h>
f725e3
 #include <grub/video_fb.h>
f725e3
 #include <grub/mm.h>
f725e3
+#include <grub/misc.h>
f725e3
 
f725e3
 static struct
f725e3
 {
f725e3
diff --git a/include/grub/command.h b/include/grub/command.h
f725e3
index 8705a635519..eee4e847ee4 100644
f725e3
--- a/include/grub/command.h
f725e3
+++ b/include/grub/command.h
f725e3
@@ -22,6 +22,7 @@
f725e3
 #include <grub/symbol.h>
f725e3
 #include <grub/err.h>
f725e3
 #include <grub/list.h>
f725e3
+#include <grub/misc.h>
f725e3
 
f725e3
 typedef enum grub_command_flags
f725e3
   {
f725e3
diff --git a/include/grub/compiler.h b/include/grub/compiler.h
f725e3
new file mode 100644
f725e3
index 00000000000..c9e1d7a73dc
f725e3
--- /dev/null
f725e3
+++ b/include/grub/compiler.h
f725e3
@@ -0,0 +1,51 @@
f725e3
+/* compiler.h - macros for various compiler features */
f725e3
+/*
f725e3
+ *  GRUB  --  GRand Unified Bootloader
f725e3
+ *  Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2010,2014  Free Software Foundation, Inc.
f725e3
+ *
f725e3
+ *  GRUB is free software: you can redistribute it and/or modify
f725e3
+ *  it under the terms of the GNU General Public License as published by
f725e3
+ *  the Free Software Foundation, either version 3 of the License, or
f725e3
+ *  (at your option) any later version.
f725e3
+ *
f725e3
+ *  GRUB is distributed in the hope that it will be useful,
f725e3
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
f725e3
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f725e3
+ *  GNU General Public License for more details.
f725e3
+ *
f725e3
+ *  You should have received a copy of the GNU General Public License
f725e3
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
f725e3
+ */
f725e3
+
f725e3
+#ifndef GRUB_COMPILER_HEADER
f725e3
+#define GRUB_COMPILER_HEADER	1
f725e3
+
f725e3
+/* GCC version checking borrowed from glibc. */
f725e3
+#if defined(__GNUC__) && defined(__GNUC_MINOR__)
f725e3
+#  define GNUC_PREREQ(maj,min) \
f725e3
+	((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
f725e3
+#else
f725e3
+#  define GNUC_PREREQ(maj,min) 0
f725e3
+#endif
f725e3
+
f725e3
+/* Does this compiler support compile-time error attributes? */
f725e3
+#if GNUC_PREREQ(4,3)
f725e3
+#  define ATTRIBUTE_ERROR(msg) \
f725e3
+	__attribute__ ((__error__ (msg)))
f725e3
+#else
f725e3
+#  define ATTRIBUTE_ERROR(msg) __attribute__ ((noreturn))
f725e3
+#endif
f725e3
+
f725e3
+#if GNUC_PREREQ(4,4)
f725e3
+#  define GNU_PRINTF gnu_printf
f725e3
+#else
f725e3
+#  define GNU_PRINTF printf
f725e3
+#endif
f725e3
+
f725e3
+#if GNUC_PREREQ(3,4)
f725e3
+#  define WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
f725e3
+#else
f725e3
+#  define WARN_UNUSED_RESULT
f725e3
+#endif
f725e3
+
f725e3
+#endif /* ! GRUB_COMPILER_HEADER */
f725e3
diff --git a/include/grub/dl.h b/include/grub/dl.h
f725e3
index d29a899f52c..9562fa6634c 100644
f725e3
--- a/include/grub/dl.h
f725e3
+++ b/include/grub/dl.h
f725e3
@@ -26,6 +26,7 @@
f725e3
 #include <grub/types.h>
f725e3
 #include <grub/elf.h>
f725e3
 #include <grub/list.h>
f725e3
+#include <grub/misc.h>
f725e3
 #endif
f725e3
 
f725e3
 /*
f725e3
diff --git a/include/grub/list.h b/include/grub/list.h
f725e3
index edd20adfdb2..d170ff6da02 100644
f725e3
--- a/include/grub/list.h
f725e3
+++ b/include/grub/list.h
f725e3
@@ -21,8 +21,8 @@
f725e3
 #define GRUB_LIST_HEADER 1
f725e3
 
f725e3
 #include <grub/symbol.h>
f725e3
-#include <grub/types.h>
f725e3
-#include <grub/misc.h>
f725e3
+#include <grub/err.h>
f725e3
+#include <grub/compiler.h>
f725e3
 
f725e3
 struct grub_list
f725e3
 {
f725e3
diff --git a/include/grub/misc.h b/include/grub/misc.h
f725e3
index 2cf74b55006..c6cd4564d86 100644
f725e3
--- a/include/grub/misc.h
f725e3
+++ b/include/grub/misc.h
f725e3
@@ -25,34 +25,7 @@
f725e3
 #include <grub/symbol.h>
f725e3
 #include <grub/err.h>
f725e3
 #include <grub/i18n.h>
f725e3
-
f725e3
-/* GCC version checking borrowed from glibc. */
f725e3
-#if defined(__GNUC__) && defined(__GNUC_MINOR__)
f725e3
-#  define GNUC_PREREQ(maj,min) \
f725e3
-	((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
f725e3
-#else
f725e3
-#  define GNUC_PREREQ(maj,min) 0
f725e3
-#endif
f725e3
-
f725e3
-/* Does this compiler support compile-time error attributes? */
f725e3
-#if GNUC_PREREQ(4,3)
f725e3
-#  define ATTRIBUTE_ERROR(msg) \
f725e3
-	__attribute__ ((__error__ (msg)))
f725e3
-#else
f725e3
-#  define ATTRIBUTE_ERROR(msg) __attribute__ ((noreturn))
f725e3
-#endif
f725e3
-
f725e3
-#if GNUC_PREREQ(4,4)
f725e3
-#  define GNU_PRINTF gnu_printf
f725e3
-#else
f725e3
-#  define GNU_PRINTF printf
f725e3
-#endif
f725e3
-
f725e3
-#if GNUC_PREREQ(3,4)
f725e3
-#  define WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
f725e3
-#else
f725e3
-#  define WARN_UNUSED_RESULT
f725e3
-#endif
f725e3
+#include <grub/compiler.h>
f725e3
 
f725e3
 #define ALIGN_UP(addr, align) \
f725e3
 	((addr + (typeof (addr)) align - 1) & ~((typeof (addr)) align - 1))
f725e3
diff --git a/include/grub/procfs.h b/include/grub/procfs.h
f725e3
index d393da77f91..8cc331d946f 100644
f725e3
--- a/include/grub/procfs.h
f725e3
+++ b/include/grub/procfs.h
f725e3
@@ -20,6 +20,7 @@
f725e3
 #define GRUB_PROCFS_HEADER	1
f725e3
 
f725e3
 #include <grub/list.h>
f725e3
+#include <grub/types.h>
f725e3
 
f725e3
 struct grub_procfs_entry
f725e3
 {
f725e3
diff --git a/ChangeLog b/ChangeLog
f725e3
index dad2da2faef..dad469b43b1 100644
f725e3
--- a/ChangeLog
f725e3
+++ b/ChangeLog
f725e3
@@ -1,3 +1,17 @@
f725e3
+2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
f725e3
+
f725e3
+	* include/grub/misc.h: Move macros for compiler features to ...
f725e3
+	* include/grub/compiler.h: ... new file.
f725e3
+	* include/grub/list.h: Include <grub/compiler.h> instead of <grub/misc.h>.
f725e3
+	* grub-core/commands/fileXX.c: Include <grub/misc.h>.
f725e3
+	* grub-core/efiemu/prepare.c: Include <grub/misc.h>.
f725e3
+	* grub-core/loader/i386/xen_file.c: Include <grub/misc.h>.
f725e3
+	* grub-core/loader/i386/xen_fileXX.c: Include <grub/misc.h>.
f725e3
+	* grub-core/video/capture.c: Include <grub/misc.h>.
f725e3
+	* include/grub/command.h: Include <grub/misc.h>.
f725e3
+	* include/grub/dl.h: Include <grub/misc.h>.
f725e3
+	* include/grub/procfs.h: Include <grub/misc.h>.
f725e3
+
f725e3
 2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
f725e3
 
f725e3
 	* configure.ac: Add support for BUILD_EXEEXT and use it ...