OSDN Git Service

* diagnostic.c (v_message_with_decl): Use .* format specifier
[pf3gnuchains/gcc-fork.git] / gcc / diagnostic.c
1 /* Top level of GNU C compiler
2    Copyright (C) 1999 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
20
21
22 /* This file implements the language independant aspect of diagnostic
23    message module.  */
24
25 #include "config.h"
26 #undef FLOAT /* This is for hpux. They should change hpux.  */
27 #undef FFS  /* Some systems define this in param.h.  */
28 #include "system.h"
29
30 #include "tree.h"
31 #include "rtl.h"
32 #include "tm_p.h"
33 #include "flags.h"
34 #include "input.h"
35 #include "insn-attr.h"
36 #include "insn-codes.h"
37 #include "insn-config.h"
38 #include "toplev.h"
39 #include "intl.h"
40
41
42 /* Prototypes. */
43 static void notice PVPROTO((const char *s, ...)) ATTRIBUTE_PRINTF_1;
44 static void vmessage PROTO((const char *, const char *, va_list));
45 static void v_message_with_file_and_line PROTO((const char *, int, int,
46                                                 const char *, va_list));
47 static void v_message_with_decl PROTO((tree, int, const char *, va_list));
48 static void file_and_line_for_asm PROTO((rtx, char **, int *));
49 static void v_error_with_file_and_line PROTO((const char *, int,
50                                               const char *, va_list));
51 static void v_error_with_decl PROTO((tree, const char *, va_list));
52 static void v_error_for_asm PROTO((rtx, const char *, va_list));
53 static void verror PROTO((const char *, va_list));
54 static void vfatal PROTO((const char *, va_list)) ATTRIBUTE_NORETURN;
55 static void v_warning_with_file_and_line PROTO ((const char *, int,
56                                                  const char *, va_list));
57 static void v_warning_with_decl PROTO((tree, const char *, va_list));
58 static void v_warning_for_asm PROTO((rtx, const char *, va_list));
59 static void vwarning PROTO((const char *, va_list));
60 static void vpedwarn PROTO((const char *, va_list));
61 static void v_pedwarn_with_decl PROTO((tree, const char *, va_list));
62 static void v_pedwarn_with_file_and_line PROTO((const char *, int,
63                                                 const char *, va_list));
64 static void vsorry PROTO((const char *, va_list));
65 static void report_file_and_line PROTO ((const char *, int, int));
66 static void vnotice PROTO ((FILE *, const char *, va_list));
67
68
69 extern int rtl_dump_and_exit;
70 extern int inhibit_warnings;
71 extern int warnings_are_errors;
72 extern int warningcount;
73 extern int errorcount;
74
75 static int need_error_newline;
76
77 /* Function of last error message;
78    more generally, function such that if next error message is in it
79    then we don't have to mention the function name.  */
80 static tree last_error_function = NULL;
81
82 /* Used to detect when input_file_stack has changed since last described.  */
83 static int last_error_tick;
84
85 /* Called by report_error_function to print out function name.
86  * Default may be overridden by language front-ends.  */
87
88 void (*print_error_function) PROTO((const char *)) =
89   default_print_error_function;
90
91 \f
92 /* Print the message MSGID in FILE.  */
93
94 static void
95 vnotice (file, msgid, ap)
96      FILE *file;
97      const char *msgid;
98      va_list ap;
99 {
100   vfprintf (file, _(msgid), ap);
101 }
102
103 /* Print MSGID on stderr.  */
104
105 static void
106 notice VPROTO((const char *msgid, ...))
107 {
108 #ifndef ANSI_PROTOTYPES
109   char *msgid;
110 #endif
111   va_list ap;
112
113   VA_START (ap, msgid);
114
115 #ifndef ANSI_PROTOTYPES
116   msgid = va_arg (ap, char *);
117 #endif
118
119   vnotice (stderr, msgid, ap);
120   va_end (ap);
121 }
122
123 /* Report FILE and LINE (or program name), and optionally just WARN.  */
124
125 static void
126 report_file_and_line (file, line, warn)
127      const char *file;
128      int line;
129      int warn;
130 {
131   if (file)
132     fprintf (stderr, "%s:%d: ", file, line);
133   else
134     fprintf (stderr, "%s: ", progname);
135
136   if (warn)
137     notice ("warning: ");
138 }
139
140 /* Print a PREFIXed MSGID.  */
141
142 static void
143 vmessage (prefix, msgid, ap)
144      const char *prefix;
145      const char *msgid;
146      va_list ap;
147 {
148   if (prefix)
149     fprintf (stderr, "%s: ", prefix);
150
151   vfprintf (stderr, msgid, ap);
152 }
153
154 /* Print a message relevant to line LINE of file FILE.  */
155
156 static void
157 v_message_with_file_and_line (file, line, warn, msgid, ap)
158      const char *file;
159      int line;
160      int warn;
161      const char *msgid;
162      va_list ap;
163 {
164   report_file_and_line (file, line, warn);
165   vnotice (stderr, msgid, ap);
166   fputc ('\n', stderr);
167 }
168
169 /* Print a message relevant to the given DECL.  */
170
171 static void
172 v_message_with_decl (decl, warn, msgid, ap)
173      tree decl;
174      int warn;
175      const char *msgid;
176      va_list ap;
177 {
178   const char *p;
179
180   report_file_and_line (DECL_SOURCE_FILE (decl),
181                         DECL_SOURCE_LINE (decl), warn);
182
183   /* Do magic to get around lack of varargs support for insertion
184      of arguments into existing list.  We know that the decl is first;
185      we ass_u_me that it will be printed with "%s".  */
186
187   for (p = _(msgid); *p; ++p)
188     {
189       if (*p == '%')
190         {
191           if (*(p + 1) == '%')
192             ++p;
193           else if (*(p + 1) != 's')
194             abort ();
195           else
196             break;
197         }
198     }
199
200   if (p > _(msgid))                     /* Print the left-hand substring.  */
201     fprintf (stderr, "%.*s", (int)(p - _(msgid)), _(msgid));
202
203   if (*p == '%')                /* Print the name.  */
204     {
205       const char *n = (DECL_NAME (decl)
206                  ? (*decl_printable_name) (decl, 2)
207                  : "((anonymous))");
208       fputs (n, stderr);
209       while (*p)
210         {
211           ++p;
212           if (ISALPHA (*(p - 1) & 0xFF))
213             break;
214         }
215     }
216
217   if (*p)                       /* Print the rest of the message.  */
218     vmessage ((char *)NULL, p, ap);
219
220   fputc ('\n', stderr);
221 }
222
223 /* Figure file and line of the given INSN.  */
224
225 static void
226 file_and_line_for_asm (insn, pfile, pline)
227      rtx insn;
228      char **pfile;
229      int *pline;
230 {
231   rtx body = PATTERN (insn);
232   rtx asmop;
233
234   /* Find the (or one of the) ASM_OPERANDS in the insn.  */
235   if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
236     asmop = SET_SRC (body);
237   else if (GET_CODE (body) == ASM_OPERANDS)
238     asmop = body;
239   else if (GET_CODE (body) == PARALLEL
240            && GET_CODE (XVECEXP (body, 0, 0)) == SET)
241     asmop = SET_SRC (XVECEXP (body, 0, 0));
242   else if (GET_CODE (body) == PARALLEL
243            && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
244     asmop = XVECEXP (body, 0, 0);
245   else
246     asmop = NULL;
247
248   if (asmop)
249     {
250       *pfile = ASM_OPERANDS_SOURCE_FILE (asmop);
251       *pline = ASM_OPERANDS_SOURCE_LINE (asmop);
252     }
253   else
254     {
255       *pfile = input_filename;
256       *pline = lineno;
257     }
258 }
259
260 /* Report an error at line LINE of file FILE.  */
261
262 static void
263 v_error_with_file_and_line (file, line, msgid, ap)
264      const char *file;
265      int line;
266      const char *msgid;
267      va_list ap;
268 {
269   count_error (0);
270   report_error_function (file);
271   v_message_with_file_and_line (file, line, 0, msgid, ap);
272 }
273
274 /* Report an error at the declaration DECL.
275    MSGID is a format string which uses %s to substitute the declaration
276    name; subsequent substitutions are a la printf.  */
277
278 static void
279 v_error_with_decl (decl, msgid, ap)
280      tree decl;
281      const char *msgid;
282      va_list ap;
283 {
284   count_error (0);
285   report_error_function (DECL_SOURCE_FILE (decl));
286   v_message_with_decl (decl, 0, msgid, ap);
287 }
288
289
290 /* Report an error at the line number of the insn INSN.
291    This is used only when INSN is an `asm' with operands,
292    and each ASM_OPERANDS records its own source file and line.  */
293
294 static void
295 v_error_for_asm (insn, msgid, ap)
296      rtx insn;
297      const char *msgid;
298      va_list ap;
299 {
300   char *file;
301   int line;
302
303   count_error (0);
304   file_and_line_for_asm (insn, &file, &line);
305   report_error_function (file);
306   v_message_with_file_and_line (file, line, 0, msgid, ap);
307 }
308
309
310 /* Report an error at the current line number.  */
311
312 static void
313 verror (msgid, ap)
314      const char *msgid;
315      va_list ap;
316 {
317   v_error_with_file_and_line (input_filename, lineno, msgid, ap);
318 }
319
320
321 /* Report a fatal error at the current line number.  Allow a front end to
322    intercept the message.  */
323
324 static void (*fatal_function) PROTO ((const char *, va_list));
325
326 static void
327 vfatal (msgid, ap)
328      const char *msgid;
329      va_list ap;
330 {
331    if (fatal_function != 0)
332      (*fatal_function) (_(msgid), ap);
333
334   verror (msgid, ap);
335   exit (FATAL_EXIT_CODE);
336 }
337
338 /* Report a warning at line LINE of file FILE.  */
339
340 static void
341 v_warning_with_file_and_line (file, line, msgid, ap)
342      const char *file;
343      int line;
344      const char *msgid;
345      va_list ap;
346 {
347   if (count_error (1))
348     {
349       report_error_function (file);
350       v_message_with_file_and_line (file, line, 1, msgid, ap);
351     }
352 }
353
354
355 /* Report a warning at the declaration DECL.
356    MSGID is a format string which uses %s to substitute the declaration
357    name; subsequent substitutions are a la printf.  */
358
359 static void
360 v_warning_with_decl (decl, msgid, ap)
361      tree decl;
362      const char *msgid;
363      va_list ap;
364 {
365   if (count_error (1))
366     {
367       report_error_function (DECL_SOURCE_FILE (decl));
368       v_message_with_decl (decl, 1, msgid, ap);
369     }
370 }
371
372
373 /* Report a warning at the line number of the insn INSN.
374    This is used only when INSN is an `asm' with operands,
375    and each ASM_OPERANDS records its own source file and line.  */
376
377 static void
378 v_warning_for_asm (insn, msgid, ap)
379      rtx insn;
380      const char *msgid;
381      va_list ap;
382 {
383   if (count_error (1))
384     {
385       char *file;
386       int line;
387
388       file_and_line_for_asm (insn, &file, &line);
389       report_error_function (file);
390       v_message_with_file_and_line (file, line, 1, msgid, ap);
391     }
392 }
393
394
395 /* Report a warning at the current line number.  */
396
397 static void
398 vwarning (msgid, ap)
399      const char *msgid;
400      va_list ap;
401 {
402   v_warning_with_file_and_line (input_filename, lineno, msgid, ap);
403 }
404
405 /* These functions issue either warnings or errors depending on
406    -pedantic-errors.  */
407
408 static void
409 vpedwarn (msgid, ap)
410      const char *msgid;
411      va_list ap;
412 {
413   if (flag_pedantic_errors)
414     verror (msgid, ap);
415   else
416     vwarning (msgid, ap);
417 }
418
419
420 static void
421 v_pedwarn_with_decl (decl, msgid, ap)
422      tree decl;
423      const char *msgid;
424      va_list ap;
425 {
426   /* We don't want -pedantic-errors to cause the compilation to fail from
427      "errors" in system header files.  Sometimes fixincludes can't fix what's
428      broken (eg: unsigned char bitfields - fixing it may change the alignment
429      which will cause programs to mysteriously fail because the C library
430      or kernel uses the original layout).  There's no point in issuing a
431      warning either, it's just unnecessary noise.  */
432
433   if (! DECL_IN_SYSTEM_HEADER (decl))
434     {
435       if (flag_pedantic_errors)
436         v_error_with_decl (decl, msgid, ap);
437       else
438         v_warning_with_decl (decl, msgid, ap);
439     }
440 }
441
442
443 static void
444 v_pedwarn_with_file_and_line (file, line, msgid, ap)
445      const char *file;
446      int line;
447      const char *msgid;
448      va_list ap;
449 {
450   if (flag_pedantic_errors)
451     v_error_with_file_and_line (file, line, msgid, ap);
452   else
453     v_warning_with_file_and_line (file, line, msgid, ap);
454 }
455
456
457 /* Apologize for not implementing some feature.  */
458
459 static void
460 vsorry (msgid, ap)
461      const char *msgid;
462      va_list ap;
463 {
464   sorrycount++;
465   if (input_filename)
466     fprintf (stderr, "%s:%d: ", input_filename, lineno);
467   else
468     fprintf (stderr, "%s: ", progname);
469   notice ("sorry, not implemented: ");
470   vnotice (stderr, msgid, ap);
471   fputc ('\n', stderr);
472 }
473
474 \f
475 /* Count an error or warning.  Return 1 if the message should be printed.  */
476
477 int
478 count_error (warningp)
479      int warningp;
480 {
481   if (warningp && inhibit_warnings)
482     return 0;
483
484   if (warningp && !warnings_are_errors)
485     warningcount++;
486   else
487     {
488       static int warning_message = 0;
489
490       if (warningp && !warning_message)
491         {
492           notice ("%s: warnings being treated as errors\n", progname);
493           warning_message = 1;
494         }
495       errorcount++;
496     }
497
498   return 1;
499 }
500
501 /* Print a diagnistic MSGID on FILE.  */
502 void
503 fnotice VPROTO((FILE *file, const char *msgid, ...))
504 {
505 #ifndef ANSI_PROTOTYPES
506   FILE *file;
507   const char *msgid;
508 #endif
509   va_list ap;
510
511   VA_START (ap, msgid);
512
513 #ifndef ANSI_PROTOTYPES
514   file = va_arg (ap, FILE *);
515   msgid = va_arg (ap, const char *);
516 #endif
517
518   vnotice (file, msgid, ap);
519   va_end (ap);
520 }
521
522
523 /* Print a fatal error message.  NAME is the text.
524    Also include a system error message based on `errno'.  */
525
526 void
527 pfatal_with_name (name)
528   const char *name;
529 {
530   fprintf (stderr, "%s: ", progname);
531   perror (name);
532   exit (FATAL_EXIT_CODE);
533 }
534
535 void
536 fatal_io_error (name)
537   const char *name;
538 {
539   notice ("%s: %s: I/O error\n", progname, name);
540   exit (FATAL_EXIT_CODE);
541 }
542
543 /* Issue a pedantic warning MSGID.  */
544 void
545 pedwarn VPROTO((const char *msgid, ...))
546 {
547 #ifndef ANSI_PROTOTYPES
548   const char *msgid;
549 #endif
550   va_list ap;
551
552   VA_START (ap, msgid);
553
554 #ifndef ANSI_PROTOTYPES
555   msgid = va_arg (ap, const char *);
556 #endif
557
558   vpedwarn (msgid, ap);
559   va_end (ap);
560 }
561
562 /* Issue a pedantic waring about DECL.  */
563 void
564 pedwarn_with_decl VPROTO((tree decl, const char *msgid, ...))
565 {
566 #ifndef ANSI_PROTOTYPES
567   tree decl;
568   const char *msgid;
569 #endif
570   va_list ap;
571
572   VA_START (ap, msgid);
573
574 #ifndef ANSI_PROTOTYPES
575   decl = va_arg (ap, tree);
576   msgid = va_arg (ap, const char *);
577 #endif
578
579   v_pedwarn_with_decl (decl, msgid, ap);
580   va_end (ap);
581 }
582
583 /* Same as above but within the context FILE and LINE. */
584 void
585 pedwarn_with_file_and_line VPROTO((const char *file, int line,
586                                    const char *msgid, ...))
587 {
588 #ifndef ANSI_PROTOTYPES
589   const char *file;
590   int line;
591   const char *msgid;
592 #endif
593   va_list ap;
594
595   VA_START (ap, msgid);
596
597 #ifndef ANSI_PROTOTYPES
598   file = va_arg (ap, const char *);
599   line = va_arg (ap, int);
600   msgid = va_arg (ap, const char *);
601 #endif
602
603   v_pedwarn_with_file_and_line (file, line, msgid, ap);
604   va_end (ap);
605 }
606
607 /* Just apologize with MSGID.  */
608 void
609 sorry VPROTO((const char *msgid, ...))
610 {
611 #ifndef ANSI_PROTOTYPES
612   const char *msgid;
613 #endif
614   va_list ap;
615
616   VA_START (ap, msgid);
617
618 #ifndef ANSI_PROTOTYPES
619   msgid = va_arg (ap, const char *);
620 #endif
621
622   vsorry (msgid, ap);
623   va_end (ap);
624 }
625
626 /* Called when the start of a function definition is parsed,
627    this function prints on stderr the name of the function.  */
628
629 void
630 announce_function (decl)
631      tree decl;
632 {
633   if (! quiet_flag)
634     {
635       if (rtl_dump_and_exit)
636         fprintf (stderr, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl)));
637       else
638         fprintf (stderr, " %s", (*decl_printable_name) (decl, 2));
639       fflush (stderr);
640       need_error_newline = 1;
641       last_error_function = current_function_decl;
642     }
643 }
644
645 /* The default function to print out name of current function that caused
646    an error.  */
647
648 void
649 default_print_error_function (file)
650   const char *file;
651 {
652   if (last_error_function != current_function_decl)
653     {
654       if (file)
655         fprintf (stderr, "%s: ", file);
656
657       if (current_function_decl == NULL)
658         notice ("At top level:\n");
659       else
660         {
661           if (TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
662             notice ("In method `%s':\n",
663                     (*decl_printable_name) (current_function_decl, 2));
664           else
665             notice ("In function `%s':\n",
666                     (*decl_printable_name) (current_function_decl, 2));
667         }
668
669       last_error_function = current_function_decl;
670     }
671 }
672
673 /* Prints out, if necessary, the name of the current function
674   that caused an error.  Called from all error and warning functions.
675   We ignore the FILE parameter, as it cannot be relied upon.  */
676
677 void
678 report_error_function (file)
679   const char *file ATTRIBUTE_UNUSED;
680 {
681   struct file_stack *p;
682
683   if (need_error_newline)
684     {
685       fprintf (stderr, "\n");
686       need_error_newline = 0;
687     }
688
689   if (input_file_stack && input_file_stack->next != 0
690       && input_file_stack_tick != last_error_tick)
691     {
692       for (p = input_file_stack->next; p; p = p->next)
693         if (p == input_file_stack->next)
694           notice ("In file included from %s:%d", p->name, p->line);
695         else
696           notice (",\n                 from %s:%d", p->name, p->line);
697       fprintf (stderr, ":\n");
698       last_error_tick = input_file_stack_tick;
699     }
700
701   (*print_error_function) (input_filename);
702 }
703
704 void
705 error_with_file_and_line VPROTO((const char *file, int line,
706                                  const char *msgid, ...))
707 {
708 #ifndef ANSI_PROTOTYPES
709   const char *file;
710   int line;
711   const char *msgid;
712 #endif
713   va_list ap;
714
715   VA_START (ap, msgid);
716
717 #ifndef ANSI_PROTOTYPES
718   file = va_arg (ap, const char *);
719   line = va_arg (ap, int);
720   msgid = va_arg (ap, const char *);
721 #endif
722
723   v_error_with_file_and_line (file, line, msgid, ap);
724   va_end (ap);
725 }
726
727 void
728 error_with_decl VPROTO((tree decl, const char *msgid, ...))
729 {
730 #ifndef ANSI_PROTOTYPES
731   tree decl;
732   const char *msgid;
733 #endif
734   va_list ap;
735
736   VA_START (ap, msgid);
737
738 #ifndef ANSI_PROTOTYPES
739   decl = va_arg (ap, tree);
740   msgid = va_arg (ap, const char *);
741 #endif
742
743   v_error_with_decl (decl, msgid, ap);
744   va_end (ap);
745 }
746
747 void
748 error_for_asm VPROTO((rtx insn, const char *msgid, ...))
749 {
750 #ifndef ANSI_PROTOTYPES
751   rtx insn;
752   const char *msgid;
753 #endif
754   va_list ap;
755
756   VA_START (ap, msgid);
757
758 #ifndef ANSI_PROTOTYPES
759   insn = va_arg (ap, rtx);
760   msgid = va_arg (ap, const char *);
761 #endif
762
763   v_error_for_asm (insn, msgid, ap);
764   va_end (ap);
765 }
766
767 void
768 error VPROTO((const char *msgid, ...))
769 {
770 #ifndef ANSI_PROTOTYPES
771   const char *msgid;
772 #endif
773   va_list ap;
774
775   VA_START (ap, msgid);
776
777 #ifndef ANSI_PROTOTYPES
778   msgid = va_arg (ap, const char *);
779 #endif
780
781   verror (msgid, ap);
782   va_end (ap);
783 }
784
785 /* Set the function to call when a fatal error occurs.  */
786
787 void
788 set_fatal_function (f)
789      void (*f) PROTO ((const char *, va_list));
790 {
791   fatal_function = f;
792 }
793
794 void
795 fatal VPROTO((const char *msgid, ...))
796 {
797 #ifndef ANSI_PROTOTYPES
798   const char *msgid;
799 #endif
800   va_list ap;
801
802   VA_START (ap, msgid);
803
804 #ifndef ANSI_PROTOTYPES
805   msgid = va_arg (ap, const char *);
806 #endif
807
808   vfatal (msgid, ap);
809   va_end (ap);
810 }
811
812 void
813 _fatal_insn (msgid, insn, file, line, function)
814      const char *msgid;
815      rtx insn;
816      const char *file;
817      int line;
818      const char *function;
819 {
820   error ("%s", msgid);
821   debug_rtx (insn);
822   fancy_abort (file, line, function);
823 }
824
825 void
826 _fatal_insn_not_found (insn, file, line, function)
827      rtx insn;
828      const char *file;
829      int line;
830      const char *function;
831 {
832   if (INSN_CODE (insn) < 0)
833     _fatal_insn ("Unrecognizable insn:", insn, file, line, function);
834   else
835     _fatal_insn ("Insn does not satisfy its constraints:",
836                 insn, file, line, function);
837 }
838
839 void
840 warning_with_file_and_line VPROTO((const char *file, int line,
841                                    const char *msgid, ...))
842 {
843 #ifndef ANSI_PROTOTYPES
844   const char *file;
845   int line;
846   const char *msgid;
847 #endif
848   va_list ap;
849
850   VA_START (ap, msgid);
851
852 #ifndef ANSI_PROTOTYPES
853   file = va_arg (ap, const char *);
854   line = va_arg (ap, int);
855   msgid = va_arg (ap, const char *);
856 #endif
857
858   v_warning_with_file_and_line (file, line, msgid, ap);
859   va_end (ap);
860 }
861
862 void
863 warning_with_decl VPROTO((tree decl, const char *msgid, ...))
864 {
865 #ifndef ANSI_PROTOTYPES
866   tree decl;
867   const char *msgid;
868 #endif
869   va_list ap;
870
871   VA_START (ap, msgid);
872
873 #ifndef ANSI_PROTOTYPES
874   decl = va_arg (ap, tree);
875   msgid = va_arg (ap, const char *);
876 #endif
877
878   v_warning_with_decl (decl, msgid, ap);
879   va_end (ap);
880 }
881
882 void
883 warning_for_asm VPROTO((rtx insn, const char *msgid, ...))
884 {
885 #ifndef ANSI_PROTOTYPES
886   rtx insn;
887   const char *msgid;
888 #endif
889   va_list ap;
890
891   VA_START (ap, msgid);
892
893 #ifndef ANSI_PROTOTYPES
894   insn = va_arg (ap, rtx);
895   msgid = va_arg (ap, const char *);
896 #endif
897
898   v_warning_for_asm (insn, msgid, ap);
899   va_end (ap);
900 }
901
902 void
903 warning VPROTO((const char *msgid, ...))
904 {
905 #ifndef ANSI_PROTOTYPES
906   const char *msgid;
907 #endif
908   va_list ap;
909
910   VA_START (ap, msgid);
911
912 #ifndef ANSI_PROTOTYPES
913   msgid = va_arg (ap, const char *);
914 #endif
915
916   vwarning (msgid, ap);
917   va_end (ap);
918 }
919