/[bison]/bison/src/complain.c
ViewVC logotype

Diff of /bison/src/complain.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by akim, Wed Dec 12 15:22:46 2001 UTC revision 1.8 by akim, Tue Jun 11 20:16:05 2002 UTC
# Line 116  unsigned int complain_message_count; Line 116  unsigned int complain_message_count;
116    
117  void  void
118  #if defined VA_START && defined __STDC__  #if defined VA_START && defined __STDC__
119    warn_at (int location, const char *message, ...)
120    #else
121    warn_at (location, message, va_alist)
122      int location
123      char *message;
124      va_dcl
125    #endif
126    {
127    #ifdef VA_START
128      va_list args;
129    #endif
130    
131      if (error_one_per_line)
132        {
133          static const char *old_infile;
134          static int old_lineno;
135    
136          if (old_lineno == location &&
137              (infile == old_infile || !strcmp (old_infile, infile)))
138            /* Simply return and print nothing.  */
139            return;
140    
141          old_infile = infile;
142          old_lineno = location;
143        }
144    
145      fflush (stdout);
146      if (infile != NULL)
147        fprintf (stderr, "%s:%d: ", infile, location);
148      else
149        fprintf (stderr, "%s:", program_name);
150    
151      fputs (_("warning: "), stderr);
152    
153    #ifdef VA_START
154      VA_START (args, message);
155      vfprintf (stderr, message, args);
156      va_end (args);
157    #else
158      fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
159    #endif
160    
161      ++warn_message_count;
162      putc ('\n', stderr);
163      fflush (stderr);
164    }
165    
166    
167    void
168    #if defined VA_START && defined __STDC__
169  warn (const char *message, ...)  warn (const char *message, ...)
170  #else  #else
171  warn (message, va_alist)  warn (message, va_alist)
# Line 168  warn (message, va_alist) Line 218  warn (message, va_alist)
218    
219  void  void
220  #if defined VA_START && defined __STDC__  #if defined VA_START && defined __STDC__
221    complain_at (int location, const char *message, ...)
222    #else
223    complain_at (location, message, va_alist)
224      int location;
225      char *message;
226      va_dcl
227    #endif
228    {
229    #ifdef VA_START
230      va_list args;
231    #endif
232    
233      if (error_one_per_line)
234        {
235          static const char *old_infile;
236          static int old_lineno;
237    
238          if (old_lineno == location &&
239              (infile == old_infile || !strcmp (old_infile, infile)))
240            /* Simply return and print nothing.  */
241            return;
242    
243          old_infile = infile;
244          old_lineno = location;
245        }
246    
247      fflush (stdout);
248      if (infile != NULL)
249        fprintf (stderr, "%s:%d: ", infile, location);
250      else
251        fprintf (stderr, "%s:", program_name);
252    
253    #ifdef VA_START
254      VA_START (args, message);
255      vfprintf (stderr, message, args);
256      va_end (args);
257    #else
258      fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
259    #endif
260    
261      ++complain_message_count;
262      putc ('\n', stderr);
263      fflush (stderr);
264    }
265    
266    
267    void
268    #if defined VA_START && defined __STDC__
269  complain (const char *message, ...)  complain (const char *message, ...)
270  #else  #else
271  complain (message, va_alist)  complain (message, va_alist)
# Line 218  complain (message, va_alist) Line 316  complain (message, va_alist)
316    
317  void  void
318  #if defined VA_START && defined __STDC__  #if defined VA_START && defined __STDC__
319    fatal_at (int location, const char *message, ...)
320    #else
321    fatal (location, message, va_alist)
322      int location;
323      char *message;
324      va_dcl
325    #endif
326    {
327    #ifdef VA_START
328      va_list args;
329    #endif
330    
331      fflush (stdout);
332      if (infile != NULL)
333        fprintf (stderr, "%s:%d: ", infile, location);
334      else
335        fprintf (stderr, "%s:", program_name);
336    
337      fputs (_("fatal error: "), stderr);
338    
339    #ifdef VA_START
340      VA_START (args, message);
341      vfprintf (stderr, message, args);
342      va_end (args);
343    #else
344      fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
345    #endif
346      putc ('\n', stderr);
347      fflush (stderr);
348      exit (1);
349    }
350    
351    void
352    #if defined VA_START && defined __STDC__
353  fatal (const char *message, ...)  fatal (const char *message, ...)
354  #else  #else
355  fatal (message, va_alist)  fatal (message, va_alist)

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26