]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/toplev.c
Merge in gcc2 snapshot 19980929. See gcc/ChangeLog and gcc/FSFChangeLog for
[thirdparty/gcc.git] / gcc / toplev.c
index 8df7be5ef981be38839095ddee093c67507fb962..bee1e8ec8946be46648455a0fde06e8943482ef4 100644 (file)
@@ -51,6 +51,7 @@ Boston, MA 02111-1307, USA.  */
 #include "except.h"
 #include "toplev.h"
 #include "expr.h"
+#include "intl.h"
 
 #ifdef DWARF_DEBUGGING_INFO
 #include "dwarfout.h"
@@ -162,14 +163,28 @@ extern void print_rtl ();
 extern void print_rtl_with_bb ();
 
 void rest_of_decl_compilation ();
+void error_with_file_and_line PVPROTO((const char *file,
+                                      int line, const char *s, ...));
+void error_with_decl PVPROTO((tree decl, const char *s, ...));
+void error_for_asm PVPROTO((rtx insn, const char *s, ...));
+void notice PVPROTO((const char *s, ...));
+void error PVPROTO((const char *s, ...));
+void fatal PVPROTO((const char *s, ...));
+void warning_with_file_and_line PVPROTO((const char *file,
+                                        int line, const char *s, ...));
+void warning_with_decl PVPROTO((tree decl, const char *s, ...));
+void warning PVPROTO((const char *s, ...));
+void pedwarn PVPROTO((const char *s, ...));
+void pedwarn_with_decl PVPROTO((tree decl, const char *s, ...));
+void pedwarn_with_file_and_line PVPROTO((const char *file,
+                                        int line, const char *s, ...));
+void sorry PVPROTO((const char *s, ...));
 static void set_target_switch PROTO((const char *));
 static char *decl_name PROTO((tree, int));
 static void vmessage PROTO((const char *, const char *, va_list));
-static void v_message_with_file_and_line PROTO((const char *, int,
-                                               const char *, const char *,
-                                               va_list));
-static void v_message_with_decl PROTO((tree, const char *,
-                                      const char *, va_list));
+static void v_message_with_file_and_line PROTO((const char *, int, int,
+                                               const char *, va_list));
+static void v_message_with_decl PROTO((tree, int, const char *, va_list));
 static void file_and_line_for_asm PROTO((rtx, char **, int *));
 static void v_error_with_file_and_line PROTO((const char *, int,
                                              const char *, va_list));
@@ -187,7 +202,6 @@ static void v_pedwarn_with_decl PROTO((tree, const char *, va_list));
 static void v_pedwarn_with_file_and_line PROTO((const char *, int,
                                                const char *, va_list));
 static void vsorry PROTO((const char *, va_list));
-static void v_really_sorry PROTO((const char *, va_list)) ATTRIBUTE_NORETURN;
 static void float_signal PROTO((int)) ATTRIBUTE_NORETURN;
 static void pipe_closed PROTO((int)) ATTRIBUTE_NORETURN;
 #ifdef ASM_IDENTIFY_LANGUAGE
@@ -542,10 +556,14 @@ int flag_fast_math = 0;
 
 int flag_volatile;
 
-/* Nonzero means treat all global and extern variables as global.  */
+/* Nonzero means treat all global and extern variables as volatile.  */
 
 int flag_volatile_global;
 
+/* Nonzero means treat all static variables as volatile.  */
+
+int flag_volatile_static;
+
 /* Nonzero means just do syntax checking; don't output anything.  */
 
 int flag_syntax_only = 0;
@@ -800,6 +818,8 @@ lang_independent_options f_options[] =
    "Consider all mem refs through pointers as volatile"},
   {"volatile-global", &flag_volatile_global, 1,
    "Consider all mem refs to global data to be volatile" },
