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
146 /*------------------------------------------------------------------.
147 | Complain that S's WHAT is redeclared at SECOND, and was first set |
149 `------------------------------------------------------------------*/
152 symbol_redeclaration (symbol
*s
, const char *what
, location first
,
155 complain_at (second
, _("%s redeclaration for %s"), what
, s
->tag
);
156 complain_at (first
, _("previous declaration"));
160 semantic_type_redeclaration (semantic_type
*s
, const char *what
, location first
,
163 complain_at (second
, _("%s redeclaration for <%s>"), what
, s
->tag
);
164 complain_at (first
, _("previous declaration"));
169 /*-----------------------------------------------------------------.
170 | Set the TYPE_NAME associated with SYM. Does nothing if passed 0 |
172 `-----------------------------------------------------------------*/
175 symbol_type_set (symbol
*sym
, uniqstr type_name
, location loc
)
180 symbol_redeclaration (sym
, "%type", sym
->type_location
, loc
);
181 uniqstr_assert (type_name
);
182 sym
->type_name
= type_name
;
183 sym
->type_location
= loc
;
187 /*-----------------------------------.
188 | Get the CLASS associated with SYM. |
189 `-----------------------------------*/
192 symbol_class_get_string (symbol
*sym
)
196 if (sym
->class == token_sym
)
198 else if (sym
->class == nterm_sym
)
199 return "nonterminal";
205 /*-----------------------------------------.
206 | Set the DESTRUCTOR associated with SYM. |
207 `-----------------------------------------*/
210 symbol_destructor_set (symbol
*sym
, code_props
const *destructor
)
212 if (sym
->destructor
.code
)
213 symbol_redeclaration (sym
, "%destructor", sym
->destructor
.location
,
214 destructor
->location
);
215 sym
->destructor
= *destructor
;
218 /*------------------------------------------.
219 | Set the DESTRUCTOR associated with TYPE. |
220 `------------------------------------------*/
223 semantic_type_destructor_set (semantic_type
*type
,
224 code_props
const *destructor
)
226 if (type
->destructor
.code
)
227 semantic_type_redeclaration (type
, "%destructor",
228 type
->destructor
.location
,
229 destructor
->location
);
230 type
->destructor
= *destructor
;
233 /*---------------------------------------.
234 | Get the computed %destructor for SYM. |
235 `---------------------------------------*/
238 symbol_destructor_get (symbol
const *sym
)
240 /* Per-symbol %destructor. */
241 if (sym
->destructor
.code
)
242 return &sym
->destructor
;
244 /* Per-type %destructor. */
247 code_props
const *destructor
=
248 &semantic_type_get (sym
->type_name
)->destructor
;
249 if (destructor
->code
)
253 /* Apply default %destructor's only to user-defined symbols. */
254 if (sym
->tag
[0] == '$' || sym
== errtoken
)
255 return &code_props_none
;
258 return &default_tagged_destructor
;
259 return &default_tagless_destructor
;
262 /*--------------------------------------.
263 | Set the PRINTER associated with SYM. |
264 `--------------------------------------*/
267 symbol_printer_set (symbol
*sym
, code_props
const *printer
)
269 if (sym
->printer
.code
)
270 symbol_redeclaration (sym
, "%printer",
271 sym
->printer
.location
, printer
->location
);
272 sym
->printer
= *printer
;
275 /*---------------------------------------.
276 | Set the PRINTER associated with TYPE. |
277 `---------------------------------------*/
280 semantic_type_printer_set (semantic_type
*type
, code_props
const *printer
)
282 if (type
->printer
.code
)
283 semantic_type_redeclaration (type
, "%printer",
284 type
->printer
.location
, printer
->location
);
285 type
->printer
= *printer
;
288 /*------------------------------------.
289 | Get the computed %printer for SYM. |
290 `------------------------------------*/
293 symbol_printer_get (symbol
const *sym
)
295 /* Per-symbol %printer. */
296 if (sym
->printer
.code
)
297 return &sym
->printer
;
299 /* Per-type %printer. */
302 code_props
const *printer
= &semantic_type_get (sym
->type_name
)->printer
;
307 /* Apply the default %printer only to user-defined symbols. */
308 if (sym
->tag
[0] == '$' || sym
== errtoken
)
309 return &code_props_none
;
312 return &default_tagged_printer
;
313 return &default_tagless_printer
;
316 /*-----------------------------------------------------------------.
317 | Set the PRECEDENCE associated with SYM. Does nothing if invoked |
318 | with UNDEF_ASSOC as ASSOC. |
319 `-----------------------------------------------------------------*/
322 symbol_precedence_set (symbol
*sym
, int prec
, assoc a
, location loc
)
324 if (a
!= undef_assoc
)
327 symbol_redeclaration (sym
, assoc_to_string (a
), sym
->prec_location
,
331 sym
->prec_location
= loc
;
334 /* Only terminals have a precedence. */
335 symbol_class_set (sym
, token_sym
, loc
, false);
339 /*------------------------------------.
340 | Set the CLASS associated with SYM. |
341 `------------------------------------*/
344 symbol_class_set (symbol
*sym
, symbol_class
class, location loc
, bool declaring
)
346 if (sym
->class != unknown_sym
&& sym
->class != class)
348 complain_at (loc
, _("symbol %s redefined"), sym
->tag
);
349 sym
->declared
= false;
352 if (class == nterm_sym
&& sym
->class != nterm_sym
)
353 sym
->number
= nvars
++;
354 else if (class == token_sym
&& sym
->number
== NUMBER_UNDEFINED
)
355 sym
->number
= ntokens
++;
362 warn_at (loc
, _("symbol %s redeclared"), sym
->tag
);
363 sym
->declared
= true;
368 /*------------------------------------------------.
369 | Set the USER_TOKEN_NUMBER associated with SYM. |
370 `------------------------------------------------*/
373 symbol_user_token_number_set (symbol
*sym
, int user_token_number
, location loc
)
375 int *user_token_numberp
;
377 if (sym
->user_token_number
!= USER_NUMBER_HAS_STRING_ALIAS
)
378 user_token_numberp
= &sym
->user_token_number
;
380 user_token_numberp
= &sym
->alias
->user_token_number
;
381 if (*user_token_numberp
!= USER_NUMBER_UNDEFINED
382 && *user_token_numberp
!= user_token_number
)
383 complain_at (loc
, _("redefining user token number of %s"), sym
->tag
);
385 *user_token_numberp
= user_token_number
;
386 /* User defined $end token? */
387 if (user_token_number
== 0)
390 endtoken
->number
= 0;
391 /* It is always mapped to 0, so it was already counted in
398 /*----------------------------------------------------------.
399 | If SYM is not defined, report an error, and consider it a |
401 `----------------------------------------------------------*/
404 symbol_check_defined (symbol
*sym
)
406 if (sym
->class == unknown_sym
)
410 _("symbol %s is used, but is not defined as a token and has no rules"),
412 sym
->class = nterm_sym
;
413 sym
->number
= nvars
++;
420 symbol_check_defined_processor (void *sym
, void *null ATTRIBUTE_UNUSED
)
422 return symbol_check_defined (sym
);
427 symbol_make_alias (symbol
*sym
, symbol
*str
, location loc
)
430 warn_at (loc
, _("symbol `%s' used more than once as a literal string"),
433 warn_at (loc
, _("symbol `%s' given more than one literal string"),
437 str
->class = token_sym
;
438 str
->user_token_number
= sym
->user_token_number
;
439 sym
->user_token_number
= USER_NUMBER_HAS_STRING_ALIAS
;
442 str
->number
= sym
->number
;
443 symbol_type_set (str
, sym
->type_name
, loc
);
448 /*---------------------------------------------------------.
449 | Check that THIS, and its alias, have same precedence and |
451 `---------------------------------------------------------*/
454 symbol_check_alias_consistency (symbol
*this)
457 symbol
*str
= this->alias
;
459 /* Check only the symbol in the symbol-string pair. */
461 && this->user_token_number
== USER_NUMBER_HAS_STRING_ALIAS
))
464 if (str
->type_name
!= sym
->type_name
)
467 symbol_type_set (sym
, str
->type_name
, str
->type_location
);
469 symbol_type_set (str
, sym
->type_name
, sym
->type_location
);
473 if (str
->destructor
.code
|| sym
->destructor
.code
)
475 if (str
->destructor
.code
)
476 symbol_destructor_set (sym
, &str
->destructor
);
478 symbol_destructor_set (str
, &sym
->destructor
);
481 if (str
->printer
.code
|| sym
->printer
.code
)
483 if (str
->printer
.code
)
484 symbol_printer_set (sym
, &str
->printer
);
486 symbol_printer_set (str
, &sym
->printer
);
489 if (sym
->prec
|| str
->prec
)
492 symbol_precedence_set (sym
, str
->prec
, str
->assoc
,
495 symbol_precedence_set (str
, sym
->prec
, sym
->assoc
,
501 symbol_check_alias_consistency_processor (void *this,
502 void *null ATTRIBUTE_UNUSED
)
504 symbol_check_alias_consistency (this);
509 /*-------------------------------------------------------------------.
510 | Assign a symbol number, and write the definition of the token name |
511 | into FDEFINES. Put in SYMBOLS. |
512 `-------------------------------------------------------------------*/
515 symbol_pack (symbol
*this)
517 if (this->class == nterm_sym
)
519 this->number
+= ntokens
;
521 else if (this->alias
)
523 /* This symbol and its alias are a single token defn.
524 Allocate a tokno, and assign to both check agreement of
525 prec and assoc fields and make both the same */
526 if (this->number
== NUMBER_UNDEFINED
)
528 if (this == endtoken
|| this->alias
== endtoken
)
529 this->number
= this->alias
->number
= 0;
532 aver (this->alias
->number
!= NUMBER_UNDEFINED
);
533 this->number
= this->alias
->number
;
536 /* Do not do processing below for USER_NUMBER_HAS_STRING_ALIASes. */
537 if (this->user_token_number
== USER_NUMBER_HAS_STRING_ALIAS
)
540 else /* this->class == token_sym */
541 aver (this->number
!= NUMBER_UNDEFINED
);
543 symbols
[this->number
] = this;
548 symbol_pack_processor (void *this, void *null ATTRIBUTE_UNUSED
)
550 return symbol_pack (this);
555 user_token_number_redeclaration (int num
, symbol
*first
, symbol
*second
)
557 /* User token numbers are not assigned during the parsing, but in a
558 second step, via a traversal of the symbol table sorted on tag.
560 However, error messages make more sense if we keep the first
561 declaration first. */
562 if (location_cmp (first
->location
, second
->location
) > 0)
568 complain_at (second
->location
,
569 _("user token number %d redeclaration for %s"),
571 complain_at (first
->location
, _("previous declaration for %s"),
575 /*--------------------------------------------------.
576 | Put THIS in TOKEN_TRANSLATIONS if it is a token. |
577 `--------------------------------------------------*/
580 symbol_translation (symbol
*this)
583 if (this->class == token_sym
584 && this->user_token_number
!= USER_NUMBER_HAS_STRING_ALIAS
)
586 /* A token which translation has already been set? */
587 if (token_translations
[this->user_token_number
] != undeftoken
->number
)
588 user_token_number_redeclaration
589 (this->user_token_number
,
590 symbols
[token_translations
[this->user_token_number
]],
593 token_translations
[this->user_token_number
] = this->number
;
600 symbol_translation_processor (void *this, void *null ATTRIBUTE_UNUSED
)
602 return symbol_translation (this);
606 /*---------------------------------------.
607 | Symbol and semantic type hash tables. |
608 `---------------------------------------*/
610 /* Initial capacity of symbol and semantic type hash table. */
611 #define HT_INITIAL_CAPACITY 257
613 static struct hash_table
*symbol_table
= NULL
;
614 static struct hash_table
*semantic_type_table
= NULL
;
617 hash_compare_symbol (const symbol
*m1
, const symbol
*m2
)
619 /* Since tags are unique, we can compare the pointers themselves. */
620 return UNIQSTR_EQ (m1
->tag
, m2
->tag
);
624 hash_compare_semantic_type (const semantic_type
*m1
, const semantic_type
*m2
)
626 /* Since names are unique, we can compare the pointers themselves. */
627 return UNIQSTR_EQ (m1
->tag
, m2
->tag
);
631 hash_symbol_comparator (void const *m1
, void const *m2
)
633 return hash_compare_symbol (m1
, m2
);
637 hash_semantic_type_comparator (void const *m1
, void const *m2
)
639 return hash_compare_semantic_type (m1
, m2
);
643 hash_symbol (const symbol
*m
, size_t tablesize
)
645 /* Since tags are unique, we can hash the pointer itself. */
646 return ((uintptr_t) m
->tag
) % tablesize
;
650 hash_semantic_type (const semantic_type
*m
, size_t tablesize
)
652 /* Since names are unique, we can hash the pointer itself. */
653 return ((uintptr_t) m
->tag
) % tablesize
;
657 hash_symbol_hasher (void const *m
, size_t tablesize
)
659 return hash_symbol (m
, tablesize
);
663 hash_semantic_type_hasher (void const *m
, size_t tablesize
)
665 return hash_semantic_type (m
, tablesize
);
668 /*-------------------------------.
669 | Create the symbol hash table. |
670 `-------------------------------*/
675 symbol_table
= hash_initialize (HT_INITIAL_CAPACITY
,
678 hash_symbol_comparator
,
680 semantic_type_table
= hash_initialize (HT_INITIAL_CAPACITY
,
682 hash_semantic_type_hasher
,
683 hash_semantic_type_comparator
,
688 /*----------------------------------------------------------------.
689 | Find the symbol named KEY, and return it. If it does not exist |
691 `----------------------------------------------------------------*/
694 symbol_from_uniqstr (const uniqstr key
, location loc
)
700 entry
= hash_lookup (symbol_table
, &probe
);
704 /* First insertion in the hash. */
705 aver (!symbols_sorted
);
706 entry
= symbol_new (key
, loc
);
707 if (!hash_insert (symbol_table
, entry
))
714 /*-----------------------------------------------------------------------.
715 | Find the semantic type named KEY, and return it. If it does not exist |
717 `-----------------------------------------------------------------------*/
720 semantic_type_from_uniqstr (const uniqstr key
)
723 semantic_type
*entry
;
726 entry
= hash_lookup (semantic_type_table
, &probe
);
730 /* First insertion in the hash. */
731 entry
= semantic_type_new (key
);
732 if (!hash_insert (semantic_type_table
, entry
))
739 /*----------------------------------------------------------------.
740 | Find the symbol named KEY, and return it. If it does not exist |
742 `----------------------------------------------------------------*/
745 symbol_get (const char *key
, location loc
)
747 return symbol_from_uniqstr (uniqstr_new (key
), loc
);
751 /*-----------------------------------------------------------------------.
752 | Find the semantic type named KEY, and return it. If it does not exist |
754 `-----------------------------------------------------------------------*/
757 semantic_type_get (const char *key
)
759 return semantic_type_from_uniqstr (uniqstr_new (key
));
763 /*------------------------------------------------------------------.
764 | Generate a dummy nonterminal, whose name cannot conflict with the |
766 `------------------------------------------------------------------*/
769 dummy_symbol_get (location loc
)
771 /* Incremented for each generated symbol. */
772 static int dummy_count
= 0;
773 static char buf
[256];
777 sprintf (buf
, "$@%d", ++dummy_count
);
778 sym
= symbol_get (buf
, loc
);
779 sym
->class = nterm_sym
;
780 sym
->number
= nvars
++;
785 symbol_is_dummy (const symbol
*sym
)
787 return sym
->tag
[0] == '@' || (sym
->tag
[0] == '$' && sym
->tag
[1] == '@');
790 /*-------------------.
791 | Free the symbols. |
792 `-------------------*/
797 hash_free (symbol_table
);
798 hash_free (semantic_type_table
);
800 free (symbols_sorted
);
804 /*---------------------------------------------------------------.
805 | Look for undefined symbols, report an error, and consider them |
807 `---------------------------------------------------------------*/
810 symbols_cmp (symbol
const *a
, symbol
const *b
)
812 return strcmp (a
->tag
, b
->tag
);
816 symbols_cmp_qsort (void const *a
, void const *b
)
818 return symbols_cmp (*(symbol
* const *)a
, *(symbol
* const *)b
);
822 symbols_do (Hash_processor processor
, void *processor_data
)
824 size_t count
= hash_get_n_entries (symbol_table
);
827 symbols_sorted
= xnmalloc (count
, sizeof *symbols_sorted
);
828 hash_get_entries (symbol_table
, (void**)symbols_sorted
, count
);
829 qsort (symbols_sorted
, count
, sizeof *symbols_sorted
,
834 for (i
= 0; i
< count
; ++i
)
835 processor (symbols_sorted
[i
], processor_data
);
839 /*--------------------------------------------------------------.
840 | Check that all the symbols are defined. Report any undefined |
841 | symbols and consider them nonterminals. |
842 `--------------------------------------------------------------*/
845 symbols_check_defined (void)
847 symbols_do (symbol_check_defined_processor
, NULL
);
850 /*------------------------------------------------------------------.
851 | Set TOKEN_TRANSLATIONS. Check that no two symbols share the same |
853 `------------------------------------------------------------------*/
856 symbols_token_translations_init (void)
858 bool num_256_available_p
= true;
861 /* Find the highest user token number, and whether 256, the POSIX
862 preferred user token number for the error token, is used. */
863 max_user_token_number
= 0;
864 for (i
= 0; i
< ntokens
; ++i
)
866 symbol
*this = symbols
[i
];
867 if (this->user_token_number
!= USER_NUMBER_UNDEFINED
)
869 if (this->user_token_number
> max_user_token_number
)
870 max_user_token_number
= this->user_token_number
;
871 if (this->user_token_number
== 256)
872 num_256_available_p
= false;
876 /* If 256 is not used, assign it to error, to follow POSIX. */
877 if (num_256_available_p
878 && errtoken
->user_token_number
== USER_NUMBER_UNDEFINED
)
879 errtoken
->user_token_number
= 256;
881 /* Set the missing user numbers. */
882 if (max_user_token_number
< 256)
883 max_user_token_number
= 256;
885 for (i
= 0; i
< ntokens
; ++i
)
887 symbol
*this = symbols
[i
];
888 if (this->user_token_number
== USER_NUMBER_UNDEFINED
)
889 this->user_token_number
= ++max_user_token_number
;
890 if (this->user_token_number
> max_user_token_number
)
891 max_user_token_number
= this->user_token_number
;
894 token_translations
= xnmalloc (max_user_token_number
+ 1,
895 sizeof *token_translations
);
897 /* Initialize all entries for literal tokens to 2, the internal
898 token number for $undefined, which represents all invalid inputs.
900 for (i
= 0; i
< max_user_token_number
+ 1; i
++)
901 token_translations
[i
] = undeftoken
->number
;
902 symbols_do (symbol_translation_processor
, NULL
);
906 /*----------------------------------------------------------------.
907 | Assign symbol numbers, and write definition of token names into |
908 | FDEFINES. Set up vectors SYMBOL_TABLE, TAGS of symbols. |
909 `----------------------------------------------------------------*/
914 symbols_do (symbol_check_alias_consistency_processor
, NULL
);
916 symbols
= xcalloc (nsyms
, sizeof *symbols
);
917 symbols_do (symbol_pack_processor
, NULL
);
919 /* Aliases leave empty slots in symbols, so remove them. */
923 int nsyms_old
= nsyms
;
924 for (writei
= 0, readi
= 0; readi
< nsyms_old
; readi
+= 1)
926 if (symbols
[readi
] == NULL
)
933 symbols
[writei
] = symbols
[readi
];
934 symbols
[writei
]->number
= writei
;
935 if (symbols
[writei
]->alias
)
936 symbols
[writei
]->alias
->number
= writei
;
941 symbols
= xnrealloc (symbols
, nsyms
, sizeof *symbols
);
943 symbols_token_translations_init ();
945 if (startsymbol
->class == unknown_sym
)
946 fatal_at (startsymbol_location
,
947 _("the start symbol %s is undefined"),
949 else if (startsymbol
->class == token_sym
)
950 fatal_at (startsymbol_location
,
951 _("the start symbol %s is a token"),
956 /*--------------------------------------------------.
957 | Set default tagged/tagless %destructor/%printer. |
958 `--------------------------------------------------*/
961 default_tagged_destructor_set (code_props
const *destructor
)
963 if (default_tagged_destructor
.code
)
965 complain_at (destructor
->location
,
966 _("redeclaration for default tagged %%destructor"));
967 complain_at (default_tagged_destructor
.location
,
968 _("previous declaration"));
970 default_tagged_destructor
= *destructor
;
974 default_tagless_destructor_set (code_props
const *destructor
)
976 if (default_tagless_destructor
.code
)
978 complain_at (destructor
->location
,
979 _("redeclaration for default tagless %%destructor"));
980 complain_at (default_tagless_destructor
.location
,
981 _("previous declaration"));
983 default_tagless_destructor
= *destructor
;
987 default_tagged_printer_set (code_props
const *printer
)
989 if (default_tagged_printer
.code
)
991 complain_at (printer
->location
,
992 _("redeclaration for default tagged %%printer"));
993 complain_at (default_tagged_printer
.location
,
994 _("previous declaration"));
996 default_tagged_printer
= *printer
;
1000 default_tagless_printer_set (code_props
const *printer
)
1002 if (default_tagless_printer
.code
)
1004 complain_at (printer
->location
,
1005 _("redeclaration for default tagless %%printer"));
1006 complain_at (default_tagless_printer
.location
,
1007 _("previous declaration"));
1009 default_tagless_printer
= *printer
;