You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

186 lines
7.3KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>Function Properties (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Function Properties (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Function Properties (GNU Compiler Collection (GCC) Internals)">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Functions.html#Functions" rel="up" title="Functions">
  30. <link href="Language_002ddependent-trees.html#Language_002ddependent-trees" rel="next" title="Language-dependent trees">
  31. <link href="Function-Basics.html#Function-Basics" rel="prev" title="Function Basics">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.indentedblock {margin-right: 0em}
  36. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  37. blockquote.smallquotation {font-size: smaller}
  38. div.display {margin-left: 3.2em}
  39. div.example {margin-left: 3.2em}
  40. div.lisp {margin-left: 3.2em}
  41. div.smalldisplay {margin-left: 3.2em}
  42. div.smallexample {margin-left: 3.2em}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style: oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nolinebreak {white-space: nowrap}
  54. span.roman {font-family: initial; font-weight: normal}
  55. span.sansserif {font-family: sans-serif; font-weight: normal}
  56. ul.no-bullet {list-style: none}
  57. -->
  58. </style>
  59. </head>
  60. <body lang="en">
  61. <a name="Function-Properties"></a>
  62. <div class="header">
  63. <p>
  64. Previous: <a href="Function-Basics.html#Function-Basics" accesskey="p" rel="prev">Function Basics</a>, Up: <a href="Functions.html#Functions" accesskey="u" rel="up">Functions</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  65. </div>
  66. <hr>
  67. <a name="Function-Properties-1"></a>
  68. <h4 class="subsection">11.8.2 Function Properties</h4>
  69. <a name="index-function-properties"></a>
  70. <a name="index-statements"></a>
  71. <p>To determine the scope of a function, you can use the
  72. <code>DECL_CONTEXT</code> macro. This macro will return the class
  73. (either a <code>RECORD_TYPE</code> or a <code>UNION_TYPE</code>) or namespace (a
  74. <code>NAMESPACE_DECL</code>) of which the function is a member. For a virtual
  75. function, this macro returns the class in which the function was
  76. actually defined, not the base class in which the virtual declaration
  77. occurred.
  78. </p>
  79. <p>In C, the <code>DECL_CONTEXT</code> for a function maybe another function.
  80. This representation indicates that the GNU nested function extension
  81. is in use. For details on the semantics of nested functions, see the
  82. GCC Manual. The nested function can refer to local variables in its
  83. containing function. Such references are not explicitly marked in the
  84. tree structure; back ends must look at the <code>DECL_CONTEXT</code> for the
  85. referenced <code>VAR_DECL</code>. If the <code>DECL_CONTEXT</code> for the
  86. referenced <code>VAR_DECL</code> is not the same as the function currently
  87. being processed, and neither <code>DECL_EXTERNAL</code> nor
  88. <code>TREE_STATIC</code> hold, then the reference is to a local variable in
  89. a containing function, and the back end must take appropriate action.
  90. </p>
  91. <dl compact="compact">
  92. <dt><code>DECL_EXTERNAL</code>
  93. <a name="index-DECL_005fEXTERNAL-1"></a>
  94. </dt>
  95. <dd><p>This predicate holds if the function is undefined.
  96. </p>
  97. </dd>
  98. <dt><code>TREE_PUBLIC</code>
  99. <a name="index-TREE_005fPUBLIC-1"></a>
  100. </dt>
  101. <dd><p>This predicate holds if the function has external linkage.
  102. </p>
  103. </dd>
  104. <dt><code>TREE_STATIC</code>
  105. <a name="index-TREE_005fSTATIC"></a>
  106. </dt>
  107. <dd><p>This predicate holds if the function has been defined.
  108. </p>
  109. </dd>
  110. <dt><code>TREE_THIS_VOLATILE</code>
  111. <a name="index-TREE_005fTHIS_005fVOLATILE"></a>
  112. </dt>
  113. <dd><p>This predicate holds if the function does not return normally.
  114. </p>
  115. </dd>
  116. <dt><code>TREE_READONLY</code>
  117. <a name="index-TREE_005fREADONLY"></a>
  118. </dt>
  119. <dd><p>This predicate holds if the function can only read its arguments.
  120. </p>
  121. </dd>
  122. <dt><code>DECL_PURE_P</code>
  123. <a name="index-DECL_005fPURE_005fP"></a>
  124. </dt>
  125. <dd><p>This predicate holds if the function can only read its arguments, but
  126. may also read global memory.
  127. </p>
  128. </dd>
  129. <dt><code>DECL_VIRTUAL_P</code>
  130. <a name="index-DECL_005fVIRTUAL_005fP"></a>
  131. </dt>
  132. <dd><p>This predicate holds if the function is virtual.
  133. </p>
  134. </dd>
  135. <dt><code>DECL_ARTIFICIAL</code>
  136. <a name="index-DECL_005fARTIFICIAL-2"></a>
  137. </dt>
  138. <dd><p>This macro holds if the function was implicitly generated by the
  139. compiler, rather than explicitly declared. In addition to implicitly
  140. generated class member functions, this macro holds for the special
  141. functions created to implement static initialization and destruction, to
  142. compute run-time type information, and so forth.
  143. </p>
  144. </dd>
  145. <dt><code>DECL_FUNCTION_SPECIFIC_TARGET</code>
  146. <a name="index-DECL_005fFUNCTION_005fSPECIFIC_005fTARGET-1"></a>
  147. </dt>
  148. <dd><p>This macro returns a tree node that holds the target options that are
  149. to be used to compile this particular function or <code>NULL_TREE</code> if
  150. the function is to be compiled with the target options specified on
  151. the command line.
  152. </p>
  153. </dd>
  154. <dt><code>DECL_FUNCTION_SPECIFIC_OPTIMIZATION</code>
  155. <a name="index-DECL_005fFUNCTION_005fSPECIFIC_005fOPTIMIZATION-1"></a>
  156. </dt>
  157. <dd><p>This macro returns a tree node that holds the optimization options
  158. that are to be used to compile this particular function or
  159. <code>NULL_TREE</code> if the function is to be compiled with the
  160. optimization options specified on the command line.
  161. </p>
  162. </dd>
  163. </dl>
  164. <hr>
  165. <div class="header">
  166. <p>
  167. Previous: <a href="Function-Basics.html#Function-Basics" accesskey="p" rel="prev">Function Basics</a>, Up: <a href="Functions.html#Functions" accesskey="u" rel="up">Functions</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  168. </div>
  169. </body>
  170. </html>