summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
3e8004a)
2010-05-04 Neil Vachharajani <nvachhar@google.com>
* doc/invoke.texi (-Wcoverage-mismatch): Updated documentation as
per new semantics.
* opts.c (decode_options): Enable -Werror=coverage-mismatch.
* coverage.c (get_coverage_counts): Always emit a warning. Adjust
conditions for printing notes.
* common.opt (-Wcoverage-mismatch): Allow negative, default to
true, update documentation.
* Makefile.in (coverage.o): Add dependence on DIAGNOSTIC_H and intl.h.
* testsuite/gcc.dg/tree-prof/wcoverage-mismatch.c: Adjusted.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159050
138bc75d-0d04-0410-961f-
82ee72b054a4
+2010-05-04 Neil Vachharajani <nvachhar@google.com>
+
+ * doc/invoke.texi (-Wcoverage-mismatch): Updated documentation as
+ per new semantics.
+ * opts.c (decode_options): Enable -Werror=coverage-mismatch.
+ * coverage.c (get_coverage_counts): Always emit a warning. Adjust
+ conditions for printing notes.
+ * common.opt (-Wcoverage-mismatch): Allow negative, default to
+ true, update documentation.
+ * Makefile.in (coverage.o): Add dependence on DIAGNOSTIC_H and intl.h.
+ * testsuite/gcc.dg/tree-prof/wcoverage-mismatch.c: Adjusted.
+
2010-05-04 Jakub Jelinek <jakub@redhat.com>
PR c/43981
2010-05-04 Jakub Jelinek <jakub@redhat.com>
PR c/43981
coverage.o : coverage.c $(GCOV_IO_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(RTL_H) $(TREE_H) $(FLAGS_H) output.h $(REGS_H) $(EXPR_H) \
$(FUNCTION_H) $(TOPLEV_H) $(GGC_H) langhooks.h $(COVERAGE_H) gt-coverage.h \
coverage.o : coverage.c $(GCOV_IO_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(RTL_H) $(TREE_H) $(FLAGS_H) output.h $(REGS_H) $(EXPR_H) \
$(FUNCTION_H) $(TOPLEV_H) $(GGC_H) langhooks.h $(COVERAGE_H) gt-coverage.h \
- $(HASHTAB_H) tree-iterator.h $(CGRAPH_H) $(TREE_PASS_H) gcov-io.c $(TM_P_H)
+ $(HASHTAB_H) tree-iterator.h $(CGRAPH_H) $(TREE_PASS_H) gcov-io.c $(TM_P_H) \
+ $(DIAGNOSTIC_H) intl.h
cselib.o : cselib.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(REGS_H) hard-reg-set.h $(FLAGS_H) $(REAL_H) insn-config.h $(RECOG_H) \
$(EMIT_RTL_H) $(TOPLEV_H) output.h $(FUNCTION_H) $(TREE_PASS_H) \
cselib.o : cselib.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(REGS_H) hard-reg-set.h $(FLAGS_H) $(REAL_H) insn-config.h $(RECOG_H) \
$(EMIT_RTL_H) $(TOPLEV_H) output.h $(FUNCTION_H) $(TREE_PASS_H) \
Warn when a variable is unused
Wcoverage-mismatch
Warn when a variable is unused
Wcoverage-mismatch
-Common RejectNegative Var(warn_coverage_mismatch) Warning
-Warn instead of error in case profiles in -fprofile-use do not match
+Common Var(warn_coverage_mismatch) Init(1) Warning
+Warn in case profiles in -fprofile-use do not match
#include "tree-iterator.h"
#include "cgraph.h"
#include "tree-pass.h"
#include "tree-iterator.h"
#include "cgraph.h"
#include "tree-pass.h"
+#include "diagnostic.h"
+#include "intl.h"
|| entry->summary.num != expected)
{
static int warned = 0;
|| entry->summary.num != expected)
{
static int warned = 0;
+ bool warning_printed = false;
tree id = DECL_ASSEMBLER_NAME (current_function_decl);
tree id = DECL_ASSEMBLER_NAME (current_function_decl);
- if (warn_coverage_mismatch)
- warning (OPT_Wcoverage_mismatch, "coverage mismatch for function "
- "%qE while reading counter %qs", id, ctr_names[counter]);
- else
- error ("coverage mismatch for function %qE while reading counter %qs",
- id, ctr_names[counter]);
-
- if (!inhibit_warnings)
+ warning_printed =
+ warning_at (input_location, OPT_Wcoverage_mismatch,
+ "coverage mismatch for function "
+ "%qE while reading counter %qs", id, ctr_names[counter]);
+ if (warning_printed)
{
if (entry->checksum != checksum)
{
if (entry->checksum != checksum)
- inform (input_location, "checksum is %x instead of %x", entry->checksum, checksum);
+ inform (input_location, "checksum is %x instead of %x",
+ entry->checksum, checksum);
else
inform (input_location, "number of counters is %d instead of %d",
entry->summary.num, expected);
else
inform (input_location, "number of counters is %d instead of %d",
entry->summary.num, expected);
- }
-
- if (warn_coverage_mismatch
- && !inhibit_warnings
- && !warned++)
- {
- inform (input_location, "coverage mismatch ignored due to -Wcoverage-mismatch");
- inform (input_location, flag_guess_branch_prob
- ? "execution counts estimated"
- : "execution counts assumed to be zero");
- if (!flag_guess_branch_prob)
- inform (input_location, "this can result in poorly optimized code");
+
+ if (!(errorcount || sorrycount)
+ && !warned++)
+ {
+ inform (input_location, "coverage mismatch ignored");
+ inform (input_location, flag_guess_branch_prob
+ ? G_("execution counts estimated")
+ : G_("execution counts assumed to be zero"));
+ if (!flag_guess_branch_prob)
+ inform (input_location,
+ "this can result in poorly optimized code");
+ }
If a source file was changed between @option{-fprofile-gen} and
@option{-fprofile-use}, the files with the profile feedback can fail
to match the source file and GCC can not use the profile feedback
If a source file was changed between @option{-fprofile-gen} and
@option{-fprofile-use}, the files with the profile feedback can fail
to match the source file and GCC can not use the profile feedback
-information. By default, GCC emits an error message in this case.
-The option @option{-Wcoverage-mismatch} emits a warning instead of an
-error. GCC does not use appropriate feedback profiles, so using this
-option can result in poorly optimized code. This option is useful
-only in the case of very minor changes such as bug fixes to an
-existing code-base.
+information. By default, this warning is enabled and is treated as an
+error. @option{-Wno-coverage-mismatch} can be used to disable the
+warning or @option{-Wno-error=coverage-mismatch} can be used to
+disable the error. Disable the error for this warning can result in
+poorly optimized code, so disabling the error is useful only in the
+case of very minor changes such as bug fixes to an existing code-base.
+Completely disabling the warning is not recommended.
else
set_param_value ("min-crossjump-insns", initial_min_crossjump_insns);
else
set_param_value ("min-crossjump-insns", initial_min_crossjump_insns);
+ /* Enable -Werror=coverage-mismatch by default */
+ enable_warning_as_error("coverage-mismatch", 1, lang_mask);
+
if (first_time_p)
{
/* Initialize whether `char' is signed. */
if (first_time_p)
{
/* Initialize whether `char' is signed. */
-/* { dg-options "-O2 -Wcoverage-mismatch -w" } */
+/* { dg-options "-O2 -Wno-coverage-mismatch" } */
int __attribute__((noinline)) bar (void)
{
int __attribute__((noinline)) bar (void)
{