]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2010-01-03 Colin Watson <cjwatson@ubuntu.com>
authorColin Watson <cjwatson@ubuntu.com>
Sun, 3 Jan 2010 21:50:53 +0000 (21:50 +0000)
committerColin Watson <cjwatson@ubuntu.com>
Sun, 3 Jan 2010 21:50:53 +0000 (21:50 +0000)
* include/grub/misc.h (GNUC_PREREQ): New macro.
(ATTRIBUTE_ERROR): New macro.
* include/grub/list.h (grub_bad_type_cast_real): Use
ATTRIBUTE_ERROR.

ChangeLog
include/grub/list.h
include/grub/misc.h

index 916e2bc1ee475ae93a8d99a0f0c10e21392cdcf4..e5e4f42ca10324d1d828573e492e9d618ea52eef 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-01-03  Colin Watson  <cjwatson@ubuntu.com>
+
+       * include/grub/misc.h (GNUC_PREREQ): New macro.
+       (ATTRIBUTE_ERROR): New macro.
+       * include/grub/list.h (grub_bad_type_cast_real): Use
+       ATTRIBUTE_ERROR.
+
 2010-01-03  Carles Pina i Estany  <carles@pina.cat>
 
        * normal/menu_text.c (print_message): Change messages.
index 86a5381cdfbcc599184bd3f6b5c3044c7c4062e0..b7703e214b1f95239511ed69d5f5ee45697630d0 100644 (file)
@@ -42,7 +42,7 @@ void EXPORT_FUNC(grub_list_insert) (grub_list_t *head, grub_list_t item,
 
 static inline void *
 grub_bad_type_cast_real (int line, const char *file)
-     __attribute__ ((error ("bad type cast between incompatible grub types")));
+     ATTRIBUTE_ERROR ("bad type cast between incompatible grub types");
 
 static inline void *
 grub_bad_type_cast_real (int line, const char *file)
index 92fb460cfada50d30971e19f60b23d49ccba3056..c5eb953e279cf40312b42cf7f62cf124b330327c 100644 (file)
@@ -1,7 +1,7 @@
 /* misc.h - prototypes for misc functions */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2008,2009  Free Software Foundation, Inc.
+ *  Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2010  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
 #include <grub/symbol.h>
 #include <grub/err.h>
 
+/* GCC version checking borrowed from glibc. */
+#if defined(__GNUC__) && defined(__GNUC_MINOR__)
+#  define GNUC_PREREQ(maj,min) \
+       ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+#else
+#  define GNUC_PREREQ(maj,min) 0
+#endif
+
+/* Does this compiler support compile-time error attributes? */
+#if GNUC_PREREQ(4,3)
+#  define ATTRIBUTE_ERROR(msg) \
+       __attribute__ ((__error__ (msg)))
+#else
+#  define ATTRIBUTE_ERROR(msg)
+#endif
+
 #define ALIGN_UP(addr, align) \
        ((addr + (typeof (addr)) align - 1) & ~((typeof (addr)) align - 1))
 #define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))