aboutsummaryrefslogtreecommitdiff
path: root/gcc/range-op-float.cc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2023-03-30 09:34:12 +0200
committerJakub Jelinek <jakub@redhat.com>2023-03-30 09:34:12 +0200
commitee6ae8cb4793041590b479346433ed786a86985d (patch)
tree6d5a5f67283834fd69fce18ac4e092e04b6ae164 /gcc/range-op-float.cc
parenta7df3bea9cf1e42d44ec02b548fc43dd214eda79 (diff)
downloadgcc-ee6ae8cb4793041590b479346433ed786a86985d.zip
gcc-ee6ae8cb4793041590b479346433ed786a86985d.tar.gz
gcc-ee6ae8cb4793041590b479346433ed786a86985d.tar.bz2
c++: Avoid informs without a warning [PR109278]
On the following testcase we emit notes in maybe_inform_about_fndecl_for_bogus_argument_init despite no warning/error being printed before it. This is for the extended floating point type conversions where pedwarn is used, and complained is used there for 2 different purposes, one is whether an unspecific error should be emitted if we haven't complained otherwise, and one whether maybe_inform_about_fndecl_for_bogus_argument_init should be called. For the 2 pedwarns, currently it sets complained to true regardless of whether pedwarn succeeded, which results in the undesirable notes printed with -w. If complained is initialized to result of pedwarn, we would emit an error later on. So, the following patch makes complained a tristate, the additional error isn't printed if complained != 0, and maybe_inform_about_fndecl_for_bogus_argument_init is called only if complained == 1, so if pedwarn returns false, we can use complained = -1 to tell later code not to emit an error and not to call maybe_inform_about_fndecl_for_bogus_argument_init. 2023-03-30 Jakub Jelinek <jakub@redhat.com> PR c++/109278 * call.cc (convert_like_internal): If pedwarn for extended float type conversions doesn't report anything, avoid calling maybe_inform_about_fndecl_for_bogus_argument_init. * g++.dg/cpp23/ext-floating15.C: New test.
Diffstat (limited to 'gcc/range-op-float.cc')
0 files changed, 0 insertions, 0 deletions