1 /* Symbol table manager for Bison.
3 Copyright (C) 1984, 1989, 2000-2002, 2004-2012 Free Software
6 This file is part of Bison, the GNU Compiler Compiler.
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
30 /*-------------------------------------------------------------------.
31 | Symbols sorted by tag. Allocated by the first invocation of |
32 | symbols_do, after which no more symbols should be created. |
33 `-------------------------------------------------------------------*/
35 static symbol
**symbols_sorted
= NULL
;
37 /*------------------------.
38 | Distinguished symbols. |
39 `------------------------*/
41 symbol
*errtoken
= NULL
;
42 symbol
*undeftoken
= NULL
;
43 symbol
*endtoken
= NULL
;
44 symbol
*accept
= NULL
;
45 symbol
*startsymbol
= NULL
;
46 location startsymbol_location
;
48 /*---------------------------------------.
49 | Default %destructor's and %printer's. |
50 `---------------------------------------*/
52 static code_props default_tagged_destructor
= CODE_PROPS_NONE_INIT
;
53 static code_props default_tagless_destructor
= CODE_PROPS_NONE_INIT
;
54 static code_props default_tagged_printer
= CODE_PROPS_NONE_INIT
;
55 static code_props default_tagless_printer
= CODE_PROPS_NONE_INIT
;
57 /*---------------------------------.
58 | Create a new symbol, named TAG. |
59 `---------------------------------*/
62 symbol_new (uniqstr tag
, location loc
)
64 symbol
*res
= xmalloc (sizeof *res
);
68 /* If the tag is not a string (starts with a double quote), check
69 that it is valid for Yacc. */
70 if (tag
[0] != '\"' && tag
[0] != '\'' && strchr (tag
, '-'))
71 yacc_at (loc
, _("POSIX Yacc forbids dashes in symbol names: %s"),
77 res
->type_name
= NULL
;
78 code_props_none_init (&res
->destructor
);
79 code_props_none_init (&res
->printer
);
81 res
->number
= NUMBER_UNDEFINED
;
83 res
->assoc
= undef_assoc
;
84 res
->user_token_number
= USER_NUMBER_UNDEFINED
;
87 res
->class = unknown_sym
;
90 if (nsyms
== SYMBOL_NUMBER_MAXIMUM
)
91 fatal (_("too many symbols in input grammar (limit is %d)"),
92 SYMBOL_NUMBER_MAXIMUM
);
97 /*----------------------------------------.
98 | Create a new semantic type, named TAG. |
99 `----------------------------------------*/
101 static semantic_type
*
102 semantic_type_new (uniqstr tag
)
104 semantic_type
*res
= xmalloc (sizeof *res
);
106 uniqstr_assert (tag
);
108 code_props_none_init (&res
->destructor
);
109 code_props_none_init (&res
->printer
);
119 #define SYMBOL_ATTR_PRINT(Attr) \
121 fprintf (f, " %s { %s }", #Attr, s->Attr)
123 #define SYMBOL_CODE_PRINT(Attr) \
125 fprintf (f, " %s { %s }", #Attr, s->Attr.code)
128 symbol_print (symbol
*s
, FILE *f
)
132 fprintf (f
, "\"%s\"", s
->tag
);
133 SYMBOL_ATTR_PRINT (type_name
);
134 SYMBOL_CODE_PRINT (destructor
);
135 SYMBOL_CODE_PRINT (printer
);
138 fprintf (f
, "<NULL>");
141 #undef SYMBOL_ATTR_PRINT
142 #undef SYMBOL_CODE_PRINT
145 /*----------------------------------.
146 | Whether S is a valid identifier. |
147 `----------------------------------*/
150 is_identifier (uniqstr s
)
152 static char const alphanum
[26 + 26 + 1 + 10] =
153 "abcdefghijklmnopqrstuvwxyz"
154 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
157 if (!s
|| ! memchr (alphanum
, *s
, sizeof alphanum
- 10))
160 if (! memchr (alphanum
, *s
, sizeof alphanum
))
166 /*-----------------------------------------------.
167 | Get the identifier associated to this symbol. |
168 `-----------------------------------------------*/
170 symbol_id_get (symbol
const *sym
)
172 aver (sym
->user_token_number
!= USER_NUMBER_HAS_STRING_ALIAS
);
175 return is_identifier (sym
->tag
) ? sym
->tag
: 0;
179 /*------------------------------------------------------------------.
180 | Complain that S's WHAT is redeclared at SECOND, and was first set |
182 `------------------------------------------------------------------*/
185 symbol_redeclaration (symbol
*s
, const char *what
, location first
,
188 complain_at (second
, _("%s redeclaration for %s"), what
, s
->tag
);
189 complain_at (first
, _("previous declaration"));
193 semantic_type_redeclaration (semantic_type
*s
, const char *what
, location first
,
196 complain_at (second
, _("%s redeclaration for <%s>"), what
, s
->tag
);
197 complain_at (first
, _("previous declaration"));
202 /*-----------------------------------------------------------------.
203 | Set the TYPE_NAME associated with SYM. Does nothing if passed 0 |
205 `-----------------------------------------------------------------*/
208 symbol_type_set (symbol
*sym
, uniqstr type_name
, location loc
)
213 symbol_redeclaration (sym
, "%type", sym
->type_location
, loc
);
214 uniqstr_assert (type_name
);
215 sym
->type_name
= type_name
;
216 sym
->type_location
= loc
;
220 /*-----------------------------------------.
221 | Set the DESTRUCTOR associated with SYM. |
222 `-----------------------------------------*/
225 symbol_destructor_set (symbol
*sym
, code_props
const *destructor
)
227 if (sym
->destructor
.code
)
228 symbol_redeclaration (sym
, "%destructor", sym
->destructor
.location
,
229 destructor
->location
);
230 sym
->destructor
= *destructor
;
233 /*------------------------------------------.
234 | Set the DESTRUCTOR associated with TYPE. |
235 `------------------------------------------*/
238 semantic_type_destructor_set (semantic_type
*type
,
239 code_props
const *destructor
)
241 if (type
->destructor
.code
)
242 semantic_type_redeclaration (type
, "%destructor",
243 type
->destructor
.location
,
244 destructor
->location
);
245 type
->destructor
= *destructor
;
248 /*---------------------------------------.
249 | Get the computed %destructor for SYM. |
250 `---------------------------------------*/
253 symbol_destructor_get (symbol
const *sym
)
255 /* Per-symbol %destructor. */
256 if (sym
->destructor
.code
)
257 return &sym
->destructor
;
259 /* Per-type %destructor. */
262 code_props
const *destructor
=
263 &semantic_type_get (sym
->type_name
)->destructor
;
264 if (destructor
->code
)
268 /* Apply default %destructor's only to user-defined symbols. */
269 if (sym
->tag
[0] == '$' || sym
== errtoken
)
270 return &code_props_none
;
273 return &default_tagged_destructor
;
274 return &default_tagless_destructor
;
277 /*--------------------------------------.
278 | Set the PRINTER associated with SYM. |
279 `--------------------------------------*/
282 symbol_printer_set (symbol
*sym
, code_props
const *printer
)
284 if (sym
->printer
.code
)
285 symbol_redeclaration (sym
, "%printer",
286 sym
->printer
.location
, printer
->location
);
287 sym
->printer
= *printer
;
290 /*---------------------------------------.
291 | Set the PRINTER associated with TYPE. |
292 `---------------------------------------*/
295 semantic_type_printer_set (semantic_type
*type
, code_props
const *printer
)
297 if (type
->printer
.code
)
298 semantic_type_redeclaration (type
, "%printer",
299 type
->printer
.location
, printer
->location
);
300 type
->printer
= *printer
;
303 /*------------------------------------.
304 | Get the computed %printer for SYM. |
305 `------------------------------------*/
308 symbol_printer_get (symbol
const *sym
)
310 /* Per-symbol %printer. */
311 if (sym
->printer
.code
)
312 return &sym
->printer
;
314 /* Per-type %printer. */
317 code_props
const *printer
= &semantic_type_get (sym
->type_name
)->printer
;
322 /* Apply the default %printer only to user-defined symbols. */
323 if (sym
->tag
[0] == '$' || sym
== errtoken
)
324 return &code_props_none
;
327 return &default_tagged_printer
;
328 return &default_tagless_printer
;
331 /*-----------------------------------------------------------------.
332 | Set the PRECEDENCE associated with SYM. Does nothing if invoked |
333 | with UNDEF_ASSOC as ASSOC. |
334 `-----------------------------------------------------------------*/
337 symbol_precedence_set (symbol
*sym
, int prec
, assoc a
, location loc
)
339 if (a
!= undef_assoc
)
342 symbol_redeclaration (sym
, assoc_to_string (a
), sym
->prec_location
,
346 sym
->prec_location
= loc
;
349 /* Only terminals have a precedence. */
350 symbol_class_set (sym
, token_sym
, loc
, false);
354 /*------------------------------------.
355 | Set the CLASS associated with SYM. |
356 `------------------------------------*/
359 symbol_class_set (symbol
*sym
, symbol_class
class, location loc
, bool declaring
)
361 if (sym
->class != unknown_sym
&& sym
->class != class)
363 complain_at (loc
, _("symbol %s redefined"), sym
->tag
);
364 sym
->status
= needed
;
367 if (class == nterm_sym
&& sym
->class != nterm_sym
)
368 sym
->number
= nvars
++;
369 else if (class == token_sym
&& sym
->number
== NUMBER_UNDEFINED
)
370 sym
->number
= ntokens
++;
376 if (sym
->status
== declared
)
377 warn_at (loc
, _("symbol %s redeclared"), sym
->tag
);
378 sym
->status
= declared
;
383 /*------------------------------------------------.
384 | Set the USER_TOKEN_NUMBER associated with SYM. |
385 `------------------------------------------------*/
388 symbol_user_token_number_set (symbol
*sym
, int user_token_number
, location loc
)
390 int *user_token_numberp
;
392 if (sym
->user_token_number
!= USER_NUMBER_HAS_STRING_ALIAS
)
393 user_token_numberp
= &sym
->user_token_number
;
395 user_token_numberp
= &sym
->alias
->user_token_number
;
396 if (*user_token_numberp
!= USER_NUMBER_UNDEFINED
397 && *user_token_numberp
!= user_token_number
)
398 complain_at (loc
, _("redefining user token number of %s"), sym
->tag
);
400 *user_token_numberp
= user_token_number
;
401 /* User defined $end token? */
402 if (user_token_number
== 0)
405 /* It is always mapped to 0, so it was already counted in
407 if (endtoken
->number
!= NUMBER_UNDEFINED
)
409 endtoken
->number
= 0;
414 /*----------------------------------------------------------.
415 | If SYM is not defined, report an error, and consider it a |
417 `----------------------------------------------------------*/
420 symbol_check_defined (symbol
*sym
)
422 if (sym
->class == unknown_sym
)
424 if (sym
->status
== needed
)
427 _("symbol %s is used, but is not defined as a token and has no"
433 _("symbol %s is used, but is not defined as a token and has no"
437 sym
->class = nterm_sym
;
438 sym
->number
= nvars
++;
445 symbol_check_defined_processor (void *sym
, void *null ATTRIBUTE_UNUSED
)
447 return symbol_check_defined (sym
);
452 symbol_make_alias (symbol
*sym
, symbol
*str
, location loc
)
455 warn_at (loc
, _("symbol %s used more than once as a literal string"),
458 warn_at (loc
, _("symbol %s given more than one literal string"),
462 str
->class = token_sym
;
463 str
->user_token_number
= sym
->user_token_number
;
464 sym
->user_token_number
= USER_NUMBER_HAS_STRING_ALIAS
;
467 str
->number
= sym
->number
;
468 symbol_type_set (str
, sym
->type_name
, loc
);
473 /*---------------------------------------------------------.
474 | Check that THIS, and its alias, have same precedence and |
476 `---------------------------------------------------------*/
479 symbol_check_alias_consistency (symbol
*this)
482 symbol
*str
= this->alias
;
484 /* Check only the symbol in the symbol-string pair. */
486 && this->user_token_number
== USER_NUMBER_HAS_STRING_ALIAS
))
489 if (str
->type_name
!= sym
->type_name
)
492 symbol_type_set (sym
, str
->type_name
, str
->type_location
);
494 symbol_type_set (str
, sym
->type_name
, sym
->type_location
);
498 if (str
->destructor
.code
|| sym
->destructor
.code
)
500 if (str
->destructor
.code
)
501 symbol_destructor_set (sym
, &str
->destructor
);
503 symbol_destructor_set (str
, &sym
->destructor
);
506 if (str
->printer
.code
|| sym
->printer
.code
)
508 if (str
->printer
.code
)
509 symbol_printer_set (sym
, &str
->printer
);
511 symbol_printer_set (str
, &sym
->printer
);
514 if (sym
->prec
|| str
->prec
)
517 symbol_precedence_set (sym
, str
->prec
, str
->assoc
,
520 symbol_precedence_set (str
, sym
->prec
, sym
->assoc
,
526 symbol_check_alias_consistency_processor (void *this,
527 void *null ATTRIBUTE_UNUSED
)
529 symbol_check_alias_consistency (this);
534 /*-------------------------------------------------------------------.
535 | Assign a symbol number, and write the definition of the token name |
536 | into FDEFINES. Put in SYMBOLS. |
537 `-------------------------------------------------------------------*/
540 symbol_pack (symbol
*this)
542 aver (this->number
!= NUMBER_UNDEFINED
);
543 if (this->class == nterm_sym
)
544 this->number
+= ntokens
;
545 else if (this->user_token_number
== USER_NUMBER_HAS_STRING_ALIAS
)
548 symbols
[this->number
] = this;
553 symbol_pack_processor (void *this, void *null ATTRIBUTE_UNUSED
)
555 return symbol_pack (this);
560 user_token_number_redeclaration (int num
, symbol
*first
, symbol
*second
)
562 /* User token numbers are not assigned during the parsing, but in a
563 second step, via a traversal of the symbol table sorted on tag.
565 However, error messages make more sense if we keep the first
566 declaration first. */
567 if (location_cmp (first
->location
, second
->location
) > 0)
573 complain_at (second
->location
,
574 _("user token number %d redeclaration for %s"),
576 complain_at (first
->location
, _("previous declaration for %s"),
580 /*--------------------------------------------------.
581 | Put THIS in TOKEN_TRANSLATIONS if it is a token. |
582 `--------------------------------------------------*/
585 symbol_translation (symbol
*this)
588 if (this->class == token_sym
589 && this->user_token_number
!= USER_NUMBER_HAS_STRING_ALIAS
)
591 /* A token which translation has already been set? */
592 if (token_translations
[this->user_token_number
] != undeftoken
->number
)
593 user_token_number_redeclaration
594 (this->user_token_number
,
595 symbols
[token_translations
[this->user_token_number
]],
598 token_translations
[this->user_token_number
] = this->number
;
605 symbol_translation_processor (void *this, void *null ATTRIBUTE_UNUSED
)
607 return symbol_translation (this);
611 /*---------------------------------------.
612 | Symbol and semantic type hash tables. |
613 `---------------------------------------*/
615 /* Initial capacity of symbol and semantic type hash table. */
616 #define HT_INITIAL_CAPACITY 257
618 static struct hash_table
*symbol_table
= NULL
;
619 static struct hash_table
*semantic_type_table
= NULL
;
622 hash_compare_symbol (const symbol
*m1
, const symbol
*m2
)
624 /* Since tags are unique, we can compare the pointers themselves. */
625 return UNIQSTR_EQ (m1
->tag
, m2
->tag
);
629 hash_compare_semantic_type (const semantic_type
*m1
, const semantic_type
*m2
)
631 /* Since names are unique, we can compare the pointers themselves. */
632 return UNIQSTR_EQ (m1
->tag
, m2
->tag
);
636 hash_symbol_comparator (void const *m1
, void const *m2
)
638 return hash_compare_symbol (m1
, m2
);
642 hash_semantic_type_comparator (void const *m1
, void const *m2
)
644 return hash_compare_semantic_type (m1
, m2
);
648 hash_symbol (const symbol
*m
, size_t tablesize
)
650 /* Since tags are unique, we can hash the pointer itself. */
651 return ((uintptr_t) m
->tag
) % tablesize
;
655 hash_semantic_type (const semantic_type
*m
, size_t tablesize
)
657 /* Since names are unique, we can hash the pointer itself. */
658 return ((uintptr_t) m
->tag
) % tablesize
;
662 hash_symbol_hasher (void const *m
, size_t tablesize
)
664 return hash_symbol (m
, tablesize
);
668 hash_semantic_type_hasher (void const *m
, size_t tablesize
)
670 return hash_semantic_type (m
, tablesize
);
673 /*-------------------------------.
674 | Create the symbol hash table. |
675 `-------------------------------*/
680 symbol_table
= hash_initialize (HT_INITIAL_CAPACITY
,
683 hash_symbol_comparator
,
685 semantic_type_table
= hash_initialize (HT_INITIAL_CAPACITY
,
687 hash_semantic_type_hasher
,
688 hash_semantic_type_comparator
,
693 /*----------------------------------------------------------------.
694 | Find the symbol named KEY, and return it. If it does not exist |
696 `----------------------------------------------------------------*/
699 symbol_from_uniqstr (const uniqstr key
, location loc
)
705 entry
= hash_lookup (symbol_table
, &probe
);
709 /* First insertion in the hash. */
710 aver (!symbols_sorted
);
711 entry
= symbol_new (key
, loc
);
712 if (!hash_insert (symbol_table
, entry
))
719 /*-----------------------------------------------------------------------.
720 | Find the semantic type named KEY, and return it. If it does not exist |
722 `-----------------------------------------------------------------------*/
725 semantic_type_from_uniqstr (const uniqstr key
)
728 semantic_type
*entry
;
731 entry
= hash_lookup (semantic_type_table
, &probe
);
735 /* First insertion in the hash. */
736 entry
= semantic_type_new (key
);
737 if (!hash_insert (semantic_type_table
, entry
))
744 /*----------------------------------------------------------------.
745 | Find the symbol named KEY, and return it. If it does not exist |
747 `----------------------------------------------------------------*/
750 symbol_get (const char *key
, location loc
)
752 return symbol_from_uniqstr (uniqstr_new (key
), loc
);
756 /*-----------------------------------------------------------------------.
757 | Find the semantic type named KEY, and return it. If it does not exist |
759 `-----------------------------------------------------------------------*/
762 semantic_type_get (const char *key
)
764 return semantic_type_from_uniqstr (uniqstr_new (key
));
768 /*------------------------------------------------------------------.
769 | Generate a dummy nonterminal, whose name cannot conflict with the |
771 `------------------------------------------------------------------*/
774 dummy_symbol_get (location loc
)
776 /* Incremented for each generated symbol. */
777 static int dummy_count
= 0;
778 static char buf
[256];
782 sprintf (buf
, "$@%d", ++dummy_count
);
783 sym
= symbol_get (buf
, loc
);
784 sym
->class = nterm_sym
;
785 sym
->number
= nvars
++;
790 symbol_is_dummy (const symbol
*sym
)
792 return sym
->tag
[0] == '@' || (sym
->tag
[0] == '$' && sym
->tag
[1] == '@');
795 /*-------------------.
796 | Free the symbols. |
797 `-------------------*/
802 hash_free (symbol_table
);
803 hash_free (semantic_type_table
);
805 free (symbols_sorted
);
809 /*---------------------------------------------------------------.
810 | Look for undefined symbols, report an error, and consider them |
812 `---------------------------------------------------------------*/
815 symbols_cmp (symbol
const *a
, symbol
const *b
)
817 return strcmp (a
->tag
, b
->tag
);
821 symbols_cmp_qsort (void const *a
, void const *b
)
823 return symbols_cmp (*(symbol
* const *)a
, *(symbol
* const *)b
);
827 symbols_do (Hash_processor processor
, void *processor_data
)
829 size_t count
= hash_get_n_entries (symbol_table
);
832 symbols_sorted
= xnmalloc (count
, sizeof *symbols_sorted
);
833 hash_get_entries (symbol_table
, (void**)symbols_sorted
, count
);
834 qsort (symbols_sorted
, count
, sizeof *symbols_sorted
,
839 for (i
= 0; i
< count
; ++i
)
840 processor (symbols_sorted
[i
], processor_data
);
844 /*--------------------------------------------------------------.
845 | Check that all the symbols are defined. Report any undefined |
846 | symbols and consider them nonterminals. |
847 `--------------------------------------------------------------*/
850 symbols_check_defined (void)
852 symbols_do (symbol_check_defined_processor
, NULL
);
855 /*------------------------------------------------------------------.
856 | Set TOKEN_TRANSLATIONS. Check that no two symbols share the same |
858 `------------------------------------------------------------------*/
861 symbols_token_translations_init (void)
863 bool num_256_available_p
= true;
866 /* Find the highest user token number, and whether 256, the POSIX
867 preferred user token number for the error token, is used. */
868 max_user_token_number
= 0;
869 for (i
= 0; i
< ntokens
; ++i
)
871 symbol
*this = symbols
[i
];
872 if (this->user_token_number
!= USER_NUMBER_UNDEFINED
)
874 if (this->user_token_number
> max_user_token_number
)
875 max_user_token_number
= this->user_token_number
;
876 if (this->user_token_number
== 256)
877 num_256_available_p
= false;
881 /* If 256 is not used, assign it to error, to follow POSIX. */
882 if (num_256_available_p
883 && errtoken
->user_token_number
== USER_NUMBER_UNDEFINED
)
884 errtoken
->user_token_number
= 256;
886 /* Set the missing user numbers. */
887 if (max_user_token_number
< 256)
888 max_user_token_number
= 256;
890 for (i
= 0; i
< ntokens
; ++i
)
892 symbol
*this = symbols
[i
];
893 if (this->user_token_number
== USER_NUMBER_UNDEFINED
)
894 this->user_token_number
= ++max_user_token_number
;
895 if (this->user_token_number
> max_user_token_number
)
896 max_user_token_number
= this->user_token_number
;
899 token_translations
= xnmalloc (max_user_token_number
+ 1,
900 sizeof *token_translations
);
902 /* Initialize all entries for literal tokens to the internal token
903 number for $undefined, which represents all invalid inputs. */
904 for (i
= 0; i
< max_user_token_number
+ 1; i
++)
905 token_translations
[i
] = undeftoken
->number
;
906 symbols_do (symbol_translation_processor
, NULL
);
910 /*----------------------------------------------------------------.
911 | Assign symbol numbers, and write definition of token names into |
912 | FDEFINES. Set up vectors SYMBOL_TABLE, TAGS of symbols. |
913 `----------------------------------------------------------------*/
918 symbols_do (symbol_check_alias_consistency_processor
, NULL
);
920 symbols
= xcalloc (nsyms
, sizeof *symbols
);
921 symbols_do (symbol_pack_processor
, NULL
);
923 /* Aliases leave empty slots in symbols, so remove them. */
927 int nsyms_old
= nsyms
;
928 for (writei
= 0, readi
= 0; readi
< nsyms_old
; readi
+= 1)
930 if (symbols
[readi
] == NULL
)
937 symbols
[writei
] = symbols
[readi
];
938 symbols
[writei
]->number
= writei
;
939 if (symbols
[writei
]->alias
)
940 symbols
[writei
]->alias
->number
= writei
;
945 symbols
= xnrealloc (symbols
, nsyms
, sizeof *symbols
);
947 symbols_token_translations_init ();
949 if (startsymbol
->class == unknown_sym
)
950 fatal_at (startsymbol_location
,
951 _("the start symbol %s is undefined"),
953 else if (startsymbol
->class == token_sym
)
954 fatal_at (startsymbol_location
,
955 _("the start symbol %s is a token"),
960 /*--------------------------------------------------.
961 | Set default tagged/tagless %destructor/%printer. |
962 `--------------------------------------------------*/
965 default_tagged_destructor_set (code_props
const *destructor
)
967 if (default_tagged_destructor
.code
)
969 complain_at (destructor
->location
,
970 _("redeclaration for default tagged %%destructor"));
971 complain_at (default_tagged_destructor
.location
,
972 _("previous declaration"));
974 default_tagged_destructor
= *destructor
;
978 default_tagless_destructor_set (code_props
const *destructor
)
980 if (default_tagless_destructor
.code
)
982 complain_at (destructor
->location
,
983 _("redeclaration for default tagless %%destructor"));
984 complain_at (default_tagless_destructor
.location
,
985 _("previous declaration"));
987 default_tagless_destructor
= *destructor
;
991 default_tagged_printer_set (code_props
const *printer
)
993 if (default_tagged_printer
.code
)
995 complain_at (printer
->location
,
996 _("redeclaration for default tagged %%printer"));
997 complain_at (default_tagged_printer
.location
,
998 _("previous declaration"));
1000 default_tagged_printer
= *printer
;
1004 default_tagless_printer_set (code_props
const *printer
)
1006 if (default_tagless_printer
.code
)
1008 complain_at (printer
->location
,
1009 _("redeclaration for default tagless %%printer"));
1010 complain_at (default_tagless_printer
.location
,
1011 _("previous declaration"));
1013 default_tagless_printer
= *printer
;