-extern void _initialize_complaints (void);
-
-/* Should each complaint message be self explanatory, or should we assume that
- a series of complaints is being produced? */
-
-/* case 1: First message of a series that must
- start off with explanation. case 2: Subsequent message of a series
- that needs no explanation (the user already knows we have a problem
- so we can just state our piece). */
-enum complaint_series {
- /* Isolated self explanatory message. */
- ISOLATED_MESSAGE,
- /* First message of a series, includes an explanation. */
- FIRST_MESSAGE,
- /* First message of a series, but does not need to include any sort
- of explanation. */
- SHORT_FIRST_MESSAGE,
- /* Subsequent message of a series that needs no explanation (the
- user already knows we have a problem so we can just state our
- piece). */
- SUBSEQUENT_MESSAGE
-};
-
-/* Structure to manage complaints about symbol file contents. */
-
-struct complain
-{
- const char *file;
- int line;
- const char *fmt;
- int counter;
- struct complain *next;
-};
-
-/* The explanatory message that should accompany the complaint. The
- message is in two parts - pre and post - that are printed around
- the complaint text. */
-struct explanation
-{
- const char *prefix;
- const char *postfix;
-};
-
-struct complaints
-{
- struct complain *root;
-
- /* Should each complaint be self explanatory, or should we assume
- that a series of complaints is being produced? case 0: Isolated
- self explanatory message. case 1: First message of a series that
- must start off with explanation. case 2: Subsequent message of a
- series that needs no explanation (the user already knows we have
- a problem so we can just state our piece). */
- int series;
-
- /* The explanatory messages that should accompany the complaint.
- NOTE: cagney/2002-08-14: In a desperate attempt at being vaguely
- i18n friendly, this is an array of two messages. When present,
- the PRE and POST EXPLANATION[SERIES] are used to wrap the
- message. */
- const struct explanation *explanation;
-};
-
-static struct complain complaint_sentinel;
-
-/* The symbol table complaint table. */
-
-static struct explanation symfile_explanations[] = {
- { "During symbol reading, ", "." },
- { "During symbol reading...", "..."},
- { "", "..."},
- { "", "..."},
- { NULL, NULL }
-};
-
-static struct complaints symfile_complaint_book = {
- &complaint_sentinel,
- 0,
- symfile_explanations
-};
-struct complaints *symfile_complaints = &symfile_complaint_book;
-
-/* Wrapper function to, on-demand, fill in a complaints object. */
-
-static struct complaints *
-get_complaints (struct complaints **c)
-{
- if ((*c) != NULL)
- return (*c);
- (*c) = XMALLOC (struct complaints);
- (*c)->root = &complaint_sentinel;
- (*c)->series = ISOLATED_MESSAGE;
- (*c)->explanation = NULL;
- return (*c);
-}
-
-static struct complain *
-find_complaint (struct complaints *complaints, const char *file,
- int line, const char *fmt)
-{
- struct complain *complaint;
-
- /* Find the complaint in the table. A more efficient search
- algorithm (based on hash table or something) could be used. But
- that can wait until someone shows evidence that this lookup is
- a real bottle neck. */
- for (complaint = complaints->root;
- complaint != NULL;
- complaint = complaint->next)
- {
- if (complaint->fmt == fmt
- && complaint->file == file
- && complaint->line == line)
- return complaint;
- }
-
- /* Oops not seen before, fill in a new complaint. */
- complaint = XMALLOC (struct complain);
- complaint->fmt = fmt;
- complaint->file = file;
- complaint->line = line;
- complaint->counter = 0;
- complaint->next = NULL;
-
- /* File it, return it. */
- complaint->next = complaints->root;
- complaints->root = complaint;
- return complaint;
-}