re PR preprocessor/34695 (Preprocessor warning->error conversion from -Werror is silent)

	PR preprocessor/34695

gcc:
	* Makefile.in (c-opts.o): Depend on c-tree.h.
	* c-common.c: Move down include of diagnostic.h.
	(done_lexing, c_cpp_error): New.
	* c-common.h (done_lexing): Declare.
	* c-decl.c (c_write_global_declarations): Don't check cpp_errors
	(parse_in).
	* c-opts.c: Include c-tree.h.
	(c_common_init_options): Set preprocessor error callback.
	(c_common_handle_option): Do not set preprocessor
	inhibit_warnings, warnings_are_errors, warn_system_headers,
	pedantic_errors or inhibit_warnings flags.
	(c_common_post_options): Do not check cpp_errors (parse_in).
	(c_common_finish): Do not output dependencies if there were
	errors.  Do not check return value of cpp_finish.
	* c-ppoutput.c (pp_file_change): Set input_location.
	* c-tree.h (c_cpp_error): Declare.
	* diagnostic.c (diagnostic_set_info_translated): Also initialize
	override_column.
	(diagnostic_build_prefix): Check override_column.
	* diagnostic.h (diagnostic_info): Add override_column field.
	(diagnostic_override_column): Define.

gcc/cp:
	* cp-tree.h (cp_cpp_error): Remove.
	* error.c (cp_cpp_error): Remove.
	* parser.c (cp_lexer_new_main): Set done_lexing instead of
	client_diagnostic and error callback.

gcc/fortran:
	* cpp.c (cb_cpp_error): New.
	(gfc_cpp_post_options): Don't set cpp_option->inhibit_warnings.
	Don't check cpp_errors (cpp_in).
	(gfc_cpp_init_0): Set cb->error.

gcc/testsuite:
	* gcc.dg/builtin-redefine.c, gcc.dg/cpp/redef2.c,
	gcc.dg/cpp/redef3.c, gcc.dg/cpp/trad/redef2.c: Use dg-message
	instead of dg-warning for "previous definition" messages.
	* gcc.dg/cpp/Wvariadic-1.c, gcc.dg/cpp/Wvariadic-3.c: Expect
	"warnings being treated as errors" message.
	* gcc.dg/fltconst-1.c: Use -fshow-column.

libcpp:
	* makedepend.c: Remove.
	* Makefile.in (makedepend_OBJS, makedepend$(EXEEXT)): Remove.
	(all, clean, TAGS_SOURCES, include): Remove makedepend handling.
	* directives.c (cpp_errors): Remove.
	* errors.c (print_location, _cpp_begin_message, v_message):
	Remove.
	(cpp_error, cpp_error_with_line): Always use error callback.
	(cpp_error, cpp_error_with_line, cpp_errno): Return bool.
	* include/cpplib.h (cpp_options): Remove pedantic_errors,
	inhibit_warnings, warn_system_headers, inhibit_errors,
	warnings_are_errors, client_diagnostic.
	(cpp_callbacks): Add extra arguments to error callback; make it
	return bool.
	(cpp_finish): Return void.
	(cpp_destroy): Remove inaccurate comment about return value.
	(cpp_errors, CPP_DL_EXTRACT, CPP_DL_WARNING_P): Remove.
	(CPP_DL_NOTE): Define.
	* include/line-map.h (linemap_print_containing_files): Remove.
	* init.c (cpp_finish): Do not check for or return number of
	errors.
	* internal.h (cpp_reader): Remove errors field.
	* line-map.c (linemap_print_containing_files): Remove.
	* macro.c (_cpp_create_definition): Use CPP_DL_NOTE for message
	about previous definition.  Only emit it if previous diagnostic
	was emitted.

From-SVN: r145263
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index e2c505c..ffde40e 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -302,22 +302,9 @@
   /* Nonzero means print names of header files (-H).  */
   unsigned char print_include_names;
 
-  /* Nonzero means cpp_pedwarn causes a hard error.  */
-  unsigned char pedantic_errors;
-
-  /* Nonzero means don't print warning messages.  */
-  unsigned char inhibit_warnings;
-
   /* Nonzero means complain about deprecated features.  */
   unsigned char warn_deprecated;
 
-  /* Nonzero means don't suppress warnings from system headers.  */
-  unsigned char warn_system_headers;
-
-  /* Nonzero means don't print error messages.  Has no option to
-     select it, but can be set by a user of cpplib (e.g. fix-header).  */
-  unsigned char inhibit_errors;
-
   /* Nonzero means warn if slash-star appears in a comment.  */
   unsigned char warn_comments;
 
