~jonathank89/burg/burg-percise

« back to all changes in this revision

Viewing changes to include/grub/misc.h

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.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* misc.h - prototypes for misc functions */
2
2
/*
3
3
 *  GRUB  --  GRand Unified Bootloader
4
 
 *  Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2008,2009  Free Software Foundation, Inc.
 
4
 *  Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2010  Free Software Foundation, Inc.
5
5
 *
6
6
 *  GRUB is free software: you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
25
25
#include <grub/symbol.h>
26
26
#include <grub/err.h>
27
27
 
 
28
/* GCC version checking borrowed from glibc. */
 
29
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
 
30
#  define GNUC_PREREQ(maj,min) \
 
31
        ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
 
32
#else
 
33
#  define GNUC_PREREQ(maj,min) 0
 
34
#endif
 
35
 
 
36
/* Does this compiler support compile-time error attributes? */
 
37
#if GNUC_PREREQ(4,3)
 
38
#  define ATTRIBUTE_ERROR(msg) \
 
39
        __attribute__ ((__error__ (msg)))
 
40
#else
 
41
#  define ATTRIBUTE_ERROR(msg)
 
42
#endif
 
43
 
28
44
#define ALIGN_UP(addr, align) \
29
45
        ((addr + (typeof (addr)) align - 1) & ~((typeof (addr)) align - 1))
30
46
#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))