summaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2008-03-02 15:45:29 +0000
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2008-03-02 15:45:29 +0000
commit07317e6985727a04296a7c5cbdaed8e4555f3038 (patch)
treefe322a3045cc0749a70363f868657cbec06018f4 /gcc/diagnostic.c
parent1ba43cd9540afb5348b3542fd9f4ef5decdcd314 (diff)
downloadgcc-07317e6985727a04296a7c5cbdaed8e4555f3038.tar.gz
2008-03-02 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR 24924 * c-common.c (flag_permissive): Delete. (constant_expression_warnings): Check flags first. (constant_expression_error): New. * c-common.h (flag_permissive): Delete. (constant_expression_error): Declare. * flags.h (flag_permissive): Declare. Update description. * diagnostic.c (pedwarn): Update. (permerror): New. * diagnostic.h: (pedantic_error_kind): Rename as pedantic_warning_kind. (permissive_error_kind): New. * toplev.c (flag_permissive): Define. Update description. * toplev.h (permissive_error_kind): Declare. * c-errors.c (pedwarn_c99): Use pedantic_warning_kind. (pedwarn_c90): Use pedantic_warning_kind. * c-opts.c (c_common_post_options): flag_permissive does not affect flag_pedantic_errors. cp/ * class.c (finish_struct_anon): Use permerror instead of pedwarn. (check_field_decls): Likewise. (note_name_declared_in_class): Likewise. * call.c (build_new_op): Likewise. (convert_like_real): Likewise. (build_over_call): Likewise. * lex.c (unqualified_fn_lookup_error): Likewise. * parser.c (cp_parser_template_id): Likewise. * cvt.c (warn_ref_binding): Likewise. (convert_to_reference): Likewise. (ocp_convert): Likewise. (convert_to_void): Use error instead of pedwarn. * error.c (cp_cpp_error): Use pedantic_warning_kind. * decl.c (compute_array_index_type): Use constant_expression_error. testsuite/ * g++.dg/cpp/string-2.C: This is a warning now. * g++.dg/cpp/pedantic-errors.C: -pedantic-errors is not enabled by default, so add it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132817 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r--gcc/diagnostic.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index bc4e051b8b5..29889047127 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -544,11 +544,31 @@ pedwarn (const char *gmsgid, ...)
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location,
- pedantic_error_kind ());
+ pedantic_warning_kind ());
report_diagnostic (&diagnostic);
va_end (ap);
}
+/* A "permissive" error: issues an error unless -fpermissive was given
+ on the command line, in which case it issues a warning. Use this
+ for things that really should be errors but we want to support
+ legacy code. */
+
+void
+permerror (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;
+ report_diagnostic (&diagnostic);
+ va_end (ap);
+}
+
+
/* A hard error: the code is definitely ill-formed, and an object file
will not be produced. */
void