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

« back to all changes in this revision

Viewing changes to build-aux/c++defs.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
/* C++ compatible function declaration macros.
 
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
#ifndef _GL_CXXDEFS_H
 
18
#define _GL_CXXDEFS_H
 
19
 
 
20
/* The three most frequent use cases of these macros are:
 
21
 
 
22
   * For providing a substitute for a function that is missing on some
 
23
     platforms, but is declared and works fine on the platforms on which
 
24
     it exists:
 
25
 
 
26
       #if @GNULIB_FOO@
 
27
       # if !@HAVE_FOO@
 
28
       _GL_FUNCDECL_SYS (foo, ...);
 
29
       # endif
 
30
       _GL_CXXALIAS_SYS (foo, ...);
 
31
       _GL_CXXALIASWARN (foo);
 
32
       #elif defined GNULIB_POSIXCHECK
 
33
       ...
 
34
       #endif
 
35
 
 
36
   * For providing a replacement for a function that exists on all platforms,
 
37
     but is broken/insufficient and needs to be replaced on some platforms:
 
38
 
 
39
       #if @GNULIB_FOO@
 
40
       # if @REPLACE_FOO@
 
41
       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
42
       #   undef foo
 
43
       #   define foo rpl_foo
 
44
       #  endif
 
45
       _GL_FUNCDECL_RPL (foo, ...);
 
46
       _GL_CXXALIAS_RPL (foo, ...);
 
47
       # else
 
48
       _GL_CXXALIAS_SYS (foo, ...);
 
49
       # endif
 
50
       _GL_CXXALIASWARN (foo);
 
51
       #elif defined GNULIB_POSIXCHECK
 
52
       ...
 
53
       #endif
 
54
 
 
55
   * For providing a replacement for a function that exists on some platforms
 
56
     but is broken/insufficient and needs to be replaced on some of them and
 
57
     is additionally either missing or undeclared on some other platforms:
 
58
 
 
59
       #if @GNULIB_FOO@
 
60
       # if @REPLACE_FOO@
 
61
       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 
62
       #   undef foo
 
63
       #   define foo rpl_foo
 
64
       #  endif
 
65
       _GL_FUNCDECL_RPL (foo, ...);
 
66
       _GL_CXXALIAS_RPL (foo, ...);
 
67
       # else
 
68
       #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
 
69
       _GL_FUNCDECL_SYS (foo, ...);
 
70
       #  endif
 
71
       _GL_CXXALIAS_SYS (foo, ...);
 
72
       # endif
 
73
       _GL_CXXALIASWARN (foo);
 
74
       #elif defined GNULIB_POSIXCHECK
 
75
       ...
 
76
       #endif
 
77
*/
 
78
 
 
79
/* _GL_EXTERN_C declaration;
 
80
   performs the declaration with C linkage.  */
 
81
#if defined __cplusplus
 
82
# define _GL_EXTERN_C extern "C"
 
83
#else
 
84
# define _GL_EXTERN_C extern
 
85
#endif
 
86
 
 
87
/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
 
88
   declares a replacement function, named rpl_func, with the given prototype,
 
89
   consisting of return type, parameters, and attributes.
 
90
   Example:
 
91
     _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
 
92
                                  _GL_ARG_NONNULL ((1)));
 
93
 */
 
94
#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
 
95
  _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
 
96
#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
 
97
  _GL_EXTERN_C rettype rpl_func parameters_and_attributes
 
98
 
 
99
/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
 
100
   declares the system function, named func, with the given prototype,
 
101
   consisting of return type, parameters, and attributes.
 
102
   Example:
 
103
     _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
 
104
                                  _GL_ARG_NONNULL ((1)));
 
105
 */
 
106
#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
 
107
  _GL_EXTERN_C rettype func parameters_and_attributes
 
108
 
 
109
/* _GL_CXXALIAS_RPL (func, rettype, parameters);
 
110
   declares a C++ alias called GNULIB_NAMESPACE::func
 
111
   that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
 
112
   Example:
 
113
     _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
 
114
 */
 
115
#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
 
116
  _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
 
117
#if defined __cplusplus && defined GNULIB_NAMESPACE
 
118
# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
 
119
    namespace GNULIB_NAMESPACE                                \
 
120
    {                                                         \
 
121
      rettype (*const func) parameters = ::rpl_func;          \
 
122
    }                                                         \
 
123
    _GL_EXTERN_C int _gl_cxxalias_dummy
 
124
#else
 
125
# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
 
126
    _GL_EXTERN_C int _gl_cxxalias_dummy
 
127
#endif
 
128
 
 
129
/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
 
130
   is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
 
131
   except that the C function rpl_func may have a slightly different
 
132
   declaration.  A cast is used to silence the "invalid conversion" error
 
133
   that would otherwise occur.  */
 
134
#if defined __cplusplus && defined GNULIB_NAMESPACE
 
135
# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
 
136
    namespace GNULIB_NAMESPACE                                     \
 
137
    {                                                              \
 
138
      rettype (*const func) parameters =                           \
 
139
        reinterpret_cast<rettype(*)parameters>(::rpl_func);        \
 
140
    }                                                              \
 
141
    _GL_EXTERN_C int _gl_cxxalias_dummy
 
142
#else
 
143
# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
 
144
    _GL_EXTERN_C int _gl_cxxalias_dummy
 
145
#endif
 
