OSDN Git Service

PR c++/36695
[pf3gnuchains/gcc-fork.git] / gcc / diagnostic.c
index cb4c67a..f323f36 100644 (file)
@@ -489,16 +489,16 @@ emit_diagnostic (diagnostic_t kind, location_t location, int opt,
   return report_diagnostic (&diagnostic);
 }
 
-/* An informative note.  Use this for additional details on an error
+/* An informative note at LOCATION.  Use this for additional details on an error
    message.  */
 void
-inform (const char *gmsgid, ...)
+inform (location_t location, const char *gmsgid, ...)
 {
   diagnostic_info diagnostic;
   va_list ap;
 
   va_start (ap, gmsgid);
-  diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_NOTE);
+  diagnostic_set_info (&diagnostic, gmsgid, &ap, location, DK_NOTE);
   report_diagnostic (&diagnostic);
   va_end (ap);
 }
@@ -537,10 +537,10 @@ warning_at (location_t location, int opt, const char *gmsgid, ...)
   return report_diagnostic (&diagnostic);
 }
 
-/* A "pedantic" warning: issues a warning unless -pedantic-errors was
-   given on the command line, in which case it issues an error.  Use
-   this for diagnostics required by the relevant language standard,
-   if you have chosen not to make them errors.
+/* A "pedantic" warning at LOCATION: issues a warning unless
+   -pedantic-errors was given on the command line, in which case it
+   issues an error.  Use this for diagnostics required by the relevant
+   language standard, if you have chosen not to make them errors.
 
    Note that these diagnostics are issued independent of the setting
    of the -pedantic command-line switch.  To get a warning enabled
@@ -551,13 +551,13 @@ warning_at (location_t location, int opt, const char *gmsgid, ...)
    Returns true if the warning was printed, false if it was inhibited.  */
 
 bool
-pedwarn (int opt, const char *gmsgid, ...)
+pedwarn (location_t location, int opt, const char *gmsgid, ...)
 {
   diagnostic_info diagnostic;
   va_list ap;
 
   va_start (ap, gmsgid);
-  diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_PEDWARN);
+  diagnostic_set_info (&diagnostic, gmsgid, &ap, location,  DK_PEDWARN);
   diagnostic.option_index = opt;
   va_end (ap);
   return report_diagnostic (&diagnostic);
@@ -571,7 +571,7 @@ pedwarn (int opt, const char *gmsgid, ...)
    Returns true if the warning was printed, false if it was inhibited.  */
 
 bool
-permerror_at (location_t location, const char *gmsgid, ...)
+permerror (location_t location, const char *gmsgid, ...)
 {
   diagnostic_info diagnostic;
   va_list ap;
@@ -584,33 +584,29 @@ permerror_at (location_t location, const char *gmsgid, ...)
   return report_diagnostic (&diagnostic);
 }
 
-/* Equivalent to permerror_at (input_location, ...).  */
-
-bool
-permerror (const char *gmsgid, ...)
+/* A hard error: the code is definitely ill-formed, and an object file
+   will not be produced.  */
+void
+error (const char *gmsgid, ...)
 {
   diagnostic_info diagnostic;
   va_list ap;
 
   va_start (ap, gmsgid);
-  diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location,
-                      permissive_error_kind ());
-  diagnostic.option_index = OPT_fpermissive;
+  diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_ERROR);
+  report_diagnostic (&diagnostic);
   va_end (ap);
-  return report_diagnostic (&diagnostic);
 }
 
-
-/* A hard error: the code is definitely ill-formed, and an object file
-   will not be produced.  */
+/* Same as ebove, but use location LOC instead of input_location.  */
 void
-error (const char *gmsgid, ...)
+error_at (location_t loc, const char *gmsgid, ...)
 {
   diagnostic_info diagnostic;
   va_list ap;
 
   va_start (ap, gmsgid);
-  diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_ERROR);
+  diagnostic_set_info (&diagnostic, gmsgid, &ap, loc, DK_ERROR);
   report_diagnostic (&diagnostic);
   va_end (ap);
 }