PR rtl-optimization/43520
[official-gcc.git] / gcc / fortran / error.c
blobb05e669c3707689580e29b6ba4367ee4209a1fdf
1 /* Handle errors.
2 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
3 2010
4 Free Software Foundation, Inc.
5 Contributed by Andy Vaught & Niels Kristian Bech Jensen
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free
11 Software Foundation; either version 3, or (at your option) any later
12 version.
14 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 for more details.
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
23 /* Handle the inevitable errors. A major catch here is that things
24 flagged as errors in one match subroutine can conceivably be legal
25 elsewhere. This means that error messages are recorded and saved
26 for possible use later. If a line does not match a legal
27 construction, then the saved error message is reported. */
29 #include "config.h"
30 #include "system.h"
31 #include "flags.h"
32 #include "gfortran.h"
34 static int suppress_errors = 0;
36 static int warnings_not_errors = 0;
38 static int terminal_width, buffer_flag, errors, warnings;
40 static gfc_error_buf error_buffer, warning_buffer, *cur_error_buffer;
43 /* Go one level deeper suppressing errors. */
45 void
46 gfc_push_suppress_errors (void)
48 gcc_assert (suppress_errors >= 0);
49 ++suppress_errors;
53 /* Leave one level of error suppressing. */
55 void
56 gfc_pop_suppress_errors (void)
58 gcc_assert (suppress_errors > 0);
59 --suppress_errors;
63 /* Per-file error initialization. */
65 void
66 gfc_error_init_1 (void)
68 terminal_width = gfc_terminal_width ();
69 errors = 0;
70 warnings = 0;
71 buffer_flag = 0;
75 /* Set the flag for buffering errors or not. */
77 void
78 gfc_buffer_error (int flag)
80 buffer_flag = flag;
84 /* Add a single character to the error buffer or output depending on
85 buffer_flag. */
87 static void
88 error_char (char c)
90 if (buffer_flag)
92 if (cur_error_buffer->index >= cur_error_buffer->allocated)
94 cur_error_buffer->allocated = cur_error_buffer->allocated
95 ? cur_error_buffer->allocated * 2 : 1000;
96 cur_error_buffer->message = XRESIZEVEC (char, cur_error_buffer->message,
97 cur_error_buffer->allocated);
99 cur_error_buffer->message[cur_error_buffer->index++] = c;
101 else
103 if (c != 0)
105 /* We build up complete lines before handing things
106 over to the library in order to speed up error printing. */
107 static char *line;
108 static size_t allocated = 0, index = 0;
110 if (index + 1 >= allocated)
112 allocated = allocated ? allocated * 2 : 1000;
113 line = XRESIZEVEC (char, line, allocated);
115 line[index++] = c;
116 if (c == '\n')
118 line[index] = '\0';
119 fputs (line, stderr);
120 index = 0;
127 /* Copy a string to wherever it needs to go. */
129 static void
130 error_string (const char *p)
132 while (*p)
133 error_char (*p++);
137 /* Print a formatted integer to the error buffer or output. */
139 #define IBUF_LEN 60
141 static void
142 error_uinteger (unsigned long int i)
144 char *p, int_buf[IBUF_LEN];
146 p = int_buf + IBUF_LEN - 1;
147 *p-- = '\0';
149 if (i == 0)
150 *p-- = '0';
152 while (i > 0)
154 *p-- = i % 10 + '0';
155 i = i / 10;
158 error_string (p + 1);
161 static void
162 error_integer (long int i)
164 unsigned long int u;
166 if (i < 0)
168 u = (unsigned long int) -i;
169 error_char ('-');
171 else
172 u = i;
174 error_uinteger (u);
178 static void
179 print_wide_char_into_buffer (gfc_char_t c, char *buf)
181 static const char xdigit[16] = { '0', '1', '2', '3', '4', '5', '6',
182 '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
184 if (gfc_wide_is_printable (c))
186 buf[1] = '\0';
187 buf[0] = (unsigned char) c;
189 else if (c < ((gfc_char_t) 1 << 8))
191 buf[4] = '\0';
192 buf[3] = xdigit[c & 0x0F];
193 c = c >> 4;
194 buf[2] = xdigit[c & 0x0F];
196 buf[1] = 'x';
197 buf[0] = '\\';
199 else if (c < ((gfc_char_t) 1 << 16))
201 buf[6] = '\0';
202 buf[5] = xdigit[c & 0x0F];
203 c = c >> 4;
204 buf[4] = xdigit[c & 0x0F];
205 c = c >> 4;
206 buf[3] = xdigit[c & 0x0F];
207 c = c >> 4;
208 buf[2] = xdigit[c & 0x0F];
210 buf[1] = 'u';
211 buf[0] = '\\';
213 else
215 buf[10] = '\0';
216 buf[9] = xdigit[c & 0x0F];
217 c = c >> 4;
218 buf[8] = xdigit[c & 0x0F];
219 c = c >> 4;
220 buf[7] = xdigit[c & 0x0F];
221 c = c >> 4;
222 buf[6] = xdigit[c & 0x0F];
223 c = c >> 4;
224 buf[5] = xdigit[c & 0x0F];
225 c = c >> 4;
226 buf[4] = xdigit[c & 0x0F];
227 c = c >> 4;
228 buf[3] = xdigit[c & 0x0F];
229 c = c >> 4;
230 buf[2] = xdigit[c & 0x0F];
232 buf[1] = 'U';
233 buf[0] = '\\';
237 static char wide_char_print_buffer[11];
239 const char *
240 gfc_print_wide_char (gfc_char_t c)
242 print_wide_char_into_buffer (c, wide_char_print_buffer);
243 return wide_char_print_buffer;
247 /* Show the file, where it was included, and the source line, give a
248 locus. Calls error_printf() recursively, but the recursion is at
249 most one level deep. */
251 static void error_printf (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
253 static void
254 show_locus (locus *loc, int c1, int c2)
256 gfc_linebuf *lb;
257 gfc_file *f;
258 gfc_char_t c, *p;
259 int i, offset, cmax;
261 /* TODO: Either limit the total length and number of included files
262 displayed or add buffering of arbitrary number of characters in
263 error messages. */
265 /* Write out the error header line, giving the source file and error
266 location (in GNU standard "[file]:[line].[column]:" format),
267 followed by an "included by" stack and a blank line. This header
268 format is matched by a testsuite parser defined in
269 lib/gfortran-dg.exp. */
271 lb = loc->lb;
272 f = lb->file;
274 error_string (f->filename);
275 error_char (':');
277 error_integer (LOCATION_LINE (lb->location));
279 if ((c1 > 0) || (c2 > 0))
280 error_char ('.');
282 if (c1 > 0)
283 error_integer (c1);
285 if ((c1 > 0) && (c2 > 0))
286 error_char ('-');
288 if (c2 > 0)
289 error_integer (c2);
291 error_char (':');
292 error_char ('\n');
294 for (;;)
296 i = f->inclusion_line;
298 f = f->up;
299 if (f == NULL) break;
301 error_printf (" Included at %s:%d:", f->filename, i);
304 error_char ('\n');
306 /* Calculate an appropriate horizontal offset of the source line in
307 order to get the error locus within the visible portion of the
308 line. Note that if the margin of 5 here is changed, the
309 corresponding margin of 10 in show_loci should be changed. */
311 offset = 0;
313 /* If the two loci would appear in the same column, we shift
314 '2' one column to the right, so as to print '12' rather than
315 just '1'. We do this here so it will be accounted for in the
316 margin calculations. */
318 if (c1 == c2)
319 c2 += 1;
321 cmax = (c1 < c2) ? c2 : c1;
322 if (cmax > terminal_width - 5)
323 offset = cmax - terminal_width + 5;
325 /* Show the line itself, taking care not to print more than what can
326 show up on the terminal. Tabs are converted to spaces, and
327 nonprintable characters are converted to a "\xNN" sequence. */
329 /* TODO: Although setting i to the terminal width is clever, it fails
330 to work correctly when nonprintable characters exist. A better
331 solution should be found. */
333 p = &(lb->line[offset]);
334 i = gfc_wide_strlen (p);
335 if (i > terminal_width)
336 i = terminal_width - 1;
338 for (; i > 0; i--)
340 static char buffer[11];
342 c = *p++;
343 if (c == '\t')
344 c = ' ';
346 print_wide_char_into_buffer (c, buffer);
347 error_string (buffer);
350 error_char ('\n');
352 /* Show the '1' and/or '2' corresponding to the column of the error
353 locus. Note that a value of -1 for c1 or c2 will simply cause
354 the relevant number not to be printed. */
356 c1 -= offset;
357 c2 -= offset;
359 for (i = 0; i <= cmax; i++)
361 if (i == c1)
362 error_char ('1');
363 else if (i == c2)
364 error_char ('2');
365 else
366 error_char (' ');
369 error_char ('\n');
374 /* As part of printing an error, we show the source lines that caused
375 the problem. We show at least one, and possibly two loci; the two
376 loci may or may not be on the same source line. */
378 static void
379 show_loci (locus *l1, locus *l2)
381 int m, c1, c2;
383 if (l1 == NULL || l1->lb == NULL)
385 error_printf ("<During initialization>\n");
386 return;
389 /* While calculating parameters for printing the loci, we consider possible
390 reasons for printing one per line. If appropriate, print the loci
391 individually; otherwise we print them both on the same line. */
393 c1 = l1->nextc - l1->lb->line;
394 if (l2 == NULL)
396 show_locus (l1, c1, -1);
397 return;
400 c2 = l2->nextc - l2->lb->line;
402 if (c1 < c2)
403 m = c2 - c1;
404 else
405 m = c1 - c2;
407 /* Note that the margin value of 10 here needs to be less than the
408 margin of 5 used in the calculation of offset in show_locus. */
410 if (l1->lb != l2->lb || m > terminal_width - 10)
412 show_locus (l1, c1, -1);
413 show_locus (l2, -1, c2);
414 return;
417 show_locus (l1, c1, c2);
419 return;
423 /* Workhorse for the error printing subroutines. This subroutine is
424 inspired by g77's error handling and is similar to printf() with
425 the following %-codes:
427 %c Character, %d or %i Integer, %s String, %% Percent
428 %L Takes locus argument
429 %C Current locus (no argument)
431 If a locus pointer is given, the actual source line is printed out
432 and the column is indicated. Since we want the error message at
433 the bottom of any source file information, we must scan the
434 argument list twice -- once to determine whether the loci are
435 present and record this for printing, and once to print the error
436 message after and loci have been printed. A maximum of two locus
437 arguments are permitted.
439 This function is also called (recursively) by show_locus in the
440 case of included files; however, as show_locus does not resupply
441 any loci, the recursion is at most one level deep. */
443 #define MAX_ARGS 10
445 static void ATTRIBUTE_GCC_GFC(2,0)
446 error_print (const char *type, const char *format0, va_list argp)
448 enum { TYPE_CURRENTLOC, TYPE_LOCUS, TYPE_INTEGER, TYPE_UINTEGER,
449 TYPE_LONGINT, TYPE_ULONGINT, TYPE_CHAR, TYPE_STRING,
450 NOTYPE };
451 struct
453 int type;
454 int pos;
455 union
457 int intval;
458 unsigned int uintval;
459 long int longintval;
460 unsigned long int ulongintval;
461 char charval;
462 const char * stringval;
463 } u;
464 } arg[MAX_ARGS], spec[MAX_ARGS];
465 /* spec is the array of specifiers, in the same order as they
466 appear in the format string. arg is the array of arguments,
467 in the same order as they appear in the va_list. */
469 char c;
470 int i, n, have_l1, pos, maxpos;
471 locus *l1, *l2, *loc;
472 const char *format;
474 l1 = l2 = NULL;
476 have_l1 = 0;
477 pos = -1;
478 maxpos = -1;
480 n = 0;
481 format = format0;
483 for (i = 0; i < MAX_ARGS; i++)
485 arg[i].type = NOTYPE;
486 spec[i].pos = -1;
489 /* First parse the format string for position specifiers. */
490 while (*format)
492 c = *format++;
493 if (c != '%')
494 continue;
496 if (*format == '%')
498 format++;
499 continue;
502 if (ISDIGIT (*format))
504 /* This is a position specifier. For example, the number
505 12 in the format string "%12$d", which specifies the third
506 argument of the va_list, formatted in %d format.
507 For details, see "man 3 printf". */
508 pos = atoi(format) - 1;
509 gcc_assert (pos >= 0);
510 while (ISDIGIT(*format))
511 format++;
512 gcc_assert (*format++ == '$');
514 else
515 pos++;
517 c = *format++;
519 if (pos > maxpos)
520 maxpos = pos;
522 switch (c)
524 case 'C':
525 arg[pos].type = TYPE_CURRENTLOC;
526 break;
528 case 'L':
529 arg[pos].type = TYPE_LOCUS;
530 break;
532 case 'd':
533 case 'i':
534 arg[pos].type = TYPE_INTEGER;
535 break;
537 case 'u':
538 arg[pos].type = TYPE_UINTEGER;
539 break;
541 case 'l':
542 c = *format++;
543 if (c == 'u')
544 arg[pos].type = TYPE_ULONGINT;
545 else if (c == 'i' || c == 'd')
546 arg[pos].type = TYPE_LONGINT;
547 else
548 gcc_unreachable ();
549 break;
551 case 'c':
552 arg[pos].type = TYPE_CHAR;
553 break;
555 case 's':
556 arg[pos].type = TYPE_STRING;
557 break;
559 default:
560 gcc_unreachable ();
563 spec[n++].pos = pos;
566 /* Then convert the values for each %-style argument. */
567 for (pos = 0; pos <= maxpos; pos++)
569 gcc_assert (arg[pos].type != NOTYPE);
570 switch (arg[pos].type)
572 case TYPE_CURRENTLOC:
573 loc = &gfc_current_locus;
574 /* Fall through. */
576 case TYPE_LOCUS:
577 if (arg[pos].type == TYPE_LOCUS)
578 loc = va_arg (argp, locus *);
580 if (have_l1)
582 l2 = loc;
583 arg[pos].u.stringval = "(2)";
585 else
587 l1 = loc;
588 have_l1 = 1;
589 arg[pos].u.stringval = "(1)";
591 break;
593 case TYPE_INTEGER:
594 arg[pos].u.intval = va_arg (argp, int);
595 break;
597 case TYPE_UINTEGER:
598 arg[pos].u.uintval = va_arg (argp, unsigned int);
599 break;
601 case TYPE_LONGINT:
602 arg[pos].u.longintval = va_arg (argp, long int);
603 break;
605 case TYPE_ULONGINT:
606 arg[pos].u.ulongintval = va_arg (argp, unsigned long int);
607 break;
609 case TYPE_CHAR:
610 arg[pos].u.charval = (char) va_arg (argp, int);
611 break;
613 case TYPE_STRING:
614 arg[pos].u.stringval = (const char *) va_arg (argp, char *);
615 break;
617 default:
618 gcc_unreachable ();
622 for (n = 0; spec[n].pos >= 0; n++)
623 spec[n].u = arg[spec[n].pos].u;
625 /* Show the current loci if we have to. */
626 if (have_l1)
627 show_loci (l1, l2);
629 if (*type)
631 error_string (type);
632 error_char (' ');
635 have_l1 = 0;
636 format = format0;
637 n = 0;
639 for (; *format; format++)
641 if (*format != '%')
643 error_char (*format);
644 continue;
647 format++;
648 if (ISDIGIT (*format))
650 /* This is a position specifier. See comment above. */
651 while (ISDIGIT (*format))
652 format++;
654 /* Skip over the dollar sign. */
655 format++;
658 switch (*format)
660 case '%':
661 error_char ('%');
662 break;
664 case 'c':
665 error_char (spec[n++].u.charval);
666 break;
668 case 's':
669 case 'C': /* Current locus */
670 case 'L': /* Specified locus */
671 error_string (spec[n++].u.stringval);
672 break;
674 case 'd':
675 case 'i':
676 error_integer (spec[n++].u.intval);
677 break;
679 case 'u':
680 error_uinteger (spec[n++].u.uintval);
681 break;
683 case 'l':
684 format++;
685 if (*format == 'u')
686 error_uinteger (spec[n++].u.ulongintval);
687 else
688 error_integer (spec[n++].u.longintval);
689 break;
694 error_char ('\n');
698 /* Wrapper for error_print(). */
700 static void
701 error_printf (const char *gmsgid, ...)
703 va_list argp;
705 va_start (argp, gmsgid);
706 error_print ("", _(gmsgid), argp);
707 va_end (argp);
711 /* Increment the number of errors, and check whether too many have
712 been printed. */
714 static void
715 gfc_increment_error_count (void)
717 errors++;
718 if ((gfc_option.max_errors != 0) && (errors >= gfc_option.max_errors))
719 gfc_fatal_error ("Error count reached limit of %d.", gfc_option.max_errors);
723 /* Issue a warning. */
725 void
726 gfc_warning (const char *gmsgid, ...)
728 va_list argp;
730 if (inhibit_warnings)
731 return;
733 warning_buffer.flag = 1;
734 warning_buffer.index = 0;
735 cur_error_buffer = &warning_buffer;
737 va_start (argp, gmsgid);
738 error_print (_("Warning:"), _(gmsgid), argp);
739 va_end (argp);
741 error_char ('\0');
743 if (buffer_flag == 0)
745 warnings++;
746 if (warnings_are_errors)
747 gfc_increment_error_count();
752 /* Whether, for a feature included in a given standard set (GFC_STD_*),
753 we should issue an error or a warning, or be quiet. */
755 notification
756 gfc_notification_std (int std)
758 bool warning;
760 warning = ((gfc_option.warn_std & std) != 0) && !inhibit_warnings;
761 if ((gfc_option.allow_std & std) != 0 && !warning)
762 return SILENT;
764 return warning ? WARNING : ERROR;
768 /* Possibly issue a warning/error about use of a nonstandard (or deleted)
769 feature. An error/warning will be issued if the currently selected
770 standard does not contain the requested bits. Return FAILURE if
771 an error is generated. */
773 gfc_try
774 gfc_notify_std (int std, const char *gmsgid, ...)
776 va_list argp;
777 bool warning;
779 warning = ((gfc_option.warn_std & std) != 0) && !inhibit_warnings;
780 if ((gfc_option.allow_std & std) != 0 && !warning)
781 return SUCCESS;
783 if (suppress_errors)
784 return warning ? SUCCESS : FAILURE;
786 cur_error_buffer = warning ? &warning_buffer : &error_buffer;
787 cur_error_buffer->flag = 1;
788 cur_error_buffer->index = 0;
790 va_start (argp, gmsgid);
791 if (warning)
792 error_print (_("Warning:"), _(gmsgid), argp);
793 else
794 error_print (_("Error:"), _(gmsgid), argp);
795 va_end (argp);
797 error_char ('\0');
799 if (buffer_flag == 0)
801 if (warning && !warnings_are_errors)
802 warnings++;
803 else
804 gfc_increment_error_count();
807 return (warning && !warnings_are_errors) ? SUCCESS : FAILURE;
811 /* Immediate warning (i.e. do not buffer the warning). */
813 void
814 gfc_warning_now (const char *gmsgid, ...)
816 va_list argp;
817 int i;
819 if (inhibit_warnings)
820 return;
822 i = buffer_flag;
823 buffer_flag = 0;
824 warnings++;
826 va_start (argp, gmsgid);
827 error_print (_("Warning:"), _(gmsgid), argp);
828 va_end (argp);
830 error_char ('\0');
832 if (warnings_are_errors)
833 gfc_increment_error_count();
835 buffer_flag = i;
839 /* Clear the warning flag. */
841 void
842 gfc_clear_warning (void)
844 warning_buffer.flag = 0;
848 /* Check to see if any warnings have been saved.
849 If so, print the warning. */
851 void
852 gfc_warning_check (void)
854 if (warning_buffer.flag)
856 warnings++;
857 if (warning_buffer.message != NULL)
858 fputs (warning_buffer.message, stderr);
859 warning_buffer.flag = 0;
864 /* Issue an error. */
866 void
867 gfc_error (const char *gmsgid, ...)
869 va_list argp;
871 if (warnings_not_errors)
872 goto warning;
874 if (suppress_errors)
875 return;
877 error_buffer.flag = 1;
878 error_buffer.index = 0;
879 cur_error_buffer = &error_buffer;
881 va_start (argp, gmsgid);
882 error_print (_("Error:"), _(gmsgid), argp);
883 va_end (argp);
885 error_char ('\0');
887 if (buffer_flag == 0)
888 gfc_increment_error_count();
890 return;
892 warning:
894 if (inhibit_warnings)
895 return;
897 warning_buffer.flag = 1;
898 warning_buffer.index = 0;
899 cur_error_buffer = &warning_buffer;
901 va_start (argp, gmsgid);
902 error_print (_("Warning:"), _(gmsgid), argp);
903 va_end (argp);
905 error_char ('\0');
907 if (buffer_flag == 0)
909 warnings++;
910 if (warnings_are_errors)
911 gfc_increment_error_count();
916 /* Immediate error. */
918 void
919 gfc_error_now (const char *gmsgid, ...)
921 va_list argp;
922 int i;
924 error_buffer.flag = 1;
925 error_buffer.index = 0;
926 cur_error_buffer = &error_buffer;
928 i = buffer_flag;
929 buffer_flag = 0;
931 va_start (argp, gmsgid);
932 error_print (_("Error:"), _(gmsgid), argp);
933 va_end (argp);
935 error_char ('\0');
937 gfc_increment_error_count();
939 buffer_flag = i;
941 if (flag_fatal_errors)
942 exit (1);
946 /* Fatal error, never returns. */
948 void
949 gfc_fatal_error (const char *gmsgid, ...)
951 va_list argp;
953 buffer_flag = 0;
955 va_start (argp, gmsgid);
956 error_print (_("Fatal Error:"), _(gmsgid), argp);
957 va_end (argp);
959 exit (3);
963 /* This shouldn't happen... but sometimes does. */
965 void
966 gfc_internal_error (const char *format, ...)
968 va_list argp;
970 buffer_flag = 0;
972 va_start (argp, format);
974 show_loci (&gfc_current_locus, NULL);
975 error_printf ("Internal Error at (1):");
977 error_print ("", format, argp);
978 va_end (argp);
980 exit (ICE_EXIT_CODE);
984 /* Clear the error flag when we start to compile a source line. */
986 void
987 gfc_clear_error (void)
989 error_buffer.flag = 0;
990 warnings_not_errors = 0;
994 /* Tests the state of error_flag. */
997 gfc_error_flag_test (void)
999 return error_buffer.flag;
1003 /* Check to see if any errors have been saved.
1004 If so, print the error. Returns the state of error_flag. */
1007 gfc_error_check (void)
1009 int rc;
1011 rc = error_buffer.flag;
1013 if (error_buffer.flag)
1015 if (error_buffer.message != NULL)
1016 fputs (error_buffer.message, stderr);
1017 error_buffer.flag = 0;
1019 gfc_increment_error_count();
1021 if (flag_fatal_errors)
1022 exit (1);
1025 return rc;
1029 /* Save the existing error state. */
1031 void
1032 gfc_push_error (gfc_error_buf *err)
1034 err->flag = error_buffer.flag;
1035 if (error_buffer.flag)
1036 err->message = xstrdup (error_buffer.message);
1038 error_buffer.flag = 0;
1042 /* Restore a previous pushed error state. */
1044 void
1045 gfc_pop_error (gfc_error_buf *err)
1047 error_buffer.flag = err->flag;
1048 if (error_buffer.flag)
1050 size_t len = strlen (err->message) + 1;
1051 gcc_assert (len <= error_buffer.allocated);
1052 memcpy (error_buffer.message, err->message, len);
1053 gfc_free (err->message);
1058 /* Free a pushed error state, but keep the current error state. */
1060 void
1061 gfc_free_error (gfc_error_buf *err)
1063 if (err->flag)
1064 gfc_free (err->message);
1068 /* Report the number of warnings and errors that occurred to the caller. */
1070 void
1071 gfc_get_errors (int *w, int *e)
1073 if (w != NULL)
1074 *w = warnings;
1075 if (e != NULL)
1076 *e = errors;
1080 /* Switch errors into warnings. */
1082 void
1083 gfc_errors_to_warnings (int f)
1085 warnings_not_errors = (f == 1) ? 1 : 0;