~hamo/ubuntu/precise/grub2/grub2.hi_res

« back to all changes in this revision

Viewing changes to build-aux/warn-on-use.h

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson, Colin Watson, Evan Broder, Mario Limonciello
  • Date: 2010-11-24 13:59:55 UTC
  • mfrom: (1.17.6 upstream) (17.6.15 experimental)
  • Revision ID: james.westby@ubuntu.com-20101124135955-r6ii5sepayr7jt53
Tags: 1.99~20101124-1ubuntu1
[ Colin Watson ]
* Resynchronise with Debian experimental.  Remaining changes:
  - Adjust for default Ubuntu boot options ("quiet splash").
  - Default to hiding the menu; holding down Shift at boot will show it.
  - Set a monochromatic theme for Ubuntu.
  - Apply Ubuntu GRUB Legacy changes to legacy update-grub script: title,
    recovery mode, quiet option, tweak how memtest86+ is displayed, and
    use UUIDs where appropriate.
  - Fix backslash-escaping in merge_debconf_into_conf.
  - Remove "GNU/Linux" from default distributor string.
  - Add crashkernel= options if kdump and makedumpfile are available.
  - If other operating systems are installed, then automatically unhide
    the menu.  Otherwise, if GRUB_HIDDEN_TIMEOUT is 0, then use keystatus
    if available to check whether Shift is pressed.  If it is, show the
    menu, otherwise boot immediately.  If keystatus is not available, then
    fall back to a short delay interruptible with Escape.
  - Allow Shift to interrupt 'sleep --interruptible'.
  - Don't display introductory message about line editing unless we're
    actually offering a shell prompt.  Don't clear the screen just before
    booting if we never drew the menu in the first place.
  - Remove some verbose messages printed before reading the configuration
    file.
  - Suppress progress messages as the kernel and initrd load for
    non-recovery kernel menu entries.
  - Change prepare_grub_to_access_device to handle filesystems
    loop-mounted on file images.
  - Ignore devices loop-mounted from files in 10_linux.
  - Show the boot menu if the previous boot failed, that is if it failed
    to get to the end of one of the normal runlevels.
  - Don't generate /boot/grub/device.map during grub-install or
    grub-mkconfig by default.
  - Adjust upgrade version checks for Ubuntu.
  - Don't display "GRUB loading" unless Shift is held down.
  - Adjust versions of grub-doc and grub-legacy-doc conflicts to tolerate
    our backport of the grub-doc split.
  - Fix LVM/RAID probing in the absence of /boot/grub/device.map.
  - Look for .mo files in /usr/share/locale-langpack as well, in
    preference.
  - Make sure GRUB_TIMEOUT isn't quoted unnecessarily.
  - Probe all devices in 'grub-probe --target=drive' if
    /boot/grub/device.map is missing.
  - Build-depend on qemu-kvm rather than qemu-system for grub-pc tests.
  - Use qemu rather than qemu-system-i386.
  - Program vesafb on BIOS systems rather than efifb.
  - Add a grub-rescue-efi-amd64 package containing a rescue CD-ROM image
    for EFI-AMD64.
  - On Wubi, don't ask for an install device, but just update wubildr
    using the diverted grub-install.
  - When embedding the core image in a post-MBR gap, check for and avoid
    sectors matching any of a list of known signatures.
  - Disable video_bochs and video_cirrus on PC BIOS systems, as probing
    PCI space seems to break on some systems.
* Downgrade "ACPI shutdown failed" error to a debug message, since it can
  cause spurious test failures.

[ Evan Broder ]
* Enable lua from grub-extras.
* Incorporate the bitop library into lua.
* Add enum_pci function to grub module in lua.
* Switch back to gfxpayload=keep by default, unless the video hardware
  is known to not support it.

