summaryrefslogtreecommitdiff
path: root/gcc/ipa-devirt.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2014-09-20 03:06:26 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2014-09-20 03:06:26 +0000
commit1b35579354b822bd5d2a440693b2f0e211d5b1d5 (patch)
tree2944385c8add22c4bd448d6f39c1915d60932eaf /gcc/ipa-devirt.c
parent38889e9875adacc954b5885f2f2f98d718a04ca5 (diff)
downloadgcc-1b35579354b822bd5d2a440693b2f0e211d5b1d5.tar.gz
* diagnostic.c (warning_n): New function.
* diagnostic-core.h (warning_n): Declare. * ipa-devirt.c (ipa_devirt): Handle singulars correctly; output dynamic counts when available. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215416 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-devirt.c')
-rw-r--r--gcc/ipa-devirt.c83
1 files changed, 64 insertions, 19 deletions
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 61e87e80240..774275b2269 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -4137,12 +4137,31 @@ ipa_devirt (void)
if (final_warning_records->type_warnings[i].count)
{
tree type = final_warning_records->type_warnings[i].type;
- warning_at (DECL_SOURCE_LOCATION (TYPE_NAME (type)),
- OPT_Wsuggest_final_types,
- "Declaring type %qD final "
- "would enable devirtualization of %i calls",
- type,
- final_warning_records->type_warnings[i].count);
+ int count = final_warning_records->type_warnings[i].count;
+ long long dyn_count
+ = final_warning_records->type_warnings[i].dyn_count;
+
+ if (!dyn_count)
+ warning_n (DECL_SOURCE_LOCATION (TYPE_NAME (type)),
+ OPT_Wsuggest_final_types, count,
+ "Declaring type %qD final "
+ "would enable devirtualization of %i call",
+ "Declaring type %qD final "
+ "would enable devirtualization of %i calls",
+ type,
+ count);
+ else
+ warning_n (DECL_SOURCE_LOCATION (TYPE_NAME (type)),
+ OPT_Wsuggest_final_types, count,
+ "Declaring type %qD final "
+ "would enable devirtualization of %i call "
+ "executed %lli times",
+ "Declaring type %qD final "
+ "would enable devirtualization of %i calls "
+ "executed %lli times",
+ type,
+ count,
+ dyn_count);
}
}
@@ -4157,19 +4176,45 @@ ipa_devirt (void)
{
tree decl = decl_warnings_vec[i]->decl;
int count = decl_warnings_vec[i]->count;
-
- if (DECL_CXX_DESTRUCTOR_P (decl))
- warning_at (DECL_SOURCE_LOCATION (decl),
- OPT_Wsuggest_final_methods,
- "Declaring virtual destructor of %qD final "
- "would enable devirtualization of %i calls",
- DECL_CONTEXT (decl), count);
- else
- warning_at (DECL_SOURCE_LOCATION (decl),
- OPT_Wsuggest_final_methods,
- "Declaring method %qD final "
- "would enable devirtualization of %i calls",
- decl, count);
+ long long dyn_count = decl_warnings_vec[i]->dyn_count;
+
+ if (!dyn_count)
+ if (DECL_CXX_DESTRUCTOR_P (decl))
+ warning_n (DECL_SOURCE_LOCATION (decl),
+ OPT_Wsuggest_final_methods, count,
+ "Declaring virtual destructor of %qD final "
+ "would enable devirtualization of %i call",
+ "Declaring virtual destructor of %qD final "
+ "would enable devirtualization of %i calls",
+ DECL_CONTEXT (decl), count);
+ else
+ warning_n (DECL_SOURCE_LOCATION (decl),
+ OPT_Wsuggest_final_methods, count,
+ "Declaring method %qD final "
+ "would enable devirtualization of %i call",
+ "Declaring method %qD final "
+ "would enable devirtualization of %i calls",
+ decl, count);
+ else if (DECL_CXX_DESTRUCTOR_P (decl))
+ warning_n (DECL_SOURCE_LOCATION (decl),
+ OPT_Wsuggest_final_methods, count,
+ "Declaring virtual destructor of %qD final "
+ "would enable devirtualization of %i call "
+ "executed %lli times",
+ "Declaring virtual destructor of %qD final "
+ "would enable devirtualization of %i calls "
+ "executed %lli times",
+ DECL_CONTEXT (decl), count, dyn_count);
+ else
+ warning_n (DECL_SOURCE_LOCATION (decl),
+ OPT_Wsuggest_final_methods, count,
+ "Declaring method %qD final "
+ "would enable devirtualization of %i call "
+ "executed %lli times",
+ "Declaring method %qD final "
+ "would enable devirtualization of %i calls "
+ "executed %lli times",
+ decl, count, dyn_count);
}
}