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/>. */
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] != '\'' && mbschr (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 | Set the DESTRUCTOR associated with SYM. |
224 `-----------------------------------------*/
227 symbol_destructor_set (symbol
*sym
, code_props
const *destructor
)
229 if (sym
->destructor
.code
)
230 symbol_redeclaration (sym
, "%destructor", sym
->destructor
.location
,
231 destructor
->location
);
232 sym
->destructor
= *destructor
;
235 /*------------------------------------------.
236 | Set the DESTRUCTOR associated with TYPE. |
237 `------------------------------------------*/
240 semantic_type_destructor_set (semantic_type
*type
,
241 code_props
const *destructor
)
243 if (type
->destructor
.code
)
244 semantic_type_redeclaration (type
, "%destructor",
245 type
->destructor
.location
,
246 destructor
->location
);
247 type
->destructor
= *destructor
;
250 /*---------------------------------------.
251 | Get the computed %destructor for SYM. |
252 `---------------------------------------*/
255 symbol_destructor_get (symbol
const *sym
)
257 /* Per-symbol %destructor. */
258 if (sym
->destructor
.code
)
259 return &sym
->destructor
;
261 /* Per-type %destructor. */
264 code_props
const *destructor
=
265 &semantic_type_get (sym
->type_name
)->destructor
;
266 if (destructor
->code
)
270 /* Apply default %destructor's only to user-defined symbols. */
271 if (sym
->tag
[0] == '$' || sym
== errtoken
)
272 return &code_props_none
;
275 return &default_tagged_destructor
;
276 return &default_tagless_destructor
;
279 /*--------------------------------------.
280 | Set the PRINTER associated with SYM. |
281 `--------------------------------------*/
284 symbol_printer_set (symbol
*sym
, code_props
const *printer
)
286 if (sym
->printer
.code
)
287 symbol_redeclaration (sym
, "%printer",
288 sym
->printer
.location
, printer
->location
);
289 sym
->printer
= *printer
;
292 /*---------------------------------------.
293 | Set the PRINTER associated with TYPE. |
294 `---------------------------------------*/
297 semantic_type_printer_set (semantic_type
*type
, code_props
const *printer
)
299 if (type
->printer
.code
)
300 semantic_type_redeclaration (type
, "%printer",
301 type
->printer
.location
, printer
->location
);
302 type
->printer
= *printer
;
305 /*------------------------------------.
306 | Get the computed %printer for SYM. |
307 `------------------------------------*/
310 symbol_printer_get (symbol
const *sym
)
312 /* Per-symbol %printer. */
313 if (sym
->printer
.code
)
314 return &sym
->printer
;
316 /* Per-type %printer. */
319 code_props
const *printer
= &semantic_type_get (sym
->type_name
)->printer
;
324 /* Apply the default %printer only to user-defined symbols. */
325 if (sym
->tag
[0] == '$' || sym
== errtoken
)
326 return &code_props_none
;
329 return &default_tagged_printer
;
330 return &default_tagless_printer
;
333 /*-----------------------------------------------------------------.
334 | Set the PRECEDENCE associated with SYM. Does nothing if invoked |
335 | with UNDEF_ASSOC as ASSOC. |
336 `-----------------------------------------------------------------*/
339 symbol_precedence_set (symbol
*sym
, int prec
, assoc a
, location loc
)
341 if (a
!= undef_assoc
)
344 symbol_redeclaration (sym
, assoc_to_string (a
), sym
->prec_location
,
348 sym
->prec_location
= loc
;
351 /* Only terminals have a precedence. */
352 symbol_class_set (sym
, token_sym
, loc
, false);
356 /*------------------------------------.
357 | Set the CLASS associated with SYM. |
358 `------------------------------------*/
361 symbol_class_set (symbol
*sym
, symbol_class
class, location loc
, bool declaring
)
363 if (sym
->class != unknown_sym
&& sym
->class != class)
365 complain_at (loc
, _("symbol %s redefined"), sym
->tag
);
366 sym
->declared
= false;
369 if (class == nterm_sym
&& sym
->class != nterm_sym
)
370 sym
->number
= nvars
++;
371 else if (class == token_sym
&& sym
->number
== NUMBER_UNDEFINED
)
372 sym
->number
= ntokens
++;
379 warn_at (loc
, _("symbol %s redeclared"), sym
->tag
);
380 sym
->declared
= true;
385 /*------------------------------------------------.
386 | Set the USER_TOKEN_NUMBER associated with SYM. |
387 `------------------------------------------------*/
390 symbol_user_token_number_set (symbol
*sym
, int user_token_number
, location loc
)
392 int *user_token_numberp
;
394 if (sym
->user_token_number
!= USER_NUMBER_HAS_STRING_ALIAS
)
395 user_token_numberp
= &sym
->user_token_number
;
397 user_token_numberp
= &sym
->alias
->user_token_number
;
398 if (*user_token_numberp
!= USER_NUMBER_UNDEFINED
399 && *user_token_numberp
!= user_token_number
)
400 complain_at (loc
, _("redefining user token number of %s"), sym
->tag
);
402 *user_token_numberp
= user_token_number
;
403 /* User defined $end token? */
404 if (user_token_number
== 0)
407 /* It is always mapped to 0, so it was already counted in
409 if (endtoken
->number
!= NUMBER_UNDEFINED
)
411 endtoken
->number
= 0;
416 /*----------------------------------------------------------.
417 | If SYM is not defined, report an error, and consider it a |
419 `----------------------------------------------------------*/
422 symbol_check_defined (symbol
*sym
)
424 if (sym
->class == unknown_sym
)
428 _("symbol %s is used, but is not defined as a token and has no rules"),
430 sym
->class = nterm_sym
;
431 sym
->number
= nvars
++;
438 symbol_check_defined_processor (void *sym
, void *null ATTRIBUTE_UNUSED
)
440 return symbol_check_defined (sym
);
445 symbol_make_alias (symbol
*sym
, symbol
*str
, location loc
)
448 warn_at (loc
, _("symbol %s used more than once as a literal string"),
451 warn_at (loc
, _("symbol %s given more than one literal string"),
455 str
->class = token_sym
;
456 str
->user_token_number
= sym
->user_token_number
;
457 sym
->user_token_number
= USER_NUMBER_HAS_STRING_ALIAS
;
460 str
->number
= sym
->number
;
461 symbol_type_set (str
, sym
->type_name
, loc
);
466 /*---------------------------------------------------------.
467 | Check that THIS, and its alias, have same precedence and |
469 `---------------------------------------------------------*/
472 symbol_check_alias_consistency (symbol
*this)
475 symbol
*str
= this->alias
;
477 /* Check only the symbol in the symbol-string pair. */
479 && this->user_token_number
== USER_NUMBER_HAS_STRING_ALIAS
))
482 if (str
->type_name
!= sym
->type_name
)
485 symbol_type_set (sym
, str
->type_name
, str
->type_location
);
487 symbol_type_set (str
, sym
->type_name
, sym
->type_location
);
491 if (str
->destructor
.code
|| sym
->destructor
.code
)
493 if (str
->destructor
.code
)
494 symbol_destructor_set (sym
, &str
->destructor
);
496 symbol_destructor_set (str
, &sym
->destructor
);
499 if (str
->printer
.code
|| sym
->printer
.code
)
501 if (str
->printer
.code
)
502 symbol_printer_set (sym
, &str
->printer
);
504 symbol_printer_set (str
, &sym
->printer
);
507 if (sym
->prec
|| str
->prec
)
510 symbol_precedence_set (sym
, str
->prec
, str
->assoc
,
513 symbol_precedence_set (str
, sym
->prec
, sym
->assoc
,
519 symbol_check_alias_consistency_processor (void *this,
520 void *null ATTRIBUTE_UNUSED
)
522 symbol_check_alias_consistency (this);
527 /*-------------------------------------------------------------------.
528 | Assign a symbol number, and write the definition of the token name |
529 | into FDEFINES. Put in SYMBOLS. |
530 `-------------------------------------------------------------------*/
533 symbol_pack (symbol
*this)
535 aver (this->number
!= NUMBER_UNDEFINED
);
536 if (this->class == nterm_sym
)
537 this->number
+= ntokens
;
538 else if (this->user_token_number
== USER_NUMBER_HAS_STRING_ALIAS
)
541 symbols
[this->number
] = this;
546 symbol_pack_processor (void *this, void *null ATTRIBUTE_UNUSED
)
548 return symbol_pack (this);
553 user_token_number_redeclaration (int num
, symbol
*first
, symbol
*second
)
555 /* User token numbers are not assigned during the parsing, but in a
556 second step, via a traversal of the symbol table sorted on tag.
558 However, error messages make more sense if we keep the first
559 declaration first. */
560 if (location_cmp (first
->location
, second
->location
) > 0)
566 complain_at (second
->location
,
567 _("user token number %d redeclaration for %s"),
569 complain_at (first
->location
, _("previous declaration for %s"),
573 /*--------------------------------------------------.
574 | Put THIS in TOKEN_TRANSLATIONS if it is a token. |
575 `--------------------------------------------------*/
578 symbol_translation (symbol
*this)
581 if (this->class == token_sym
582 && this->user_token_number
!= USER_NUMBER_HAS_STRING_ALIAS
)
584 /* A token which translation has already been set? */
585 if (token_translations
[this->user_token_number
] != undeftoken
->number
)
586 user_token_number_redeclaration
587 (this->user_token_number
,
588 symbols
[token_translations
[this->user_token_number
]],
591 token_translations
[this->user_token_number
] = this->number
;
598 symbol_translation_processor (void *this, void *null ATTRIBUTE_UNUSED
)
600 return symbol_translation (this);
604 /*---------------------------------------.
605 | Symbol and semantic type hash tables. |
606 `---------------------------------------*/
608 /* Initial capacity of symbol and semantic type hash table. */
609 #define HT_INITIAL_CAPACITY 257
611 static struct hash_table
*symbol_table
= NULL
;
612 static struct hash_table
*semantic_type_table
= NULL
;
615 hash_compare_symbol (const symbol
*m1
, const symbol
*m2
)
617 /* Since tags are unique, we can compare the pointers themselves. */
618 return UNIQSTR_EQ (m1
->tag
, m2
->tag
);
622 hash_compare_semantic_type (const semantic_type
*m1
, const semantic_type
*m2
)
624 /* Since names are unique, we can compare the pointers themselves. */
625 return UNIQSTR_EQ (m1
->tag
, m2
->tag
);
629 hash_symbol_comparator (void const *m1
, void const *m2
)
631 return hash_compare_symbol (m1
, m2
);
635 hash_semantic_type_comparator (void const *m1
, void const *m2
)
637 return hash_compare_semantic_type (m1
, m2
);
641 hash_symbol (const symbol
*m
, size_t tablesize
)
643 /* Since tags are unique, we can hash the pointer itself. */
644 return ((uintptr_t) m
->tag
) % tablesize
;
648 hash_semantic_type (const semantic_type
*m
, size_t tablesize
)
650 /* Since names are unique, we can hash the pointer itself. */
651 return ((uintptr_t) m
->tag
) % tablesize
;
655 hash_symbol_hasher (void const *m
, size_t tablesize
)
657 return hash_symbol (m
, tablesize
);
661 hash_semantic_type_hasher (void const *m
, size_t tablesize
)
663 return hash_semantic_type (m
, tablesize
);
666 /*-------------------------------.
667 | Create the symbol hash table. |
668 `-------------------------------*/
673 symbol_table
= hash_initialize (HT_INITIAL_CAPACITY
,
676 hash_symbol_comparator
,
678 semantic_type_table
= hash_initialize (HT_INITIAL_CAPACITY
,
680 hash_semantic_type_hasher
,
681 hash_semantic_type_comparator
,
686 /*----------------------------------------------------------------.
687 | Find the symbol named KEY, and return it. If it does not exist |
689 `----------------------------------------------------------------*/
692 symbol_from_uniqstr (const uniqstr key
, location loc
)
698 entry
= hash_lookup (symbol_table
, &probe
);
702 /* First insertion in the hash. */
703 aver (!symbols_sorted
);
704 entry
= symbol_new (key
, loc
);
705 if (!hash_insert (symbol_table
, entry
))
712 /*-----------------------------------------------------------------------.
713 | Find the semantic type named KEY, and return it. If it does not exist |
715 `-----------------------------------------------------------------------*/
718 semantic_type_from_uniqstr (const uniqstr key
)
721 semantic_type
*entry
;
724 entry
= hash_lookup (semantic_type_table
, &probe
);
728 /* First insertion in the hash. */
729 entry
= semantic_type_new (key
);
730 if (!hash_insert (semantic_type_table
, entry
))
737 /*----------------------------------------------------------------.
738 | Find the symbol named KEY, and return it. If it does not exist |
740 `----------------------------------------------------------------*/
743 symbol_get (const char *key
, location loc
)
745 return symbol_from_uniqstr (uniqstr_new (key
), loc
);
749 /*-----------------------------------------------------------------------.
750 | Find the semantic type named KEY, and return it. If it does not exist |
752 `-----------------------------------------------------------------------*/
755 semantic_type_get (const char *key
)
757 return semantic_type_from_uniqstr (uniqstr_new (key
));
761 /*------------------------------------------------------------------.
762 | Generate a dummy nonterminal, whose name cannot conflict with the |
764 `------------------------------------------------------------------*/
767 dummy_symbol_get (location loc
)
769 /* Incremented for each generated symbol. */
770 static int dummy_count
= 0;
771 static char buf
[256];
775 sprintf (buf
, "$@%d", ++dummy_count
);
776 sym
= symbol_get (buf
, loc
);
777 sym
->class = nterm_sym
;
778 sym
->number
= nvars
++;
783 symbol_is_dummy (const symbol
*sym
)
785 return sym
->tag
[0] == '@' || (sym
->tag
[0] == '$' && sym
->tag
[1] == '@');
788 /*-------------------.
789 | Free the symbols. |
790 `-------------------*/
795 hash_free (symbol_table
);
796 hash_free (semantic_type_table
);
798 free (symbols_sorted
);
802 /*---------------------------------------------------------------.
803 | Look for undefined symbols, report an error, and consider them |
805 `---------------------------------------------------------------*/
808 symbols_cmp (symbol
const *a
, symbol
const *b
)
810 return strcmp (a
->tag
, b
->tag
);
814 symbols_cmp_qsort (void const *a
, void const *b
)
816 return symbols_cmp (*(symbol
* const *)a
, *(symbol
* const *)b
);
820 symbols_do (Hash_processor processor
, void *processor_data
)
822 size_t count
= hash_get_n_entries (symbol_table
);
825 symbols_sorted
= xnmalloc (count
, sizeof *symbols_sorted
);
826 hash_get_entries (symbol_table
, (void**)symbols_sorted
, count
);
827 qsort (symbols_sorted
, count
, sizeof *symbols_sorted
,
832 for (i
= 0; i
< count
; ++i
)
833 processor (symbols_sorted
[i
], processor_data
);
837 /*--------------------------------------------------------------.
838 | Check that all the symbols are defined. Report any undefined |
839 | symbols and consider them nonterminals. |
840 `--------------------------------------------------------------*/
843 symbols_check_defined (void)
845 symbols_do (symbol_check_defined_processor
, NULL
);
848 /*------------------------------------------------------------------.
849 | Set TOKEN_TRANSLATIONS. Check that no two symbols share the same |
851 `------------------------------------------------------------------*/
854 symbols_token_translations_init (void)
856 bool num_256_available_p
= true;
859 /* Find the highest user token number, and whether 256, the POSIX
860 preferred user token number for the error token, is used. */
861 max_user_token_number
= 0;
862 for (i
= 0; i
< ntokens
; ++i
)
864 symbol
*this = symbols
[i
];
865 if (this->user_token_number
!= USER_NUMBER_UNDEFINED
)
867 if (this->user_token_number
> max_user_token_number
)
868 max_user_token_number
= this->user_token_number
;
869 if (this->user_token_number
== 256)
870 num_256_available_p
= false;
874 /* If 256 is not used, assign it to error, to follow POSIX. */
875 if (num_256_available_p
876 && errtoken
->user_token_number
== USER_NUMBER_UNDEFINED
)
877 errtoken
->user_token_number
= 256;
879 /* Set the missing user numbers. */
880 if (max_user_token_number
< 256)
881 max_user_token_number
= 256;
883 for (i
= 0; i
< ntokens
; ++i
)
885 symbol
*this = symbols
[i
];
886 if (this->user_token_number
== USER_NUMBER_UNDEFINED
)
887 this->user_token_number
= ++max_user_token_number
;
888 if (this->user_token_number
> max_user_token_number
)
889 max_user_token_number
= this->user_token_number
;
892 token_translations
= xnmalloc (max_user_token_number
+ 1,
893 sizeof *token_translations
);
895 /* Initialize all entries for literal tokens to the internal token
896 number for $undefined, which represents all invalid inputs. */
897 for (i
= 0; i
< max_user_token_number
+ 1; i
++)
898 token_translations
[i
] = undeftoken
->number
;
899 symbols_do (symbol_translation_processor
, NULL
);
903 /*----------------------------------------------------------------.
904 | Assign symbol numbers, and write definition of token names into |
905 | FDEFINES. Set up vectors SYMBOL_TABLE, TAGS of symbols. |
906 `----------------------------------------------------------------*/
911 symbols_do (symbol_check_alias_consistency_processor
, NULL
);
913 symbols
= xcalloc (nsyms
, sizeof *symbols
);
914 symbols_do (symbol_pack_processor
, NULL
);
916 /* Aliases leave empty slots in symbols, so remove them. */
920 int nsyms_old
= nsyms
;
921 for (writei
= 0, readi
= 0; readi
< nsyms_old
; readi
+= 1)
923 if (symbols
[readi
] == NULL
)
930 symbols
[writei
] = symbols
[readi
];
931 symbols
[writei
]->number
= writei
;
932 if (symbols
[writei
]->alias
)
933 symbols
[writei
]->alias
->number
= writei
;
938 symbols
= xnrealloc (symbols
, nsyms
, sizeof *symbols
);
940 symbols_token_translations_init ();
942 if (startsymbol
->class == unknown_sym
)
943 fatal_at (startsymbol_location
,
944 _("the start symbol %s is undefined"),
946 else if (startsymbol
->class == token_sym
)
947 fatal_at (startsymbol_location
,
948 _("the start symbol %s is a token"),
953 /*--------------------------------------------------.
954 | Set default tagged/tagless %destructor/%printer. |
955 `--------------------------------------------------*/
958 default_tagged_destructor_set (code_props
const *destructor
)
960 if (default_tagged_destructor
.code
)
962 complain_at (destructor
->location
,
963 _("redeclaration for default tagged %%destructor"));
964 complain_at (default_tagged_destructor
.location
,
965 _("previous declaration"));
967 default_tagged_destructor
= *destructor
;
971 default_tagless_destructor_set (code_props
const *destructor
)
973 if (default_tagless_destructor
.code
)
975 complain_at (destructor
->location
,
976 _("redeclaration for default tagless %%destructor"));
977 complain_at (default_tagless_destructor
.location
,
978 _("previous declaration"));
980 default_tagless_destructor
= *destructor
;
984 default_tagged_printer_set (code_props
const *printer
)
986 if (default_tagged_printer
.code
)
988 complain_at (printer
->location
,
989 _("redeclaration for default tagged %%printer"));
990 complain_at (default_tagged_printer
.location
,
991 _("previous declaration"));
993 default_tagged_printer
= *printer
;
997 default_tagless_printer_set (code_props
const *printer
)
999 if (default_tagless_printer
.code
)
1001 complain_at (printer
->location
,
1002 _("redeclaration for default tagless %%printer"));
1003 complain_at (default_tagless_printer
.location
,
1004 _("previous declaration"));
1006 default_tagless_printer
= *printer
;