[ Mario Limonciello ]
* Built part_msdos and vfat into bootx64.efi (LP: #677758)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* A C macro for emitting warnings if a function is used.
 
2
   Copyright (C) 2010 Free Software Foundation, Inc.
 
3
 
 
4
   This program is free software: you can redistribute it and/or modify it
 
5
   under the terms of the GNU General Public License as published
 
6
   by the Free Software Foundation; either version 3 of the License, or
 
7
   (at your option) any later version.
 
8
 
 
9
   This program is distributed in the hope that it will be useful,
 
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
   Lesser General Public License for more details.
 
13
 
 
14
   You should have received a copy of the GNU General Public License
 
15
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
16
 
 
17
/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
 
18
   for FUNCTION which will then trigger a compiler warning containing
 
19
   the text of "literal string" anywhere that function is called, if
 
20
   supported by the compiler.  If the compiler does not support this
 
21
   feature, the macro expands to an unused extern declaration.
 
22
 
 
23
   This macro is useful for marking a function as a potential
 
24
   portability trap, with the intent that "literal string" include
 
25
   instructions on the replacement function that should be used
 
26
   instead.  However, one of the reasons that a function is a
 
27
   portability trap is if it has the wrong signature.  Declaring
 
28
   FUNCTION with a different signature in C is a compilation error, so
 
29
   this macro must use the same type as any existing declaration so
 
30
   that programs that avoid the problematic FUNCTION do not fail to
 
31
   compile merely because they included a header that poisoned the
 
32
   function.  But this implies that _GL_WARN_ON_USE is only safe to
 
33
   use if FUNCTION is known to already have a declaration.  Use of
 
34
   this macro implies that there must not be any other macro hiding
 
35
   the declaration of FUNCTION; but undefining FUNCTION first is part
 
36
   of the poisoning process anyway (although for symbols that are
 
37
   provided only via a macro, the result is a compilation error rather
 
38
   than a warning containing "literal string").  Also note that in
 
39
   C++, it is only safe to use if FUNCTION has no overloads.
 
40
 
 
41
   For an example, it is possible to poison 'getline' by:
 
42
   - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
 
43
     [getline]) in configure.ac, which potentially defines
 
44
     HAVE_RAW_DECL_GETLINE
 
45
   - adding this code to a header that wraps the system <stdio.h>:
 
46
     #undef getline
 
47
     #if HAVE_RAW_DECL_GETLINE
 
48
     _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
 
49
       "not universally present; use the gnulib module getline");
 
50
     #endif
 
51
 
 
52
   It is not possible to directly poison global variables.  But it is
 
53
   possible to write a wrapper accessor function, and poison that
 
54
   (less common usage, like &environ, will cause a compilation error
 
55
   rather than issue the nice warning, but the end result of informing
 
56
   the developer about their portability problem is still achieved):
 
57
   #if HAVE_RAW_DECL_ENVIRON
 
58
   static inline char ***rpl_environ (void) { return &environ; }
 
59
   _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
 
60
   # undef environ
 
61
   # define environ (*rpl_environ ())
 
62
   #endif
 
63
   */
 
64
#ifndef _GL_WARN_ON_USE
 
65
 
 
66
# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
 
67
/* A compiler attribute is available in gcc versions 4.3.0 and later.  */
 
68
#  define _GL_WARN_ON_USE(function, message) \
 
69
extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
 
70
# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
 
71
/* Verify the existence of the function.  */
 
72
#  define _GL_WARN_ON_USE(function, message) \
 
73
extern __typeof__ (function) function
 
74
# else /* Unsupported.  */
 
75
#  define _GL_WARN_ON_USE(function, message) \
 
76
_GL_WARN_EXTERN_C int _gl_warn_on_use
 
77
# endif
 
78
#endif
 
79
 
 
80
/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
 
81
   is like _GL_WARN_ON_USE (function, "string"), except that the function is
 
82
   declared with the given prototype, consisting of return type, parameters,
 
83
   and attributes.
 
84
   This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
 
85
   not work in this case.  */
 
86
#ifndef _GL_WARN_ON_USE_CXX
 
87
# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
 
88
#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
 
89
extern rettype function parameters_and_attributes \
 
90
     __attribute__ ((__warning__ (msg)))
 
91
# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
 
92
/* Verify the existence of the function.  */
 
93
#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
 
94
extern rettype function parameters_and_attributes
 
95
# else /* Unsupported.  */
 
96
#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
 
97
_GL_WARN_EXTERN_C int _gl_warn_on_use
 
98
# endif
 
99
#endif
 
100
 
 
101
/* _GL_WARN_EXTERN_C declaration;
 
102
   performs the declaration with C linkage.  */
 
103
#ifndef _GL_WARN_EXTERN_C
 
104
# if defined __cplusplus
 
105
#  define _GL_WARN_EXTERN_C extern "C"
 
106
# else
 
107
#  define _GL_WARN_EXTERN_C extern
 
108
# endif
 
109
#endif