+  {"volatile-static", &flag_volatile_static, 1,
+   "Consider all mem refs to static data to be volatile" },
   {"defer-pop", &flag_defer_pop, 1,
    "Defer popping functions args from stack until later" },
   {"omit-frame-pointer", &flag_omit_frame_pointer, 1,
@@ -1343,7 +1363,7 @@ count_error (warningp)
 
       if (warningp && !warning_message)
        {
-         fprintf (stderr, "%s: warnings being treated as errors\n", progname);
+         notice ("%s: warnings being treated as errors\n", progname);
          warning_message = 1;
        }
       errorcount++;
@@ -1368,7 +1388,7 @@ void
 fatal_io_error (name)
   const char *name;
 {
-  fprintf (stderr, "%s: %s: I/O error\n", progname, name);
+  notice ("%s: %s: I/O error\n", progname, name);
   exit (FATAL_EXIT_CODE);
 }
 
@@ -1376,11 +1396,11 @@ fatal_io_error (name)
    just calling abort().  */
 
 void
-fatal_insn (message, insn)
-     const char *message;
+fatal_insn (msgid, insn)
+     const char *msgid;
      rtx insn;
 {
-  error (message);
+  error (msgid);
   debug_rtx (insn);
   if (asm_out_file)
     fflush (asm_out_file);
@@ -1455,21 +1475,16 @@ default_print_error_function (file)
 {
   if (last_error_function != current_function_decl)
     {
-      const char *kind = "function";
-      if (current_function_decl != 0
-         && TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
-       kind = "method";
-
       if (file)
        fprintf (stderr, "%s: ", file);
 
       if (current_function_decl == NULL)
-       fprintf (stderr, "At top level:\n");
+       notice ("At top level:\n");
       else
-       {
-         char *name = (*decl_printable_name) (current_function_decl, 2);
-         fprintf (stderr, "In %s `%s':\n", kind, name);
-       }
+       notice ((TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE
+                ? "In method `%s':\n"
+                : "In function `%s':\n"),
+               (*decl_printable_name) (current_function_decl, 2));
 
       last_error_function = current_function_decl;
     }
@@ -1502,13 +1517,11 @@ report_error_function (file)
       && input_file_stack_tick != last_error_tick
       && file == input_filename)
     {
-      fprintf (stderr, "In file included");
       for (p = input_file_stack->next; p; p = p->next)
-       {
-         fprintf (stderr, " from %s:%d", p->name, p->line);
-         if (p->next)
-           fprintf (stderr, ",\n                ");
-       }
+       notice ((p == input_file_stack->next
+                ?    "In file included from %s:%d"
+                : ",\n                 from %s:%d"),
+               p->name, p->line);
       fprintf (stderr, ":\n");
       last_error_tick = input_file_stack_tick;
     }
@@ -1517,76 +1530,137 @@ report_error_function (file)
 /* Print a message.  */
 
 static void
-vmessage (prefix, s, ap)
+vnotice (file, msgid, ap)
+     FILE *file;
+     char *msgid;
+     va_list ap;
+{
+  vfprintf (file, _(msgid), ap);
+}
+
+void
+notice VPROTO((const char *msgid, ...))
+{
+#ifndef __STDC__
+  char *msgid;
+#endif
+  va_list ap;
+
+  VA_START (ap, msgid);
+
+#ifndef __STDC__
+  msgid = va_arg (ap, char *);
+#endif
+
+  vnotice (stderr, msgid, ap);
+  va_end (ap);
+}
+
+void
+fnotice VPROTO((FILE *file, char *msgid, ...))
+{
+#ifndef __STDC__
+  FILE *file;
+  char *msgid;
+#endif
+  va_list ap;
+
+  VA_START (ap, msgid);
+
+#ifndef __STDC__
+  file = va_arg (ap, FILE *);
+  msgid = va_arg (ap, char *);
+#endif
+
+  vnotice (file, msgid, ap);
+  va_end (ap);
+}
+
+/* Report FILE and LINE (or program name), and optionally just WARN.  */
+
+static void
+report_file_and_line (file, line, warn)
+     char *file;
+     int line;
+     int warn;
+{
+  if (file)
+    fprintf (stderr, "%s:%d: ", file, line);
+  else
+    fprintf (stderr, "%s: ", progname);
+
+  if (warn)
+    notice ("warning: ");
+}
+
+/* Print a message.  */
+
+static void
+vmessage (prefix, msgid, ap)
      const char *prefix;
-     const char *s;
+     const char *msgid;
      va_list ap;
 {
   if (prefix)
     fprintf (stderr, "%s: ", prefix);
 
-  vfprintf (stderr, s, ap);
+  vfprintf (stderr, msgid, ap);
 }
 
 /* Print a message relevant to line LINE of file FILE.  */
 
 static void
-v_message_with_file_and_line (file, line, prefix, s, ap)
+v_message_with_file_and_line (file, line, warn, msgid, ap)
      const char *file;
      int line;
-     const char *prefix;
-     const char *s;
+     int warn;
+     const char *msgid;
      va_list ap;
 {
-  if (file)
-    fprintf (stderr, "%s:%d: ", file, line);
-  else
-    fprintf (stderr, "%s: ", progname);
-
-  vmessage (prefix, s, ap);
+  report_file_and_line (file, line, warn);
+  vnotice (stderr, msgid, ap);
   fputc ('\n', stderr);
 }
 
 /* Print a message relevant to the given DECL.  */
 
 static void
-v_message_with_decl (decl, prefix, s, ap)
+v_message_with_decl (decl, warn, msgid, ap)
      tree decl;
-     const char *prefix;
-     const char *s;
+     int warn;
+     const char *msgid;
      va_list ap;
 {
   const char *p;
 
-  fprintf (stderr, "%s:%d: ",
-          DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
-
-  if (prefix)
-    fprintf (stderr, "%s: ", prefix);
+  report_file_and_line (DECL_SOURCE_FILE (decl),
+                       DECL_SOURCE_LINE (decl), warn);
 
   /* Do magic to get around lack of varargs support for insertion
      of arguments into existing list.  We know that the decl is first;
      we ass_u_me that it will be printed with "%s".  */
 
-  for (p = s; *p; ++p)
+  for (p = _(msgid); *p; ++p)
     {
       if (*p == '%')
        {
          if (*(p + 1) == '%')
            ++p;
+         else if (*(p + 1) != 's')
+           abort ();
          else
            break;
        }
     }
 
-  if (p > s)                   /* Print the left-hand substring.  */
+  if (p > _(msgid))                    /* Print the left-hand substring.  */
     {
       char fmt[sizeof "%.255s"];
-      long width = p - s;
+      long width = p - _(msgid);
              
       if (width > 255L) width = 255L;  /* arbitrary */
       sprintf (fmt, "%%.%lds", width);
-      fprintf (stderr, fmt, s);
+      fprintf (stderr, fmt, _(msgid));
     }
 
   if (*p == '%')               /* Print the name.  */
@@ -1649,72 +1723,72 @@ file_and_line_for_asm (insn, pfile, pline)
 /* Report an error at line LINE of file FILE.  */
 
 static void
-v_error_with_file_and_line (file, line, s, ap)
+v_error_with_file_and_line (file, line, msgid, ap)
      const char *file;
      int line;
-     const char *s;
+     const char *msgid;
      va_list ap;
 {
   count_error (0);
   report_error_function (file);
-  v_message_with_file_and_line (file, line, (char *)NULL, s, ap);
+  v_message_with_file_and_line (file, line, 0, msgid, ap);
 }
 
 void
 error_with_file_and_line VPROTO((const char *file, int line,
-                                const char *s, ...))
+                                const char *msgid, ...))
 {
 #ifndef ANSI_PROTOTYPES
   const char *file;
   int line;
-  const char *s;
+  const char *msgid;
 #endif
   va_list ap;
 
-  VA_START (ap, s);
+  VA_START (ap, msgid);
 
 #ifndef ANSI_PROTOTYPES
   file = va_arg (ap, const char *);
   line = va_arg (ap, int);
-  s = va_arg (ap, const char *);
+  msgid = va_arg (ap, const char *);
 #endif
 
-  v_error_with_file_and_line (file, line, s, ap);
+  v_error_with_file_and_line (file, line, msgid, ap);
   va_end (ap);
 }
 
 /* Report an error at the declaration DECL.
-   S is a format string which uses %s to substitute the declaration
+   MSGID is a format string which uses %s to substitute the declaration
    name; subsequent substitutions are a la printf.  */
 
 static void
-v_error_with_decl (decl, s, ap)
+v_error_with_decl (decl, msgid, ap)
      tree decl;
-     const char *s;
+     const char *msgid;
      va_list ap;
 {
   count_error (0);
   report_error_function (DECL_SOURCE_FILE (decl));
-  v_message_with_decl (decl, (char *)NULL, s, ap);
+  v_message_with_decl (decl, 0, msgid, ap);
 }
 
 void
-error_with_decl VPROTO((tree decl, const char *s, ...))
+error_with_decl VPROTO((tree decl, const char *msgid, ...))
 {
 #ifndef ANSI_PROTOTYPES
   tree decl;
-  const char *s;
+  const char *msgid;
 #endif
   va_list ap;
 
-  VA_START (ap, s);
+  VA_START (ap, msgid);
 
 #ifndef ANSI_PROTOTYPES
   decl = va_arg (ap, tree);
-  s = va_arg (ap, const char *);
+  msgid = va_arg (ap, const char *);
 #endif
 
-  v_error_with_decl (decl, s, ap);
+  v_error_with_decl (decl, msgid, ap);
   va_end (ap);
 }
 
@@ -1723,9 +1797,9 @@ error_with_decl VPROTO((tree decl, const char *s, ...))
    and each ASM_OPERANDS records its own source file and line.  */
 
 static void
-v_error_for_asm (insn, s, ap)
+v_error_for_asm (insn, msgid, ap)
      rtx insn;
-     const char *s;
+     const char *msgid;
      va_list ap;
 {
   char *file;
@@ -1734,159 +1808,159 @@ v_error_for_asm (insn, s, ap)
   count_error (0);
   file_and_line_for_asm (insn, &file, &line);
   report_error_function (file);
-  v_message_with_file_and_line (file, line, (char *)NULL, s, ap);
+  v_message_with_file_and_line (file, line, 0, msgid, ap);
 }
 
 void
-error_for_asm VPROTO((rtx insn, const char *s, ...))
+error_for_asm VPROTO((rtx insn, const char *msgid, ...))
 {
 #ifndef ANSI_PROTOTYPES
   rtx insn;
-  const char *s;
+  const char *msgid;
 #endif
   va_list ap;
 
-  VA_START (ap, s);
+  VA_START (ap, msgid);
 
 #ifndef ANSI_PROTOTYPES
   insn = va_arg (ap, rtx);
-  s = va_arg (ap, const char *);
+  msgid = va_arg (ap, const char *);
 #endif
 
-  v_error_for_asm (insn, s, ap);
+  v_error_for_asm (insn, msgid, ap);
   va_end (ap);
 }
 
 /* Report an error at the current line number.  */
 
 static void
-verror (s, ap)
-     const char *s;
+verror (msgid, ap)
+     const char *msgid;
      va_list ap;
 {
-  v_error_with_file_and_line (input_filename, lineno, s, ap);
+  v_error_with_file_and_line (input_filename, lineno, msgid, ap);
 }
 
 void
-error VPROTO((const char *s, ...))
+error VPROTO((const char *msgid, ...))
 {
 #ifndef ANSI_PROTOTYPES
-  const char *s;
+  const char *msgid;
 #endif
   va_list ap;
 
-  VA_START (ap, s);
+  VA_START (ap, msgid);
 
 #ifndef ANSI_PROTOTYPES
-  s = va_arg (ap, const char *);
+  msgic = va_arg (ap, const char *);
 #endif
 
-  verror (s, ap);
+  verror (msgid, ap);
   va_end (ap);
 }
 
 /* Report a fatal error at the current line number.  */
 
 static void
-vfatal (s, ap)
-     const char *s;
+vfatal (msgid, ap)
+     const char *msgid;
      va_list ap;
 {
-  verror (s, ap);
+  verror (msgid, ap);
   exit (FATAL_EXIT_CODE);
 }
 
 void
-fatal VPROTO((const char *s, ...))
+fatal VPROTO((const char *msgid, ...))
 {
 #ifndef ANSI_PROTOTYPES
-  const char *s;
+  const char *msgid;
 #endif
   va_list ap;
 
-  VA_START (ap, s);
+  VA_START (ap, msgid);
 
 #ifndef ANSI_PROTOTYPES
-  s = va_arg (ap, const char *);
+  msgid = va_arg (ap, const char *);
 #endif
 
-  vfatal (s, ap);
+  vfatal (msgid, ap);
   va_end (ap);
 }
 
 /* Report a warning at line LINE of file FILE.  */
 
 static void
-v_warning_with_file_and_line (file, line, s, ap)
+v_warning_with_file_and_line (file, line, msgid, ap)
      const char *file;
      int line;
-     const char *s;
+     const char *msgid;
      va_list ap;
 {
   if (count_error (1))
     {
       report_error_function (file);
-      v_message_with_file_and_line (file, line, "warning", s, ap);
+      v_message_with_file_and_line (file, line, 1, msgid, ap);
     }
 }
 
 void
 warning_with_file_and_line VPROTO((const char *file, int line,
-                                  const char *s, ...))
+                                  const char *msgid, ...))
 {
 #ifndef ANSI_PROTOTYPES
   const char *file;
   int line;
-  const char *s;
+  const char *msgid;
 #endif
   va_list ap;
 
-  VA_START (ap, s);
+  VA_START (ap, msgid);
 
 #ifndef ANSI_PROTOTYPES
   file = va_arg (ap, const char *);
   line = va_arg (ap, int);
-  s = va_arg (ap, const char *);
+  msgid = va_arg (ap, const char *);
 #endif
 
-  v_warning_with_file_and_line (file, line, s, ap);
+  v_warning_with_file_and_line (file, line, msgid, ap);
   va_end (ap);
 }
 
 /* Report a warning at the declaration DECL.
-   S is a format string which uses %s to substitute the declaration
+   MSGID is a format string which uses %s to substitute the declaration
    name; subsequent substitutions are a la printf.  */
 
 static void
-v_warning_with_decl (decl, s, ap)
+v_warning_with_decl (decl, msgid, ap)
      tree decl;
-     const char *s;
+     const char *msgid;
      va_list ap;
 {
   if (count_error (1))
     {
       report_error_function (DECL_SOURCE_FILE (decl));
-      v_message_with_decl (decl, "warning", s, ap);
+      v_message_with_decl (decl, 1, msgid, ap);
     }
 }
 
 void
-warning_with_decl VPROTO((tree decl, const char *s, ...))
+warning_with_decl VPROTO((tree decl, const char *msgid, ...))
 {
 #ifndef ANSI_PROTOTYPES
   tree decl;
-  const char *s;
+  const char *msgid;
 #endif
   va_list ap;
 
-  VA_START (ap, s);
+  VA_START (ap, msgid);
 
 #ifndef ANSI_PROTOTYPES
   decl = va_arg (ap, tree);
-  s = va_arg (ap, const char *);
+  msgid = va_arg (ap, const char *);
 #endif
 
-  v_warning_with_decl (decl, s, ap);
+  v_warning_with_decl (decl, msgid, ap);
   va_end (ap);
 }
 
@@ -1895,9 +1969,9 @@ warning_with_decl VPROTO((tree decl, const char *s, ...))
    and each ASM_OPERANDS records its own source file and line.  */
 
 static void
-v_warning_for_asm (insn, s, ap)
+v_warning_for_asm (insn, msgid, ap)
      rtx insn;
-     const char *s;
+     const char *msgid;
      va_list ap;
 {
   if (count_error (1))
@@ -1907,55 +1981,55 @@ v_warning_for_asm (insn, s, ap)
 
       file_and_line_for_asm (insn, &file, &line);
       report_error_function (file);
-      v_message_with_file_and_line (file, line, "warning", s, ap);
+      v_message_with_file_and_line (file, line, 1, msgid, ap);
     }
 }
 
 void
