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 | Distinguished symbols. |
34 `------------------------*/
36 symbol
*errtoken
= NULL
;
37 symbol
*undeftoken
= NULL
;
38 symbol
*endtoken
= NULL
;
39 symbol
*accept
= NULL
;
40 symbol
*startsymbol
= NULL
;
41 location startsymbol_location
;
43 /*---------------------------------------.
44 | Default %destructor's and %printer's. |
45 `---------------------------------------*/
47 static code_props default_tagged_destructor
= CODE_PROPS_NONE_INIT
;
48 static code_props default_tagless_destructor
= CODE_PROPS_NONE_INIT
;
49 static code_props default_tagged_printer
= CODE_PROPS_NONE_INIT
;
50 static code_props default_tagless_printer
= CODE_PROPS_NONE_INIT
;
52 /*---------------------------------.
53 | Create a new symbol, named TAG. |
54 `---------------------------------*/
57 symbol_new (uniqstr tag
, location loc
)
59 symbol
*res
= xmalloc (sizeof *res
);
63 /* If the tag is not a string (starts with a double quote), check
64 that it is valid for Yacc. */
65 if (tag
[0] != '\"' && tag
[0] != '\'' && strchr (tag
, '-'))
66 yacc_at (loc
, _("POSIX Yacc forbids dashes in symbol names: %s"),
72 res
->type_name
= NULL
;
73 code_props_none_init (&res
->destructor
);
74 code_props_none_init (&res
->printer
);
76 res
->number
= NUMBER_UNDEFINED
;
78 res
->assoc
= undef_assoc
;
79 res
->user_token_number
= USER_NUMBER_UNDEFINED
;
82 res
->class = unknown_sym
;
83 res
->declared
= false;
85 if (nsyms
== SYMBOL_NUMBER_MAXIMUM
)
86 fatal (_("too many symbols in input grammar (limit is %d)"),
87 SYMBOL_NUMBER_MAXIMUM
);
92 /*----------------------------------------.
93 | Create a new semantic type, named TAG. |
94 `----------------------------------------*/
96 static semantic_type
*
97 semantic_type_new (uniqstr tag
)
99 semantic_type
*res
= xmalloc (sizeof *res
);
101 uniqstr_assert (tag
);
103 code_props_none_init (&res
->destructor
);
104 code_props_none_init (&res
->printer
);
114 #define SYMBOL_ATTR_PRINT(Attr) \
116 fprintf (f, " %s { %s }", #Attr, s->Attr)
118 #define SYMBOL_CODE_PRINT(Attr) \
120 fprintf (f, " %s { %s }", #Attr, s->Attr.code)
123 symbol_print (symbol
*s
, FILE *f
)
127 fprintf (f
, "\"%s\"", s
->tag
);
128 SYMBOL_ATTR_PRINT (type_name
);
129 SYMBOL_CODE_PRINT (destructor
);
130 SYMBOL_CODE_PRINT (printer
);
133 fprintf (f
, "<NULL>");
136 #undef SYMBOL_ATTR_PRINT
137 #undef SYMBOL_CODE_PRINT
140 /*----------------------------------.
141 | Whether S is a valid identifier. |
142 `----------------------------------*/
145 is_identifier (uniqstr s
)
147 static char const alphanum
[26 + 26 + 1 + 10] =
148 "abcdefghijklmnopqrstuvwxyz"
149 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
152 if (!s
|| ! memchr (alphanum
, *s
, sizeof alphanum
- 10))
155 if (! memchr (alphanum
, *s
, sizeof alphanum
))
161 /*-----------------------------------------------.
162 | Get the identifier associated to this symbol. |
163 `-----------------------------------------------*/
165 symbol_id_get (symbol
const *sym
)
167 aver (sym
->user_token_number
!= USER_NUMBER_ALIAS
);
170 return is_identifier (sym
->tag
) ? sym
->tag
: 0;
174 /*------------------------------------------------------------------.
175 | Complain that S's WHAT is redeclared at SECOND, and was first set |
177 `------------------------------------------------------------------*/
180 symbol_redeclaration (symbol
*s
, const char *what
, location first
,
183 complain_at (second
, _("%s redeclaration for %s"), what
, s
->tag
);
184 complain_at (first
, _("previous declaration"));
188 semantic_type_redeclaration (semantic_type
*s
, const char *what
, location first
,
191 complain_at (second
, _("%s redeclaration for <%s>"), what
, s
->tag
);
192 complain_at (first
, _("previous declaration"));
197 /*-----------------------------------------------------------------.
198 | Set the TYPE_NAME associated with SYM. Does nothing if passed 0 |
200 `-----------------------------------------------------------------*/
203 symbol_type_set (symbol
*sym
, uniqstr type_name
, location loc
)
208 symbol_redeclaration (sym
, "%type", sym
->type_location
, loc
);
209 uniqstr_assert (type_name
);
210 sym
->type_name
= type_name
;
211 sym
->type_location
= loc
;
215 /*-----------------------------------.
216 | Get the CLASS associated with SYM. |
217 `-----------------------------------*/
220 symbol_class_get_string (symbol
*sym
)
224 if (sym
->class == token_sym
)
226 else if (sym
->class == nterm_sym
)
227 return "nonterminal";
233 /*-----------------------------------------.
234 | Set the DESTRUCTOR associated with SYM. |
235 `-----------------------------------------*/
238 symbol_destructor_set (symbol
*sym
, code_props
const *destructor
)
240 if (sym
->destructor
.code
)
241 symbol_redeclaration (sym
, "%destructor", sym
->destructor
.location
,
242 destructor
->location
);
243 sym
->destructor
= *destructor
;
246 /*------------------------------------------.
247 | Set the DESTRUCTOR associated with TYPE. |
248 `------------------------------------------*/
251 semantic_type_destructor_set (semantic_type
*type
,
252 code_props
const *destructor
)
254 if (type
->destructor
.code
)
255 semantic_type_redeclaration (type
, "%destructor",
256 type
->destructor
.location
,
257 destructor
->location
);
258 type
->destructor
= *destructor
;
261 /*---------------------------------------.
262 | Get the computed %destructor for SYM. |
263 `---------------------------------------*/
266 symbol_destructor_get (symbol
const *sym
)
268 /* Per-symbol %destructor. */
269 if (sym
->destructor
.code
)
270 return &sym
->destructor
;
272 /* Per-type %destructor. */
275 code_props
const *destructor
=
276 &semantic_type_get (sym
->type_name
)->destructor
;
277 if (destructor
->code
)
281 /* Apply default %destructor's only to user-defined symbols. */
282 if (sym
->tag
[0] == '$' || sym
== errtoken
)
283 return &code_props_none
;
286 return &default_tagged_destructor
;
287 return &default_tagless_destructor
;
290 /*--------------------------------------.
291 | Set the PRINTER associated with SYM. |
292 `--------------------------------------*/
295 symbol_printer_set (symbol
*sym
, code_props
const *printer
)
297 if (sym
->printer
.code
)
298 symbol_redeclaration (sym
, "%printer",
299 sym
->printer
.location
, printer
->location
);
300 sym
->printer
= *printer
;
303 /*---------------------------------------.
304 | Set the PRINTER associated with TYPE. |
305 `---------------------------------------*/
308 semantic_type_printer_set (semantic_type
*type
, code_props
const *printer
)
310 if (type
->printer
.code
)
311 semantic_type_redeclaration (type
, "%printer",
312 type
->printer
.location
, printer
->location
);
313 type
->printer
= *printer
;
316 /*------------------------------------.
317 | Get the computed %printer for SYM. |
318 `------------------------------------*/
321 symbol_printer_get (symbol
const *sym
)
323 /* Per-symbol %printer. */
324 if (sym
->printer
.code
)
325 return &sym
->printer
;
327 /* Per-type %printer. */
330 code_props
const *printer
= &semantic_type_get (sym
->type_name
)->printer
;
335 /* Apply the default %printer only to user-defined symbols. */
336 if (sym
->tag
[0] == '$' || sym
== errtoken
)
337 return &code_props_none
;
340 return &default_tagged_printer
;
341 return &default_tagless_printer
;
344 /*-----------------------------------------------------------------.
345 | Set the PRECEDENCE associated with SYM. Does nothing if invoked |
346 | with UNDEF_ASSOC as ASSOC. |
347 `-----------------------------------------------------------------*/
350 symbol_precedence_set (symbol
*sym
, int prec
, assoc a
, location loc
)
352 if (a
!= undef_assoc
)
355 symbol_redeclaration (sym
, assoc_to_string (a
), sym
->prec_location
,
359 sym
->prec_location
= loc
;
362 /* Only terminals have a precedence. */
363 symbol_class_set (sym
, token_sym
, loc
, false);
367 /*------------------------------------.
368 | Set the CLASS associated with SYM. |
369 `------------------------------------*/
372 symbol_class_set (symbol
*sym
, symbol_class
class, location loc
, bool declaring
)
374 if (sym
->class != unknown_sym
&& sym
->class != class)
376 complain_at (loc
, _("symbol %s redefined"), sym
->tag
);
377 sym
->declared
= false;
380 if (class == nterm_sym
&& sym
->class != nterm_sym
)
381 sym
->number
= nvars
++;
382 else if (class == token_sym
&& sym
->number
== NUMBER_UNDEFINED
)
383 sym
->number
= ntokens
++;
390 warn_at (loc
, _("symbol %s redeclared"), sym
->tag
);
391 sym
->declared
= true;
396 /*------------------------------------------------.
397 | Set the USER_TOKEN_NUMBER associated with SYM. |
398 `------------------------------------------------*/
401 symbol_user_token_number_set (symbol
*sym
, int user_token_number
, location loc
)
403 int *user_token_numberp
;
405 if (sym
->user_token_number
!= USER_NUMBER_ALIAS
)
406 user_token_numberp
= &sym
->user_token_number
;
408 user_token_numberp
= &sym
->alias
->user_token_number
;
409 if (*user_token_numberp
!= USER_NUMBER_UNDEFINED
410 && *user_token_numberp
!= user_token_number
)
411 complain_at (loc
, _("redefining user token number of %s"), sym
->tag
);
413 *user_token_numberp
= user_token_number
;
414 /* User defined $end token? */
415 if (user_token_number
== 0)
418 endtoken
->number
= 0;
419 /* It is always mapped to 0, so it was already counted in
426 /*----------------------------------------------------------.
427 | If SYM is not defined, report an error, and consider it a |
429 `----------------------------------------------------------*/
432 symbol_check_defined (symbol
*sym
)
434 if (sym
->class == unknown_sym
)
438 _("symbol %s is used, but is not defined as a token and has no rules"),
440 sym
->class = nterm_sym
;
441 sym
->number
= nvars
++;
448 symbol_check_defined_processor (void *sym
, void *null ATTRIBUTE_UNUSED
)
450 return symbol_check_defined (sym
);
454 /*------------------------------------------------------------------.
455 | Declare the new symbol SYM. Make it an alias of SYMVAL, and type |
456 | SYMVAL with SYM's type. |
457 `------------------------------------------------------------------*/
460 symbol_make_alias (symbol
*sym
, symbol
*symval
, location loc
)
463 warn_at (loc
, _("symbol `%s' used more than once as a literal string"),
466 warn_at (loc
, _("symbol `%s' given more than one literal string"),
470 symval
->class = token_sym
;
471 symval
->user_token_number
= sym
->user_token_number
;
472 sym
->user_token_number
= USER_NUMBER_ALIAS
;
475 symval
->number
= sym
->number
;
476 symbol_type_set (symval
, sym
->type_name
, loc
);
481 /*---------------------------------------------------------.
482 | Check that THIS, and its alias, have same precedence and |
484 `---------------------------------------------------------*/
487 symbol_check_alias_consistency (symbol
*this)
489 symbol
*alias
= this;
490 symbol
*orig
= this->alias
;
492 /* Check only those that _are_ the aliases. */
493 if (!(this->alias
&& this->user_token_number
== USER_NUMBER_ALIAS
))
496 if (orig
->type_name
!= alias
->type_name
)
499 symbol_type_set (alias
, orig
->type_name
, orig
->type_location
);
501 symbol_type_set (orig
, alias
->type_name
, alias
->type_location
);
505 if (orig
->destructor
.code
|| alias
->destructor
.code
)
507 if (orig
->destructor
.code
)
508 symbol_destructor_set (alias
, &orig
->destructor
);
510 symbol_destructor_set (orig
, &alias
->destructor
);
513 if (orig
->printer
.code
|| alias
->printer
.code
)
515 if (orig
->printer
.code
)
516 symbol_printer_set (alias
, &orig
->printer
);
518 symbol_printer_set (orig
, &alias
->printer
);
521 if (alias
->prec
|| orig
->prec
)
524 symbol_precedence_set (alias
, orig
->prec
, orig
->assoc
,
525 orig
->prec_location
);
527 symbol_precedence_set (orig
, alias
->prec
, alias
->assoc
,
528 alias
->prec_location
);
533 symbol_check_alias_consistency_processor (void *this,
534 void *null ATTRIBUTE_UNUSED
)
536 symbol_check_alias_consistency (this);
541 /*-------------------------------------------------------------------.
542 | Assign a symbol number, and write the definition of the token name |
543 | into FDEFINES. Put in SYMBOLS. |
544 `-------------------------------------------------------------------*/
547 symbol_pack (symbol
*this)
549 if (this->class == nterm_sym
)
551 this->number
+= ntokens
;
553 else if (this->alias
)
555 /* This symbol and its alias are a single token defn.
556 Allocate a tokno, and assign to both check agreement of
557 prec and assoc fields and make both the same */
558 if (this->number
== NUMBER_UNDEFINED
)
560 if (this == endtoken
|| this->alias
== endtoken
)
561 this->number
= this->alias
->number
= 0;
564 aver (this->alias
->number
!= NUMBER_UNDEFINED
);
565 this->number
= this->alias
->number
;
568 /* Do not do processing below for USER_NUMBER_ALIASes. */
569 if (this->user_token_number
== USER_NUMBER_ALIAS
)
572 else /* this->class == token_sym */
573 aver (this->number
!= NUMBER_UNDEFINED
);
575 symbols
[this->number
] = this;
580 symbol_pack_processor (void *this, void *null ATTRIBUTE_UNUSED
)
582 return symbol_pack (this);
587 user_token_number_redeclaration (int num
, symbol
*first
, symbol
*second
)
589 /* User token numbers are not assigned during the parsing, but in a
590 second step, via a (nondeterministic) traversal of the symbol
593 Make errors deterministic: keep the first declaration first. */
594 if (location_cmp (first
->location
, second
->location
) > 0)
600 complain_at (second
->location
,
601 _("user token number %d redeclaration for %s"),
603 complain_at (first
->location
, _("previous declaration for %s"),
607 /*--------------------------------------------------.
608 | Put THIS in TOKEN_TRANSLATIONS if it is a token. |
609 `--------------------------------------------------*/
612 symbol_translation (symbol
*this)
615 if (this->class == token_sym
616 && this->user_token_number
!= USER_NUMBER_ALIAS
)
618 /* A token which translation has already been set? */
619 if (token_translations
[this->user_token_number
] != undeftoken
->number
)
620 user_token_number_redeclaration
621 (this->user_token_number
,
622 symbols
[token_translations
[this->user_token_number
]],
625 token_translations
[this->user_token_number
] = this->number
;
632 symbol_translation_processor (void *this, void *null ATTRIBUTE_UNUSED
)
634 return symbol_translation (this);
638 /*---------------------------------------.
639 | Symbol and semantic type hash tables. |
640 `---------------------------------------*/
642 /* Initial capacity of symbol and semantic type hash table. */
643 #define HT_INITIAL_CAPACITY 257
645 static struct hash_table
*symbol_table
= NULL
;
646 static struct hash_table
*semantic_type_table
= NULL
;
649 hash_compare_symbol (const symbol
*m1
, const symbol
*m2
)
651 /* Since tags are unique, we can compare the pointers themselves. */
652 return UNIQSTR_EQ (m1
->tag
, m2
->tag
);
656 hash_compare_semantic_type (const semantic_type
*m1
, const semantic_type
*m2
)
658 /* Since names are unique, we can compare the pointers themselves. */
659 return UNIQSTR_EQ (m1
->tag
, m2
->tag
);
663 hash_symbol_comparator (void const *m1
, void const *m2
)
665 return hash_compare_symbol (m1
, m2
);
669 hash_semantic_type_comparator (void const *m1
, void const *m2
)
671 return hash_compare_semantic_type (m1
, m2
);
675 hash_symbol (const symbol
*m
, size_t tablesize
)
677 /* Since tags are unique, we can hash the pointer itself. */
678 return ((uintptr_t) m
->tag
) % tablesize
;
682 hash_semantic_type (const semantic_type
*m
, size_t tablesize
)
684 /* Since names are unique, we can hash the pointer itself. */
685 return ((uintptr_t) m
->tag
) % tablesize
;
689 hash_symbol_hasher (void const *m
, size_t tablesize
)
691 return hash_symbol (m
, tablesize
);
695 hash_semantic_type_hasher (void const *m
, size_t tablesize
)
697 return hash_semantic_type (m
, tablesize
);
700 /*-------------------------------.
701 | Create the symbol hash table. |
702 `-------------------------------*/
707 symbol_table
= hash_initialize (HT_INITIAL_CAPACITY
,
710 hash_symbol_comparator
,
712 semantic_type_table
= hash_initialize (HT_INITIAL_CAPACITY
,
714 hash_semantic_type_hasher
,
715 hash_semantic_type_comparator
,
720 /*----------------------------------------------------------------.
721 | Find the symbol named KEY, and return it. If it does not exist |
723 `----------------------------------------------------------------*/
726 symbol_from_uniqstr (const uniqstr key
, location loc
)
732 entry
= hash_lookup (symbol_table
, &probe
);
736 /* First insertion in the hash. */
737 entry
= symbol_new (key
, loc
);
738 if (!hash_insert (symbol_table
, entry
))
745 /*-----------------------------------------------------------------------.
746 | Find the semantic type named KEY, and return it. If it does not exist |
748 `-----------------------------------------------------------------------*/
751 semantic_type_from_uniqstr (const uniqstr key
)
754 semantic_type
*entry
;
757 entry
= hash_lookup (semantic_type_table
, &probe
);
761 /* First insertion in the hash. */
762 entry
= semantic_type_new (key
);
763 if (!hash_insert (semantic_type_table
, entry
))
770 /*----------------------------------------------------------------.
771 | Find the symbol named KEY, and return it. If it does not exist |
773 `----------------------------------------------------------------*/
776 symbol_get (const char *key
, location loc
)
778 return symbol_from_uniqstr (uniqstr_new (key
), loc
);
782 /*-----------------------------------------------------------------------.
783 | Find the semantic type named KEY, and return it. If it does not exist |
785 `-----------------------------------------------------------------------*/
788 semantic_type_get (const char *key
)
790 return semantic_type_from_uniqstr (uniqstr_new (key
));
794 /*------------------------------------------------------------------.
795 | Generate a dummy nonterminal, whose name cannot conflict with the |
797 `------------------------------------------------------------------*/
800 dummy_symbol_get (location loc
)
802 /* Incremented for each generated symbol. */
803 static int dummy_count
= 0;
804 static char buf
[256];
808 sprintf (buf
, "$@%d", ++dummy_count
);
809 sym
= symbol_get (buf
, loc
);
810 sym
->class = nterm_sym
;
811 sym
->number
= nvars
++;
816 symbol_is_dummy (const symbol
*sym
)
818 return sym
->tag
[0] == '@' || (sym
->tag
[0] == '$' && sym
->tag
[1] == '@');
821 /*-------------------.
822 | Free the symbols. |
823 `-------------------*/
828 hash_free (symbol_table
);
829 hash_free (semantic_type_table
);
834 /*---------------------------------------------------------------.
835 | Look for undefined symbols, report an error, and consider them |
837 `---------------------------------------------------------------*/
840 symbols_do (Hash_processor processor
, void *processor_data
)
842 hash_do_for_each (symbol_table
, processor
, processor_data
);
846 /*--------------------------------------------------------------.
847 | Check that all the symbols are defined. Report any undefined |
848 | symbols and consider them nonterminals. |
849 `--------------------------------------------------------------*/
852 symbols_check_defined (void)
854 symbols_do (symbol_check_defined_processor
, NULL
);
857 /*------------------------------------------------------------------.
858 | Set TOKEN_TRANSLATIONS. Check that no two symbols share the same |
860 `------------------------------------------------------------------*/
863 symbols_token_translations_init (void)
865 bool num_256_available_p
= true;
868 /* Find the highest user token number, and whether 256, the POSIX
869 preferred user token number for the error token, is used. */
870 max_user_token_number
= 0;
871 for (i
= 0; i
< ntokens
; ++i
)
873 symbol
*this = symbols
[i
];
874 if (this->user_token_number
!= USER_NUMBER_UNDEFINED
)
876 if (this->user_token_number
> max_user_token_number
)
877 max_user_token_number
= this->user_token_number
;
878 if (this->user_token_number
== 256)
879 num_256_available_p
= false;
883 /* If 256 is not used, assign it to error, to follow POSIX. */
884 if (num_256_available_p
885 && errtoken
->user_token_number
== USER_NUMBER_UNDEFINED
)
886 errtoken
->user_token_number
= 256;
888 /* Set the missing user numbers. */
889 if (max_user_token_number
< 256)
890 max_user_token_number
= 256;
892 for (i
= 0; i
< ntokens
; ++i
)
894 symbol
*this = symbols
[i
];
895 if (this->user_token_number
== USER_NUMBER_UNDEFINED
)
896 this->user_token_number
= ++max_user_token_number
;
897 if (this->user_token_number
> max_user_token_number
)
898 max_user_token_number
= this->user_token_number
;
901 token_translations
= xnmalloc (max_user_token_number
+ 1,
902 sizeof *token_translations
);
904 /* Initialize all entries for literal tokens to the internal token
905 number for $undefined, which represents all invalid inputs. */
906 for (i
= 0; i
< max_user_token_number
+ 1; i
++)
907 token_translations
[i
] = undeftoken
->number
;
908 symbols_do (symbol_translation_processor
, NULL
);
912 /*----------------------------------------------------------------.
913 | Assign symbol numbers, and write definition of token names into |
914 | FDEFINES. Set up vectors SYMBOL_TABLE, TAGS of symbols. |
915 `----------------------------------------------------------------*/
920 symbols_do (symbol_check_alias_consistency_processor
, NULL
);
922 symbols
= xcalloc (nsyms
, sizeof *symbols
);
923 symbols_do (symbol_pack_processor
, NULL
);
925 /* Aliases leave empty slots in symbols, so remove them. */
929 int nsyms_old
= nsyms
;
930 for (writei
= 0, readi
= 0; readi
< nsyms_old
; readi
+= 1)
932 if (symbols
[readi
] == NULL
)
939 symbols
[writei
] = symbols
[readi
];
940 symbols
[writei
]->number
= writei
;
941 if (symbols
[writei
]->alias
)
942 symbols
[writei
]->alias
->number
= writei
;
947 symbols
= xnrealloc (symbols
, nsyms
, sizeof *symbols
);
949 symbols_token_translations_init ();
951 if (startsymbol
->class == unknown_sym
)
952 fatal_at (startsymbol_location
,
953 _("the start symbol %s is undefined"),
955 else if (startsymbol
->class == token_sym
)
956 fatal_at (startsymbol_location
,
957 _("the start symbol %s is a token"),
962 /*--------------------------------------------------.
963 | Set default tagged/tagless %destructor/%printer. |
964 `--------------------------------------------------*/
967 default_tagged_destructor_set (code_props
const *destructor
)
969 if (default_tagged_destructor
.code
)
971 complain_at (destructor
->location
,
972 _("redeclaration for default tagged %%destructor"));
973 complain_at (default_tagged_destructor
.location
,
974 _("previous declaration"));
976 default_tagged_destructor
= *destructor
;
980 default_tagless_destructor_set (code_props
const *destructor
)
982 if (default_tagless_destructor
.code
)
984 complain_at (destructor
->location
,
985 _("redeclaration for default tagless %%destructor"));
986 complain_at (default_tagless_destructor
.location
,
987 _("previous declaration"));
989 default_tagless_destructor
= *destructor
;
993 default_tagged_printer_set (code_props
const *printer
)
995 if (default_tagged_printer
.code
)
997 complain_at (printer
->location
,
998 _("redeclaration for default tagged %%printer"));
999 complain_at (default_tagged_printer
.location
,
1000 _("previous declaration"));
1002 default_tagged_printer
= *printer
;
1006 default_tagless_printer_set (code_props
const *printer
)
1008 if (default_tagless_printer
.code
)
1010 complain_at (printer
->location
,
1011 _("redeclaration for default tagless %%printer"));
1012 complain_at (default_tagless_printer
.location
,
1013 _("previous declaration"));
1015 default_tagless_printer
= *printer
;