1 /* Symbol table manager for Bison.
3 Copyright (C) 1984, 1989, 2000, 2001, 2002, 2004, 2005, 2006, 2007,
5 Free Software Foundation, Inc.
7 This file is part of Bison, the GNU Compiler Compiler.
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
32 /*-------------------------------------------------------------------.
33 | Symbols sorted by tag. Allocated by the first invocation of |
34 | symbols_do, after which no more symbols should be created. |
35 `-------------------------------------------------------------------*/
37 static symbol
**symbols_sorted
= NULL
;
39 /*------------------------.
40 | Distinguished symbols. |
41 `------------------------*/
43 symbol
*errtoken
= NULL
;
44 symbol
*undeftoken
= NULL
;
45 symbol
*endtoken
= NULL
;
46 symbol
*accept
= NULL
;
47 symbol
*startsymbol
= NULL
;
48 location startsymbol_location
;
50 /*---------------------------------------.
51 | Default %destructor's and %printer's. |
52 `---------------------------------------*/
54 static code_props default_tagged_destructor
= CODE_PROPS_NONE_INIT
;
55 static code_props default_tagless_destructor
= CODE_PROPS_NONE_INIT
;
56 static code_props default_tagged_printer
= CODE_PROPS_NONE_INIT
;
57 static code_props default_tagless_printer
= CODE_PROPS_NONE_INIT
;
59 /*---------------------------------.
60 | Create a new symbol, named TAG. |
61 `---------------------------------*/
64 symbol_new (uniqstr tag
, location loc
)
66 symbol
*res
= xmalloc (sizeof *res
);
70 /* If the tag is not a string (starts with a double quote), check
71 that it is valid for Yacc. */
72 if (tag
[0] != '\"' && tag
[0] != '\'' && strchr (tag
, '-'))
73 yacc_at (loc
, _("POSIX Yacc forbids dashes in symbol names: %s"),
79 res
->type_name
= NULL
;
80 code_props_none_init (&res
->destructor
);
81 code_props_none_init (&res
->printer
);
83 res
->number
= NUMBER_UNDEFINED
;
85 res
->assoc
= undef_assoc
;
86 res
->user_token_number
= USER_NUMBER_UNDEFINED
;
89 res
->class = unknown_sym
;
90 res
->declared
= false;
92 if (nsyms
== SYMBOL_NUMBER_MAXIMUM
)
93 fatal (_("too many symbols in input grammar (limit is %d)"),
94 SYMBOL_NUMBER_MAXIMUM
);
99 /*----------------------------------------.
100 | Create a new semantic type, named TAG. |
101 `----------------------------------------*/
103 static semantic_type
*
104 semantic_type_new (uniqstr tag
)
106 semantic_type
*res
= xmalloc (sizeof *res
);
108 uniqstr_assert (tag
);
110 code_props_none_init (&res
->destructor
);
111 code_props_none_init (&res
->printer
);
121 #define SYMBOL_ATTR_PRINT(Attr) \
123 fprintf (f, " %s { %s }", #Attr, s->Attr)
125 #define SYMBOL_CODE_PRINT(Attr) \
127 fprintf (f, " %s { %s }", #Attr, s->Attr.code)
130 symbol_print (symbol
*s
, FILE *f
)
134 fprintf (f
, "\"%s\"", s
->tag
);
135 SYMBOL_ATTR_PRINT (type_name
);
136 SYMBOL_CODE_PRINT (destructor
);
137 SYMBOL_CODE_PRINT (printer
);
140 fprintf (f
, "<NULL>");
143 #undef SYMBOL_ATTR_PRINT
144 #undef SYMBOL_CODE_PRINT
147 /*----------------------------------.
148 | Whether S is a valid identifier. |
149 `----------------------------------*/
152 is_identifier (uniqstr s
)
154 static char const alphanum
[26 + 26 + 1 + 10] =
155 "abcdefghijklmnopqrstuvwxyz"
156 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
159 if (!s
|| ! memchr (alphanum
, *s
, sizeof alphanum
- 10))
162 if (! memchr (alphanum
, *s
, sizeof alphanum
))
168 /*-----------------------------------------------.
169 | Get the identifier associated to this symbol. |
170 `-----------------------------------------------*/
172 symbol_id_get (symbol
const *sym
)
174 aver (sym
->user_token_number
!= USER_NUMBER_HAS_STRING_ALIAS
);
177 return is_identifier (sym
->tag
) ? sym
->tag
: 0;
181 /*------------------------------------------------------------------.
182 | Complain that S's WHAT is redeclared at SECOND, and was first set |
184 `------------------------------------------------------------------*/
187 symbol_redeclaration (symbol
*s
, const char *what
, location first
,
190 complain_at (second
, _("%s redeclaration for %s"), what
, s
->tag
);
191 complain_at (first
, _("previous declaration"));
195 semantic_type_redeclaration (semantic_type
*s
, const char *what
, location first
,
198 complain_at (second
, _("%s redeclaration for <%s>"), what
, s
->tag
);
199 complain_at (first
, _("previous declaration"));
204 /*-----------------------------------------------------------------.
205 | Set the TYPE_NAME associated with SYM. Does nothing if passed 0 |
207 `-----------------------------------------------------------------*/
210 symbol_type_set (symbol
*sym
, uniqstr type_name
, location loc
)
215 symbol_redeclaration (sym
, "%type", sym
->type_location
, loc
);
216 uniqstr_assert (type_name
);
217 sym
->type_name
= type_name
;
218 sym
->type_location
= loc
;
222 /*-----------------------------------.
223 | Get the CLASS associated with SYM. |
224 `-----------------------------------*/
227 symbol_class_get_string (symbol
*sym
)
231 if (sym
->class == token_sym
)
233 else if (sym
->class == nterm_sym
)
234 return "nonterminal";
240 /*-----------------------------------------.
241 | Set the DESTRUCTOR associated with SYM. |
242 `-----------------------------------------*/
245 symbol_destructor_set (symbol
*sym
, code_props
const *destructor
)
247 if (sym
->destructor
.code
)
248 symbol_redeclaration (sym
, "%destructor", sym
->destructor
.location
,
249 destructor
->location
);
250 sym
->destructor
= *destructor
;
253 /*------------------------------------------.
254 | Set the DESTRUCTOR associated with TYPE. |
255 `------------------------------------------*/
258 semantic_type_destructor_set (semantic_type
*type
,
259 code_props
const *destructor
)
261 if (type
->destructor
.code
)
262 semantic_type_redeclaration (type
, "%destructor",
263 type
->destructor
.location
,
264 destructor
->location
);
265 type
->destructor
= *destructor
;
268 /*---------------------------------------.
269 | Get the computed %destructor for SYM. |
270 `---------------------------------------*/
273 symbol_destructor_get (symbol
const *sym
)
275 /* Per-symbol %destructor. */
276 if (sym
->destructor
.code
)
277 return &sym
->destructor
;
279 /* Per-type %destructor. */
282 code_props
const *destructor
=
283 &semantic_type_get (sym
->type_name
)->destructor
;
284 if (destructor
->code
)
288 /* Apply default %destructor's only to user-defined symbols. */
289 if (sym
->tag
[0] == '$' || sym
== errtoken
)
290 return &code_props_none
;
293 return &default_tagged_destructor
;
294 return &default_tagless_destructor
;
297 /*--------------------------------------.
298 | Set the PRINTER associated with SYM. |
299 `--------------------------------------*/
302 symbol_printer_set (symbol
*sym
, code_props
const *printer
)
304 if (sym
->printer
.code
)
305 symbol_redeclaration (sym
, "%printer",
306 sym
->printer
.location
, printer
->location
);
307 sym
->printer
= *printer
;
310 /*---------------------------------------.
311 | Set the PRINTER associated with TYPE. |
312 `---------------------------------------*/
315 semantic_type_printer_set (semantic_type
*type
, code_props
const *printer
)
317 if (type
->printer
.code
)
318 semantic_type_redeclaration (type
, "%printer",
319 type
->printer
.location
, printer
->location
);
320 type
->printer
= *printer
;
323 /*------------------------------------.
324 | Get the computed %printer for SYM. |
325 `------------------------------------*/
328 symbol_printer_get (symbol
const *sym
)
330 /* Per-symbol %printer. */
331 if (sym
->printer
.code
)
332 return &sym
->printer
;
334 /* Per-type %printer. */
337 code_props
const *printer
= &semantic_type_get (sym
->type_name
)->printer
;
342 /* Apply the default %printer only to user-defined symbols. */
343 if (sym
->tag
[0] == '$' || sym
== errtoken
)
344 return &code_props_none
;
347 return &default_tagged_printer
;
348 return &default_tagless_printer
;
351 /*-----------------------------------------------------------------.
352 | Set the PRECEDENCE associated with SYM. Does nothing if invoked |
353 | with UNDEF_ASSOC as ASSOC. |
354 `-----------------------------------------------------------------*/
357 symbol_precedence_set (symbol
*sym
, int prec
, assoc a
, location loc
)
359 if (a
!= undef_assoc
)
362 symbol_redeclaration (sym
, assoc_to_string (a
), sym
->prec_location
,
366 sym
->prec_location
= loc
;
369 /* Only terminals have a precedence. */
370 symbol_class_set (sym
, token_sym
, loc
, false);
374 /*------------------------------------.
375 | Set the CLASS associated with SYM. |
376 `------------------------------------*/
379 symbol_class_set (symbol
*sym
, symbol_class
class, location loc
, bool declaring
)
381 if (sym
->class != unknown_sym
&& sym
->class != class)
383 complain_at (loc
, _("symbol %s redefined"), sym
->tag
);
384 sym
->declared
= false;
387 if (class == nterm_sym
&& sym
->class != nterm_sym
)
388 sym
->number
= nvars
++;
389 else if (class == token_sym
&& sym
->number
== NUMBER_UNDEFINED
)
390 sym
->number
= ntokens
++;
397 warn_at (loc
, _("symbol %s redeclared"), sym
->tag
);
398 sym
->declared
= true;
403 /*------------------------------------------------.
404 | Set the USER_TOKEN_NUMBER associated with SYM. |
405 `------------------------------------------------*/
408 symbol_user_token_number_set (symbol
*sym
, int user_token_number
, location loc
)
410 int *user_token_numberp
;
412 if (sym
->user_token_number
!= USER_NUMBER_HAS_STRING_ALIAS
)
413 user_token_numberp
= &sym
->user_token_number
;
415 user_token_numberp
= &sym
->alias
->user_token_number
;
416 if (*user_token_numberp
!= USER_NUMBER_UNDEFINED
417 && *user_token_numberp
!= user_token_number
)
418 complain_at (loc
, _("redefining user token number of %s"), sym
->tag
);
420 *user_token_numberp
= user_token_number
;
421 /* User defined $end token? */
422 if (user_token_number
== 0)
425 endtoken
->number
= 0;
426 /* It is always mapped to 0, so it was already counted in
433 /*----------------------------------------------------------.
434 | If SYM is not defined, report an error, and consider it a |
436 `----------------------------------------------------------*/
439 symbol_check_defined (symbol
*sym
)
441 if (sym
->class == unknown_sym
)
445 _("symbol %s is used, but is not defined as a token and has no rules"),
447 sym
->class = nterm_sym
;
448 sym
->number
= nvars
++;
455 symbol_check_defined_processor (void *sym
, void *null ATTRIBUTE_UNUSED
)
457 return symbol_check_defined (sym
);
462 symbol_make_alias (symbol
*sym
, symbol
*str
, location loc
)
465 warn_at (loc
, _("symbol `%s' used more than once as a literal string"),
468 warn_at (loc
, _("symbol `%s' given more than one literal string"),
472 str
->class = token_sym
;
473 str
->user_token_number
= sym
->user_token_number
;
474 sym
->user_token_number
= USER_NUMBER_HAS_STRING_ALIAS
;
477 str
->number
= sym
->number
;
478 symbol_type_set (str
, sym
->type_name
, loc
);
483 /*---------------------------------------------------------.
484 | Check that THIS, and its alias, have same precedence and |
486 `---------------------------------------------------------*/
489 symbol_check_alias_consistency (symbol
*this)
492 symbol
*str
= this->alias
;
494 /* Check only the symbol in the symbol-string pair. */
496 && this->user_token_number
== USER_NUMBER_HAS_STRING_ALIAS
))
499 if (str
->type_name
!= sym
->type_name
)
502 symbol_type_set (sym
, str
->type_name
, str
->type_location
);
504 symbol_type_set (str
, sym
->type_name
, sym
->type_location
);
508 if (str
->destructor
.code
|| sym
->destructor
.code
)
510 if (str
->destructor
.code
)
511 symbol_destructor_set (sym
, &str
->destructor
);
513 symbol_destructor_set (str
, &sym
->destructor
);
516 if (str
->printer
.code
|| sym
->printer
.code
)
518 if (str
->printer
.code
)
519 symbol_printer_set (sym
, &str
->printer
);
521 symbol_printer_set (str
, &sym
->printer
);
524 if (sym
->prec
|| str
->prec
)
527 symbol_precedence_set (sym
, str
->prec
, str
->assoc
,
530 symbol_precedence_set (str
, sym
->prec
, sym
->assoc
,
536 symbol_check_alias_consistency_processor (void *this,
537 void *null ATTRIBUTE_UNUSED
)
539 symbol_check_alias_consistency (this);
544 /*-------------------------------------------------------------------.
545 | Assign a symbol number, and write the definition of the token name |
546 | into FDEFINES. Put in SYMBOLS. |
547 `-------------------------------------------------------------------*/
550 symbol_pack (symbol
*this)
552 aver (this->number
!= NUMBER_UNDEFINED
);
553 if (this->class == nterm_sym
)
554 this->number
+= ntokens
;
555 else if (this->user_token_number
== USER_NUMBER_HAS_STRING_ALIAS
)
558 symbols
[this->number
] = this;
563 symbol_pack_processor (void *this, void *null ATTRIBUTE_UNUSED
)
565 return symbol_pack (this);
570 user_token_number_redeclaration (int num
, symbol
*first
, symbol
*second
)
572 /* User token numbers are not assigned during the parsing, but in a
573 second step, via a traversal of the symbol table sorted on tag.
575 However, error messages make more sense if we keep the first
576 declaration first. */
577 if (location_cmp (first
->location
, second
->location
) > 0)
583 complain_at (second
->location
,
584 _("user token number %d redeclaration for %s"),
586 complain_at (first
->location
, _("previous declaration for %s"),
590 /*--------------------------------------------------.
591 | Put THIS in TOKEN_TRANSLATIONS if it is a token. |
592 `--------------------------------------------------*/
595 symbol_translation (symbol
*this)
598 if (this->class == token_sym
599 && this->user_token_number
!= USER_NUMBER_HAS_STRING_ALIAS
)
601 /* A token which translation has already been set? */
602 if (token_translations
[this->user_token_number
] != undeftoken
->number
)
603 user_token_number_redeclaration
604 (this->user_token_number
,
605 symbols
[token_translations
[this->user_token_number
]],
608 token_translations
[this->user_token_number
] = this->number
;
615 symbol_translation_processor (void *this, void *null ATTRIBUTE_UNUSED
)
617 return symbol_translation (this);
621 /*---------------------------------------.
622 | Symbol and semantic type hash tables. |
623 `---------------------------------------*/
625 /* Initial capacity of symbol and semantic type hash table. */
626 #define HT_INITIAL_CAPACITY 257
628 static struct hash_table
*symbol_table
= NULL
;
629 static struct hash_table
*semantic_type_table
= NULL
;
632 hash_compare_symbol (const symbol
*m1
, const symbol
*m2
)
634 /* Since tags are unique, we can compare the pointers themselves. */
635 return UNIQSTR_EQ (m1
->tag
, m2
->tag
);
639 hash_compare_semantic_type (const semantic_type
*m1
, const semantic_type
*m2
)
641 /* Since names are unique, we can compare the pointers themselves. */
642 return UNIQSTR_EQ (m1
->tag
, m2
->tag
);
646 hash_symbol_comparator (void const *m1
, void const *m2
)
648 return hash_compare_symbol (m1
, m2
);
652 hash_semantic_type_comparator (void const *m1
, void const *m2
)
654 return hash_compare_semantic_type (m1
, m2
);
658 hash_symbol (const symbol
*m
, size_t tablesize
)
660 /* Since tags are unique, we can hash the pointer itself. */
661 return ((uintptr_t) m
->tag
) % tablesize
;
665 hash_semantic_type (const semantic_type
*m
, size_t tablesize
)
667 /* Since names are unique, we can hash the pointer itself. */
668 return ((uintptr_t) m
->tag
) % tablesize
;
672 hash_symbol_hasher (void const *m
, size_t tablesize
)
674 return hash_symbol (m
, tablesize
);
678 hash_semantic_type_hasher (void const *m
, size_t tablesize
)
680 return hash_semantic_type (m
, tablesize
);
683 /*-------------------------------.
684 | Create the symbol hash table. |
685 `-------------------------------*/
690 symbol_table
= hash_initialize (HT_INITIAL_CAPACITY
,
693 hash_symbol_comparator
,
695 semantic_type_table
= hash_initialize (HT_INITIAL_CAPACITY
,
697 hash_semantic_type_hasher
,
698 hash_semantic_type_comparator
,
703 /*----------------------------------------------------------------.
704 | Find the symbol named KEY, and return it. If it does not exist |
706 `----------------------------------------------------------------*/
709 symbol_from_uniqstr (const uniqstr key
, location loc
)
715 entry
= hash_lookup (symbol_table
, &probe
);
719 /* First insertion in the hash. */
720 aver (!symbols_sorted
);
721 entry
= symbol_new (key
, loc
);
722 if (!hash_insert (symbol_table
, entry
))
729 /*-----------------------------------------------------------------------.
730 | Find the semantic type named KEY, and return it. If it does not exist |
732 `-----------------------------------------------------------------------*/
735 semantic_type_from_uniqstr (const uniqstr key
)
738 semantic_type
*entry
;
741 entry
= hash_lookup (semantic_type_table
, &probe
);
745 /* First insertion in the hash. */
746 entry
= semantic_type_new (key
);
747 if (!hash_insert (semantic_type_table
, entry
))
754 /*----------------------------------------------------------------.
755 | Find the symbol named KEY, and return it. If it does not exist |
757 `----------------------------------------------------------------*/
760 symbol_get (const char *key
, location loc
)
762 return symbol_from_uniqstr (uniqstr_new (key
), loc
);
766 /*-----------------------------------------------------------------------.
767 | Find the semantic type named KEY, and return it. If it does not exist |
769 `-----------------------------------------------------------------------*/
772 semantic_type_get (const char *key
)
774 return semantic_type_from_uniqstr (uniqstr_new (key
));
778 /*------------------------------------------------------------------.
779 | Generate a dummy nonterminal, whose name cannot conflict with the |
781 `------------------------------------------------------------------*/
784 dummy_symbol_get (location loc
)
786 /* Incremented for each generated symbol. */
787 static int dummy_count
= 0;
788 static char buf
[256];
792 sprintf (buf
, "$@%d", ++dummy_count
);
793 sym
= symbol_get (buf
, loc
);
794 sym
->class = nterm_sym
;
795 sym
->number
= nvars
++;
800 symbol_is_dummy (const symbol
*sym
)
802 return sym
->tag
[0] == '@' || (sym
->tag
[0] == '$' && sym
->tag
[1] == '@');
805 /*-------------------.
806 | Free the symbols. |
807 `-------------------*/
812 hash_free (symbol_table
);
813 hash_free (semantic_type_table
);
815 free (symbols_sorted
);
819 /*---------------------------------------------------------------.
820 | Look for undefined symbols, report an error, and consider them |
822 `---------------------------------------------------------------*/
825 symbols_cmp (symbol
const *a
, symbol
const *b
)
827 return strcmp (a
->tag
, b
->tag
);
831 symbols_cmp_qsort (void const *a
, void const *b
)
833 return symbols_cmp (*(symbol
* const *)a
, *(symbol
* const *)b
);
837 symbols_do (Hash_processor processor
, void *processor_data
)
839 size_t count
= hash_get_n_entries (symbol_table
);
842 symbols_sorted
= xnmalloc (count
, sizeof *symbols_sorted
);
843 hash_get_entries (symbol_table
, (void**)symbols_sorted
, count
);
844 qsort (symbols_sorted
, count
, sizeof *symbols_sorted
,
849 for (i
= 0; i
< count
; ++i
)
850 processor (symbols_sorted
[i
], processor_data
);
854 /*--------------------------------------------------------------.
855 | Check that all the symbols are defined. Report any undefined |
856 | symbols and consider them nonterminals. |
857 `--------------------------------------------------------------*/
860 symbols_check_defined (void)
862 symbols_do (symbol_check_defined_processor
, NULL
);
865 /*------------------------------------------------------------------.
866 | Set TOKEN_TRANSLATIONS. Check that no two symbols share the same |
868 `------------------------------------------------------------------*/
871 symbols_token_translations_init (void)
873 bool num_256_available_p
= true;
876 /* Find the highest user token number, and whether 256, the POSIX
877 preferred user token number for the error token, is used. */
878 max_user_token_number
= 0;
879 for (i
= 0; i
< ntokens
; ++i
)
881 symbol
*this = symbols
[i
];
882 if (this->user_token_number
!= USER_NUMBER_UNDEFINED
)
884 if (this->user_token_number
> max_user_token_number
)
885 max_user_token_number
= this->user_token_number
;
886 if (this->user_token_number
== 256)
887 num_256_available_p
= false;
891 /* If 256 is not used, assign it to error, to follow POSIX. */
892 if (num_256_available_p
893 && errtoken
->user_token_number
== USER_NUMBER_UNDEFINED
)
894 errtoken
->user_token_number
= 256;
896 /* Set the missing user numbers. */
897 if (max_user_token_number
< 256)
898 max_user_token_number
= 256;
900 for (i
= 0; i
< ntokens
; ++i
)
902 symbol
*this = symbols
[i
];
903 if (this->user_token_number
== USER_NUMBER_UNDEFINED
)
904 this->user_token_number
= ++max_user_token_number
;
905 if (this->user_token_number
> max_user_token_number
)
906 max_user_token_number
= this->user_token_number
;
909 token_translations
= xnmalloc (max_user_token_number
+ 1,
910 sizeof *token_translations
);
912 /* Initialize all entries for literal tokens to the internal token
913 number for $undefined, which represents all invalid inputs. */
914 for (i
= 0; i
< max_user_token_number
+ 1; i
++)
915 token_translations
[i
] = undeftoken
->number
;
916 symbols_do (symbol_translation_processor
, NULL
);
920 /*----------------------------------------------------------------.
921 | Assign symbol numbers, and write definition of token names into |
922 | FDEFINES. Set up vectors SYMBOL_TABLE, TAGS of symbols. |
923 `----------------------------------------------------------------*/
928 symbols_do (symbol_check_alias_consistency_processor
, NULL
);
930 symbols
= xcalloc (nsyms
, sizeof *symbols
);
931 symbols_do (symbol_pack_processor
, NULL
);
933 /* Aliases leave empty slots in symbols, so remove them. */
937 int nsyms_old
= nsyms
;
938 for (writei
= 0, readi
= 0; readi
< nsyms_old
; readi
+= 1)
940 if (symbols
[readi
] == NULL
)
947 symbols
[writei
] = symbols
[readi
];
948 symbols
[writei
]->number
= writei
;
949 if (symbols
[writei
]->alias
)
950 symbols
[writei
]->alias
->number
= writei
;
955 symbols
= xnrealloc (symbols
, nsyms
, sizeof *symbols
);
957 symbols_token_translations_init ();
959 if (startsymbol
->class == unknown_sym
)
960 fatal_at (startsymbol_location
,
961 _("the start symbol %s is undefined"),
963 else if (startsymbol
->class == token_sym
)
964 fatal_at (startsymbol_location
,
965 _("the start symbol %s is a token"),
970 /*--------------------------------------------------.
971 | Set default tagged/tagless %destructor/%printer. |
972 `--------------------------------------------------*/
975 default_tagged_destructor_set (code_props
const *destructor
)
977 if (default_tagged_destructor
.code
)
979 complain_at (destructor
->location
,
980 _("redeclaration for default tagged %%destructor"));
981 complain_at (default_tagged_destructor
.location
,
982 _("previous declaration"));
984 default_tagged_destructor
= *destructor
;
988 default_tagless_destructor_set (code_props
const *destructor
)
990 if (default_tagless_destructor
.code
)
992 complain_at (destructor
->location
,
993 _("redeclaration for default tagless %%destructor"));
994 complain_at (default_tagless_destructor
.location
,
995 _("previous declaration"));
997 default_tagless_destructor
= *destructor
;
1001 default_tagged_printer_set (code_props
const *printer
)
1003 if (default_tagged_printer
.code
)
1005 complain_at (printer
->location
,
1006 _("redeclaration for default tagged %%printer"));
1007 complain_at (default_tagged_printer
.location
,
1008 _("previous declaration"));
1010 default_tagged_printer
= *printer
;
1014 default_tagless_printer_set (code_props
const *printer
)
1016 if (default_tagless_printer
.code
)
1018 complain_at (printer
->location
,
1019 _("redeclaration for default tagless %%printer"));
1020 complain_at (default_tagless_printer
.location
,
1021 _("previous declaration"));
1023 default_tagless_printer
= *printer
;