-warning_for_asm VPROTO((rtx insn, const char *s, ...))
+warning_for_asm VPROTO((rtx insn, const char *msgid, ...))
 {
 #ifndef ANSI_PROTOTYPES
   rtx insn;
-  const char *s;
+  const char *msgid;
 #endif
   va_list ap;
 
-  VA_START (ap, s);
+  VA_START (ap, msgid);
 
 #ifndef ANSI_PROTOTYPES
   insn = va_arg (ap, rtx);
-  s = va_arg (ap, const char *);
+  msgid = va_arg (ap, const char *);
 #endif
 
-  v_warning_for_asm (insn, s, ap);
+  v_warning_for_asm (insn, msgid, ap);
   va_end (ap);
 }
 
 /* Report a warning at the current line number.  */
 
 static void
-vwarning (s, ap)
-     const char *s;
+vwarning (msgid, ap)
+     const char *msgid;
      va_list ap;
 {
-  v_warning_with_file_and_line (input_filename, lineno, s, ap);
+  v_warning_with_file_and_line (input_filename, lineno, msgid, ap);
 }
 
 void
-warning VPROTO((const char *s, ...))
+warning VPROTO((const char *msgid, ...))
 {
 #ifndef ANSI_PROTOTYPES
-  const char *s;
+  const char *msgid;
 #endif
   va_list ap;
 
-  VA_START (ap, s);
+  VA_START (ap, msgid);
 
 #ifndef ANSI_PROTOTYPES
-  s = va_arg (ap, const char *);
+  msgid = va_arg (ap, const char *);
 #endif
 
-  vwarning (s, ap);
+  vwarning (msgid, ap);
   va_end (ap);
 }
 
