PageRenderTime 40ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/tar-1.26/build-aux/c++defs.h

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