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.
This commit is contained in:
Colin Watson 2010-01-03 21:50:53 +00:00
parent a173283f78
commit e2d70b5cea
3 changed files with 25 additions and 2 deletions

View file

@ -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> 2010-01-03 Carles Pina i Estany <carles@pina.cat>
* normal/menu_text.c (print_message): Change messages. * normal/menu_text.c (print_message): Change messages.

View file

@ -42,7 +42,7 @@ void EXPORT_FUNC(grub_list_insert) (grub_list_t *head, grub_list_t item,
static inline void * static inline void *
grub_bad_type_cast_real (int line, const char *file) 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 * static inline void *
grub_bad_type_cast_real (int line, const char *file) grub_bad_type_cast_real (int line, const char *file)

View file

@ -1,7 +1,7 @@
/* misc.h - prototypes for misc functions */ /* misc.h - prototypes for misc functions */
/* /*
* GRUB -- GRand Unified Bootloader * 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 * GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -25,6 +25,22 @@
#include <grub/symbol.h> #include <grub/symbol.h>
#include <grub/err.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) \ #define ALIGN_UP(addr, align) \
((addr + (typeof (addr)) align - 1) & ~((typeof (addr)) align - 1)) ((addr + (typeof (addr)) align - 1) & ~((typeof (addr)) align - 1))
#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0])) #define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))