aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/c-opts.c
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2014-08-20 23:07:29 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2014-08-20 23:07:29 +0000
commit18767f6502134a72689c3b7be96723a0c03a6a30 (patch)
tree3f03556a5974697ffb4bafd96217230d8739848a /gcc/c-family/c-opts.c
parent22e6bd6f6c83773aad53732b5880eb07d9100499 (diff)
downloadgcc-18767f6502134a72689c3b7be96723a0c03a6a30.zip
gcc-18767f6502134a72689c3b7be96723a0c03a6a30.tar.gz
gcc-18767f6502134a72689c3b7be96723a0c03a6a30.tar.bz2
re PR fortran/44054 (Handle -Werror, -Werror=, -fdiagnostics-show-option, !GCC$ diagnostic (pragmas) and color)
gcc/ChangeLog: 2014-08-21 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * diagnostic.c (default_diagnostic_finalizer): Move caret printing to here ... (diagnostic_report_diagnostic): ... from here. * toplev.c (general_init): Move code to c-family. gcc/cp/ChangeLog: 2014-08-21 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * error.c (cp_diagnostic_finalizer): Delete. (init_error): Do not set diagnostic_finalizer here. gcc/c-family/ChangeLog: 2014-08-21 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * c-opts.c: Include tree-diagnostics.h. (c_diagnostic_finalizer): New. (c_common_initialize_diagnostics): Use it. gcc/fortran/ChangeLog: 2014-08-21 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * error.c (gfc_diagnostic_finalizer): Call default finalizer. From-SVN: r214245
Diffstat (limited to 'gcc/c-family/c-opts.c')
-rw-r--r--gcc/c-family/c-opts.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 2b423e2..5cae2b8 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "toplev.h"
#include "langhooks.h"
#include "diagnostic.h"
+#include "tree-diagnostic.h" /* for virt_loc_aware_diagnostic_finalizer */
#include "intl.h"
#include "cppdefault.h"
#include "incpath.h"
@@ -164,6 +165,19 @@ c_common_option_lang_mask (void)
return lang_flags[c_language];
}
+/* Diagnostic finalizer for C/C++/Objective-C/Objective-C++. */
+static void
+c_diagnostic_finalizer (diagnostic_context *context,
+ diagnostic_info *diagnostic)
+{
+ diagnostic_show_locus (context, diagnostic);
+ /* By default print macro expansion contexts in the diagnostic
+ finalizer -- for tokens resulting from macro expansion. */
+ virt_loc_aware_diagnostic_finalizer (context, diagnostic);
+ pp_destroy_prefix (context->printer);
+ pp_newline_and_flush (context->printer);
+}
+
/* Common diagnostics initialization. */
void
c_common_initialize_diagnostics (diagnostic_context *context)
@@ -179,7 +193,7 @@ c_common_initialize_diagnostics (diagnostic_context *context)
diagnostic message. */
diagnostic_prefixing_rule (context) = DIAGNOSTICS_SHOW_PREFIX_ONCE;
}
-
+ diagnostic_finalizer (context) = c_diagnostic_finalizer;
context->opt_permissive = OPT_fpermissive;
}