+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.
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)
/* 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]))