{
static int warned = 0;
- if (!warned++ && dump_enabled_p ())
+ if (!warned++)
{
- dump_user_location_t loc
- = dump_user_location_t::from_location_t (input_location);
- dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc,
+ warning (OPT_Wmissing_profile,
+ "%qs profile count data file not found",
+ da_file_name);
+ if (dump_enabled_p ())
+ {
+ dump_user_location_t loc
+ = dump_user_location_t::from_location_t (input_location);
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc,
+ "file %s not found\n",
+ da_file_name);
+ dump_printf (MSG_OPTIMIZED_LOCATIONS,
(flag_guess_branch_prob
- ? "file %s not found, execution counts estimated\n"
- : "file %s not found, execution counts assumed to "
- "be zero\n"),
- da_file_name);
+ ? "execution counts estimated\n"
+ : "execution counts assumed to be zero\n"));
+ }
}
return NULL;
}
elt.ctr = counter;
entry = counts_hash->find (&elt);
if (!entry)
- /* The function was not emitted, or is weak and not chosen in the
- final executable. Silently fail, because there's nothing we
- can do about it. */
- return NULL;
+ {
+ if (counter == GCOV_COUNTER_ARCS)
+ warning_at (DECL_SOURCE_LOCATION (current_function_decl),
+ OPT_Wmissing_profile,
+ "profile for function %qD not found in profile data",
+ current_function_decl);
+ /* The function was not emitted, or is weak and not chosen in the
+ final executable. Silently fail, because there's nothing we
+ can do about it. */
+ return NULL;
+ }
if (entry->cfg_checksum != cfg_checksum)
{
-Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
-Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
-Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
--Wmissing-field-initializers -Wmissing-include-dirs @gol
+-Wmissing-field-initializers -Wmissing-include-dirs -Wmissing-profile @gol
-Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
-Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
-Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
@opindex Wcoverage-mismatch
Warn if feedback profiles do not match when using the
@option{-fprofile-use} option.
-If a source file is changed between compiling with @option{-fprofile-gen} and
-with @option{-fprofile-use}, the files with the profile feedback can fail
+If a source file is changed between compiling with @option{-fprofile-generate}
+and with @option{-fprofile-use}, the files with the profile feedback can fail
to match the source file and GCC cannot use the profile feedback
information. By default, this warning is enabled and is treated as an
error. @option{-Wno-coverage-mismatch} can be used to disable the
@opindex Wno-missing-include-dirs
Warn if a user-supplied include directory does not exist.
+@item -Wmissing-profile
+@opindex Wmissing-profile
+@opindex Wno-missing-profile
+Warn if feedback profiles are missing when using the
+@option{-fprofile-use} option.
+This option diagnoses those cases where a new function or a new file is added
+to the user code between compiling with @option{-fprofile-generate} and with
+@option{-fprofile-use}, without regenerating the profiles. In these cases, the
+profile feedback data files do not contain any profile feedback information for
+the newly added function or file respectively. Also, in the case when profile
+count data (.gcda) files are removed, GCC cannot use any profile feedback
+information. In all these cases, warnings are issued to inform the user that a
+profile generation step is due. @option{-Wno-missing-profile} can be used to
+disable the warning. Ignoring the warning can result in poorly optimized code.
+Completely disabling the warning is not recommended and should be done only
+when non-existent profile data is justified.
+
@item -Wmultistatement-macros
@opindex Wmultistatement-macros
@opindex Wno-multistatement-macros
By default, GCC emits an error message if the feedback profiles do not
match the source code. This error can be turned into a warning by using
-@option{-Wcoverage-mismatch}. Note this may result in poorly optimized
-code.
+@option{-Wno-error=coverage-mismatch}. Note this may result in poorly
+optimized code. Additionally, by default, GCC also emits a warning message if
+the feedback profiles do not exist (See @option{-Wmissing-profile}).
If @var{path} is specified, GCC looks at the @var{path} to find
the profile feedback data files. See @option{-fprofile-dir}.