]>
Commit | Line | Data |
---|---|---|
c63539ff ML |
1 | .. |
2 | Copyright 1988-2022 Free Software Foundation, Inc. | |
3 | This is part of the GCC manual. | |
4 | For copying conditions, see the copyright.rst file. | |
5 | ||
6 | .. index:: roots, marking, marking roots | |
7 | ||
8 | .. _ggc-roots: | |
9 | ||
10 | Marking Roots for the Garbage Collector | |
11 | *************************************** | |
12 | ||
13 | In addition to keeping track of types, the type machinery also locates | |
14 | the global variables (:dfn:`roots`) that the garbage collector starts | |
15 | at. Roots must be declared using one of the following syntaxes: | |
16 | ||
17 | * ``extern GTY(([options])) typename;`` | |
18 | ||
19 | * ``static GTY(([options])) typename;`` | |
20 | ||
21 | The syntax | |
22 | ||
23 | * ``GTY(([options])) typename;`` | |
24 | ||
25 | is *not* accepted. There should be an ``extern`` declaration | |
26 | of such a variable in a header somewhere---mark that, not the | |
27 | definition. Or, if the variable is only used in one file, make it | |
3ed1b4ce | 28 | ``static``. |