===================================================================
@@ -2690,16 +2690,18 @@ void gfc_buffer_error (int);
const char *gfc_print_wide_char (gfc_char_t);
void gfc_warning (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
void gfc_warning_now (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
-void gfc_warning_cmdline (const char *gmsgid, ...) ATTRIBUTE_GCC_GFC(1,2);
+bool gfc_warning_cmdline (const char *gmsgid, ...) ATTRIBUTE_GCC_GFC(1,2);
+bool gfc_warning_cmdline (int opt, const char *gmsgid, ...) ATTRIBUTE_GCC_GFC(2,3);
void gfc_clear_warning (void);
void gfc_warning_check (void);
void gfc_error (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
+void gfc_error_cmdline (const char *gmsgid, ...) ATTRIBUTE_GCC_GFC(1,2);
void gfc_error_now (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
void gfc_fatal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_GCC_GFC(1,2);
void gfc_internal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_GCC_GFC(1,2);
void gfc_clear_error (void);
int gfc_error_check (void);
===================================================================
@@ -1050,25 +1050,61 @@ gfc_diagnostic_finalizer (diagnostic_con
{
pp_destroy_prefix (context->printer);
pp_newline_and_flush (context->printer);
}
/* Give a warning about the command-line. */
-void
+bool
+gfc_warning_cmdline (int opt, const char *gmsgid, ...)
+{
+ va_list argp;
+ diagnostic_info diagnostic;
+ bool ret;
+
+ va_start (argp, gmsgid);
+ diagnostic_set_info (&diagnostic, gmsgid, &argp, UNKNOWN_LOCATION,
+ DK_WARNING);
+ diagnostic.option_index = opt;
+ ret = report_diagnostic (&diagnostic);
+ va_end (argp);
+ return ret;
+}
+
+
+/* Give a warning about the command-line. */
+
+bool
gfc_warning_cmdline (const char *gmsgid, ...)
{
va_list argp;
diagnostic_info diagnostic;
+ bool ret;
va_start (argp, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &argp, UNKNOWN_LOCATION,
DK_WARNING);
+ ret = report_diagnostic (&diagnostic);
+ va_end (argp);
+ return ret;
+}
+
+
+/* Give an error about the command-line. */
+
+void
+gfc_error_cmdline (const char *gmsgid, ...)
+{
+ va_list argp;
+ diagnostic_info diagnostic;
+
+ va_start (argp, gmsgid);
+ diagnostic_set_info (&diagnostic, gmsgid, &argp, UNKNOWN_LOCATION, DK_ERROR);
report_diagnostic (&diagnostic);
va_end (argp);
}
/* Clear the warning flag. */
void
gfc_clear_warning (void)
{
===================================================================
@@ -322,23 +322,20 @@ add_path_to_list (gfc_directorylist **li
q[i--] = '\0';
if (stat (q, &st))
{
if (errno != ENOENT)
- gfc_warning_now ("Include directory \"%s\": %s", path,
- xstrerror(errno));
- else
- {
- /* FIXME: Also support -Wmissing-include-dirs. */
- if (warn)
- gfc_warning_now ("Nonexistent include directory \"%s\"", path);
- }
+ gfc_warning_cmdline ("Include directory %qs: %s", path,
+ xstrerror(errno));
+ else if (warn)
+ gfc_warning_cmdline (OPT_Wmissing_include_dirs,
+ "Nonexistent include directory %qs", path);
return;
}
else if (!S_ISDIR (st.st_mode))
{
- gfc_warning_now ("\"%s\" is not a directory", path);
+ gfc_warning_cmdline ("%qs is not a directory", path);
return;
}
if (head || *list == NULL)
{
@@ -1923,11 +1920,11 @@ load_file (const char *realfilename, con
}
else
input = gfc_open_file (realfilename);
if (input == NULL)
{
- gfc_error_now ("Can't open file '%s'", filename);
+ gfc_error_cmdline ("Can't open file %qs", filename);
return false;
}
}
else
{