146
 
 
147
/* _GL_CXXALIAS_SYS (func, rettype, parameters);
 
148
   declares a C++ alias called GNULIB_NAMESPACE::func
 
149
   that redirects to the system provided function func, if GNULIB_NAMESPACE
 
150
   is defined.
 
151
   Example:
 
152
     _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
 
153
 */
 
154
#if defined __cplusplus && defined GNULIB_NAMESPACE
 
155
  /* If we were to write
 
156
       rettype (*const func) parameters = ::func;
 
157
     like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
 
158
     better (remove an indirection through a 'static' pointer variable),
 
159
     but then the _GL_CXXALIASWARN macro below would cause a warning not only
 
160
     for uses of ::func but also for uses of GNULIB_NAMESPACE::func.  */
 
161
# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
 
162
    namespace GNULIB_NAMESPACE                     \
 
163
    {                                              \
 
164
      static rettype (*func) parameters = ::func;  \
 
165
    }                                              \
 
166
    _GL_EXTERN_C int _gl_cxxalias_dummy
 
167
#else
 
168
# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
 
169
    _GL_EXTERN_C int _gl_cxxalias_dummy
 
170
#endif
 
171
 
 
172
/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
 
173
   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
 
174
   except that the C function func may have a slightly different declaration.
 
175
   A cast is used to silence the "invalid conversion" error that would
 
176
   otherwise occur.  */
 
177
#if defined __cplusplus && defined GNULIB_NAMESPACE
 
178
# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
 
179
    namespace GNULIB_NAMESPACE                          \
 
180
    {                                                   \
 
181
      static rettype (*func) parameters =               \
 
182
        reinterpret_cast<rettype(*)parameters>(::func); \
 
183
    }                                                   \
 
184
    _GL_EXTERN_C int _gl_cxxalias_dummy
 
185
#else
 
186
# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
 
187
    _GL_EXTERN_C int _gl_cxxalias_dummy
 
188
#endif
 
189
 
 
190
/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
 
191
   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
 
192
   except that the C function is picked among a set of overloaded functions,
 
193
   namely the one with rettype2 and parameters2.  Two consecutive casts
 
194
   are used to silence the "cannot find a match" and "invalid conversion"
 
195
   errors that would otherwise occur.  */
 
196
#if defined __cplusplus && defined GNULIB_NAMESPACE
 
197
  /* The outer cast must be a reinterpret_cast.
 
198
     The inner cast: When the function is defined as a set of overloaded
 
199
     functions, it works as a static_cast<>, choosing the designated variant.
 
200
     When the function is defined as a single variant, it works as a
 
201
     reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
 
202
# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
 
203
    namespace GNULIB_NAMESPACE                                                \
 
204
    {                                                                         \
 
205
      static rettype (*func) parameters =                                     \
 
206
        reinterpret_cast<rettype(*)parameters>(                               \
 
207
          (rettype2(*)parameters2)(::func));                                  \
 
208
    }                                                                         \
 
209
    _GL_EXTERN_C int _gl_cxxalias_dummy
 
210
#else
 
211
# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
 
212
    _GL_EXTERN_C int _gl_cxxalias_dummy
 
213
#endif
 
214
 
 
215
/* _GL_CXXALIASWARN (func);
 
216
   causes a warning to be emitted when ::func is used but not when
 
217
   GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
 
218
   variants.  */
 
219
#if defined __cplusplus && defined GNULIB_NAMESPACE
 
220
# define _GL_CXXALIASWARN(func) \
 
221
   _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
 
222
# define _GL_CXXALIASWARN_1(func,namespace) \
 
223
   _GL_CXXALIASWARN_2 (func, namespace)
 
224
/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
 
225
   we enable the warning only when not optimizing.  */
 
226
# if !__OPTIMIZE__
 
227
#  define _GL_CXXALIASWARN_2(func,namespace) \
 
228
    _GL_WARN_ON_USE (func, \
 
229
                     "The symbol ::" #func " refers to the system function. " \
 
230
                     "Use " #namespace "::" #func " instead.")
 
231
# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
 
232
#  define _GL_CXXALIASWARN_2(func,namespace) \
 
233
     extern __typeof__ (func) func
 
234
# else
 
235
#  define _GL_CXXALIASWARN_2(func,namespace) \
 
236
     _GL_EXTERN_C int _gl_cxxalias_dummy
 
237
# endif
 
238
#else
 
239
# define _GL_CXXALIASWARN(func) \
 
240
    _GL_EXTERN_C int _gl_cxxalias_dummy
 
241
#endif
 
242
 
 
243
/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
 
244
   causes a warning to be emitted when the given overloaded variant of ::func
 
245
   is used but not when GNULIB_NAMESPACE::func is used.  */
 
246
#if defined __cplusplus && defined GNULIB_NAMESPACE
 
247
# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
 
248
   _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
 
249
                        GNULIB_NAMESPACE)
 
250
# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
 
251
   _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
 
252
/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
 
253
   we enable the warning only when not optimizing.  */
 
254
# if !__OPTIMIZE__
 
255
#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
 
256
    _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
 
257
                         "The symbol ::" #func " refers to the system function. " \
 
258
                         "Use " #namespace "::" #func " instead.")
 
259
# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
 
260
#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
 
261
     extern __typeof__ (func) func
 
262
# else
 
263
#  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
 
264
     _GL_EXTERN_C int _gl_cxxalias_dummy
 
265
# endif
 
266
#else
 
267
# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
 
268
    _GL_EXTERN_C int _gl_cxxalias_dummy
 
269
#endif
 
270
 
 
271
#endif /* _GL_CXXDEFS_H */