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

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