@@ -353,9 +340,6 @@
      explicitly undefined.  */
   unsigned char warn_builtin_macro_redefined;
 
-  /* Nonzero means turn warnings into errors.  */
-  unsigned char warnings_are_errors;
-
   /* Nonzero means we should look for header.gcc files that remap file
      names.  */
   unsigned char remap;
@@ -450,9 +434,6 @@
   /* Nonzero means __STDC__ should have the value 0 in system headers.  */
   unsigned char stdc_0_in_system_headers;
 
-  /* True means error callback should be used for diagnostics.  */
-  bool client_diagnostic;
-
   /* True disables tokenization outside of preprocessing directives. */
   bool directives_only;
 };
@@ -492,10 +473,11 @@
      be expanded.  */
   cpp_hashnode * (*macro_to_expand) (cpp_reader *, const cpp_token *);
 
-  /* Called to emit a diagnostic if client_diagnostic option is true.
-     This callback receives the translated message.  */
-  void (*error) (cpp_reader *, int, const char *, va_list *)
-       ATTRIBUTE_FPTR_PRINTF(3,0);
+  /* Called to emit a diagnostic.  This callback receives the
+     translated message.  */
+  bool (*error) (cpp_reader *, int, source_location, unsigned int,
+		 const char *, va_list *)
+       ATTRIBUTE_FPTR_PRINTF(5,0);
 
   /* Callbacks for when a macro is expanded, or tested (whether
      defined or not at the time) in #ifdef, #ifndef or "defined".  */
@@ -697,19 +679,13 @@
 
 /* Call this to finish preprocessing.  If you requested dependency
    generation, pass an open stream to write the information to,
-   otherwise NULL.  It is your responsibility to close the stream.
-
-   Returns cpp_errors (pfile).  */
-extern int cpp_finish (cpp_reader *, FILE *deps_stream);
+   otherwise NULL.  It is your responsibility to close the stream.  */
+extern void cpp_finish (cpp_reader *, FILE *deps_stream);
 
 /* Call this to release the handle at the end of preprocessing.  Any
-   use of the handle after this function returns is invalid.  Returns
-   cpp_errors (pfile).  */
+   use of the handle after this function returns is invalid.  */
 extern void cpp_destroy (cpp_reader *);
 
-/* Error count.  */
-extern unsigned int cpp_errors (cpp_reader *);
-
 extern unsigned int cpp_token_len (const cpp_token *);
 extern unsigned char *cpp_token_as_text (cpp_reader *, const cpp_token *);
 extern unsigned char *cpp_spell_token (cpp_reader *, const cpp_token *,
@@ -835,24 +811,21 @@
 /* An internal consistency check failed.  Prints "internal error: ",
    otherwise the same as CPP_DL_ERROR.  */
 #define CPP_DL_ICE		0x04
-/* Extracts a diagnostic level from an int.  */
-#define CPP_DL_EXTRACT(l)	(l & 0xf)
-/* Nonzero if a diagnostic level is one of the warnings.  */
-#define CPP_DL_WARNING_P(l)	(CPP_DL_EXTRACT (l) >= CPP_DL_WARNING \
-				 && CPP_DL_EXTRACT (l) <= CPP_DL_PEDWARN)
+/* An informative note following a warning.  */
+#define CPP_DL_NOTE		0x05
 
 /* Output a diagnostic of some kind.  */
-extern void cpp_error (cpp_reader *, int, const char *msgid, ...)
+extern bool cpp_error (cpp_reader *, int, const char *msgid, ...)
   ATTRIBUTE_PRINTF_3;
 
 /* Output a diagnostic with "MSGID: " preceding the
    error string of errno.  No location is printed.  */
-extern void cpp_errno (cpp_reader *, int, const char *msgid);
+extern bool cpp_errno (cpp_reader *, int, const char *msgid);
 
 /* Same as cpp_error, except additionally specifies a position as a
    (translation unit) physical line and physical column.  If the line is
    zero, then no location is printed.  */
-extern void cpp_error_with_line (cpp_reader *, int, source_location, unsigned,
+extern bool cpp_error_with_line (cpp_reader *, int, source_location, unsigned,
 				 const char *msgid, ...) ATTRIBUTE_PRINTF_5;
 
 /* In lex.c */