@@ -1963,38 +2037,38 @@ warning VPROTO((const char *s, ...))
    -pedantic-errors.  */
 
 static void
-vpedwarn (s, ap)
-     const char *s;
+vpedwarn (msgid, ap)
+     const char *msgid;
      va_list ap;
 {
   if (flag_pedantic_errors)
-    verror (s, ap);
+    verror (msgid, ap);
   else
-    vwarning (s, ap);
+    vwarning (msgid, ap);
 }
 
 void
-pedwarn VPROTO((const char *s, ...))
+pedwarn VPROTO((const char *msgid, ...))
 {
 #ifndef ANSI_PROTOTYPES
-  const char *s;
+  const char *msgid;
 #endif
   va_list ap;
 
-  VA_START (ap, s);
+  VA_START (ap, msgid);
 
 #ifndef ANSI_PROTOTYPES
-  s = va_arg (ap, const char *);
+  msgid = va_arg (ap, const char *);
 #endif
 
-  vpedwarn (s, ap);
+  vpedwarn (msgid, ap);
   va_end (ap);
 }
 
 static void
-v_pedwarn_with_decl (decl, s, ap)
+v_pedwarn_with_decl (decl, msgid, ap)
      tree decl;
-     const char *s;
+     const char *msgid;
      va_list ap;
 {
   /* We don't want -pedantic-errors to cause the compilation to fail from
@@ -2007,73 +2081,73 @@ v_pedwarn_with_decl (decl, s, ap)
   if (! DECL_IN_SYSTEM_HEADER (decl))
     {
       if (flag_pedantic_errors)
-       v_error_with_decl (decl, s, ap);
+       v_error_with_decl (decl, msgid, ap);
       else
-       v_warning_with_decl (decl, s, ap);
+       v_warning_with_decl (decl, msgid, ap);
     }
 }
 
 void
-pedwarn_with_decl VPROTO((tree decl, const char *s, ...))
+pedwarn_with_decl VPROTO((tree decl, const char *msgid, ...))
 {
 #ifndef ANSI_PROTOTYPES
   tree decl;
-  const char *s;
+  const char *msgid;
 #endif
   va_list ap;
 
-  VA_START (ap, s);
+  VA_START (ap, msgid);
 
 #ifndef ANSI_PROTOTYPES
   decl = va_arg (ap, tree);
-  s = va_arg (ap, const char *);
+  msgid = va_arg (ap, const char *);
 #endif
 
-  v_pedwarn_with_decl (decl, s, ap);
+  v_pedwarn_with_decl (decl, msgid, ap);
   va_end (ap);
 }
 
 static void
-v_pedwarn_with_file_and_line (file, line, s, ap)
+v_pedwarn_with_file_and_line (file, line, msgid, ap)
      const char *file;
      int line;
-     const char *s;
+     const char *msgid;
      va_list ap;
 {
   if (flag_pedantic_errors)
-    v_error_with_file_and_line (file, line, s, ap);
+    v_error_with_file_and_line (file, line, msgid, ap);
   else
-    v_warning_with_file_and_line (file, line, s, ap);
+    v_warning_with_file_and_line (file, line, msgid, ap);
 }
 
 void
 pedwarn_with_file_and_line VPROTO((const char *file, int line,
-                                  const char *s, ...))
+                                  const char *msgid, ...))
 {
 #ifndef ANSI_PROTOTYPES
   const char *file;
   int line;
-  const char *s;
+  const char *msgid;
 #endif
   va_list ap;
 
-  VA_START (ap, s);
+  VA_START (ap, msgid);
 
 #ifndef ANSI_PROTOTYPES
   file = va_arg (ap, const char *);
   line = va_arg (ap, int);
-  s = va_arg (ap, const char *);
+  msgid = va_arg (ap, const char *);
 #endif
 
-  v_pedwarn_with_file_and_line (file, line, s, ap);
+  v_pedwarn_with_file_and_line (file, line, msgid, ap);
   va_end (ap);
 }
 
 /* Apologize for not implementing some feature.  */
 
 static void
-vsorry (s, ap)
-     const char *s;
+vsorry (msgid, ap)
+     const char *msgid;
      va_list ap;
 {
   sorrycount++;
@@ -2081,59 +2155,26 @@ vsorry (s, ap)
     fprintf (stderr, "%s:%d: ", input_filename, lineno);
   else
     fprintf (stderr, "%s: ", progname);
-  vmessage ("sorry, not implemented", s, ap);
+  notice ("sorry, not implemented: ");
+  vnotice (stderr, msgid, ap);
   fputc ('\n', stderr);
 }
 
 void
-sorry VPROTO((const char *s, ...))
+sorry VPROTO((const char *msgid, ...))
 {
 #ifndef ANSI_PROTOTYPES
-  const char *s;
+  const char *msgid;
 #endif
   va_list ap;
 
-  VA_START (ap, s);
+  VA_START (ap, msgid);
 
 #ifndef ANSI_PROTOTYPES
-  s = va_arg (ap, const char *);
+  msgid = va_arg (ap, const char *);
 #endif
 
-  vsorry (s, ap);
-  va_end (ap);
-}
-
-/* Apologize for not implementing some feature, then quit.  */
-
-static void
-v_really_sorry (s, ap)
-     const char *s;
-     va_list ap;
-{
-  sorrycount++;
-  if (input_filename)
-    fprintf (stderr, "%s:%d: ", input_filename, lineno);
-  else
-    fprintf (stderr, "%s: ", progname);
-  vmessage ("sorry, not implemented", s, ap);
-  fatal (" (fatal)\n");
-}
-
-void
-really_sorry VPROTO((const char *s, ...))
-{
-#ifndef ANSI_PROTOTYPES
-  const char *s;
-#endif
-  va_list ap;
-
-  VA_START (ap, s);
-
-#ifndef ANSI_PROTOTYPES
-  s = va_arg (ap, const char *);
-#endif
-
-  v_really_sorry (s, ap);
+  vsorry (msgid, ap);
   va_end (ap);
 }
 \f
@@ -2899,7 +2940,7 @@ compile_file (name)
   if (yyparse () != 0)
     {
       if (errorcount == 0)
-       fprintf (stderr, "Errors detected in input file (your bison.simple is out of date)");
+       notice ("Errors detected in input file (your bison.simple is out of date)\n");
 
       /* In case there were missing closebraces,
         get us back to the global binding level.  */
@@ -4535,6 +4576,10 @@ main (argc, argv)
   }
 #endif
 
+  setlocale (LC_MESSAGES, "");
+  bindtextdomain (PACKAGE, localedir);
+  textdomain (PACKAGE);
+
   signal (SIGFPE, float_signal);
 
 #ifdef SIGPIPE
@@ -5196,7 +5241,7 @@ main (argc, argv)
     {
       char *lim = (char *) sbrk (0);
 
-      fprintf (stderr, "Data size %ld.\n", (long)(lim - (char *) &environ));
+      notice ("Data size %ld.\n", (long) (lim - (char *) &environ));
       fflush (stderr);
 
 #ifndef __MSDOS__
@@ -5225,7 +5270,7 @@ set_target_switch (name)
   const char *name;
 {
   register size_t j;
-  int valid = 0;
+  int valid_target_option = 0;
 
   for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
     if (!strcmp (target_switches[j].name, name))
@@ -5234,23 +5279,23 @@ set_target_switch (name)
          target_flags &= ~-target_switches[j].value;
        else
          target_flags |= target_switches[j].value;
-       valid = 1;
+       valid_target_option = 1;
       }
 
 #ifdef TARGET_OPTIONS
-  if (!valid)
+  if (!valid_target_option)
     for (j = 0; j < sizeof target_options / sizeof target_options[0]; j++)
       {
        int len = strlen (target_options[j].prefix);
        if (!strncmp (target_options[j].prefix, name, len))
          {
            *target_options[j].variable = name + len;
-           valid = 1;
+           valid_target_option = 1;
          }
       }
 #endif
 
-  if (!valid)
+  if (!valid_target_option)
     error ("Invalid option `%s'", name);
 }
 \f
@@ -5263,17 +5308,17 @@ print_version (file, indent)
      FILE *file;
      const char *indent;
 {
-  fprintf (file, "%s%s%s version %s", indent, *indent != 0 ? " " : "",
-          language_string, version_string);
-  fprintf (file, " (%s)", TARGET_NAME);
-#ifdef __GNUC__
 #ifndef __VERSION__
-#define __VERSION__ "[unknown]"
+#define __VERSION__ "[?]"
 #endif
-  fprintf (file, " compiled by GNU C version %s.\n", __VERSION__);
+  fnotice (file,
+#ifdef __GNUC__
+          "%s%s%s version %s (%s) compiled by GNU C version %s.\n"
 #else
-  fprintf (file, " compiled by CC.\n");
+          "%s%s%s version %s (%s) compiled by CC.\n"
 #endif
+          , indent, *indent != 0 ? " " : "",
+          language_string, version_string, TARGET_NAME, __VERSION__);
 }
 
 /* Print an option value and return the adjusted position in the line.
@@ -5323,7 +5368,7 @@ print_switch_values (file, pos, max, indent, sep, term)
   /* Print the options as passed.  */
 
   pos = print_single_switch (file, pos, max, indent, *indent ? " " : "", term,
-                            "options passed: ", "");
+                            _("options passed: "), "");
 
   for (p = &save_argv[1]; *p != NULL; p++)
     if (**p == '-')
@@ -5352,7 +5397,7 @@ print_switch_values (file, pos, max, indent, sep, term)
      should suffice.  */
 
   pos = print_single_switch (file, 0, max, indent, *indent ? " " : "", term,
-                            "options enabled: ", "");
+                            _("options enabled: "), "");
 
   for (j = 0; j < sizeof f_options / sizeof f_options[0]; j++)
     if (*f_options[j].variable == f_options[j].on_value)