diff options
author | Lewis Hyatt <lhyatt@gmail.com> | 2022-09-30 14:10:00 -0400 |
---|---|---|
committer | Lewis Hyatt <lhyatt@gmail.com> | 2022-09-30 14:10:00 -0400 |
commit | b52b99b62df8fc9b3a3010cb0a8cf49bc35037f0 (patch) | |
tree | 68920f03ad6c037493f978e4efe36ddf5a9c628f /gcc/dwarf2out.cc | |
parent | e564021e4c225420cd8986e9a7a42efe741f92d1 (diff) | |
download | gcc-b52b99b62df8fc9b3a3010cb0a8cf49bc35037f0.zip gcc-b52b99b62df8fc9b3a3010cb0a8cf49bc35037f0.tar.gz gcc-b52b99b62df8fc9b3a3010cb0a8cf49bc35037f0.tar.bz2 |
diagnostics: Fix virtual location for -Wuninitialized [PR69543]
Warnings issued for -Wuninitialized have been using the spelling location of
the problematic usage, discarding any information on the location of the macro
expansion point if such usage was in a macro. This makes the warnings
impossible to control reliably with #pragma GCC diagnostic, and also discards
useful context in the diagnostic output. There seems to be no need to discard
the virtual location information, so this patch fixes that.
PR69543 was mostly about _Pragma issues which have been fixed for many years
now. The PR remains open because two of the testcases added in response to it
still have xfails, but those xfails have nothing to do with _Pragma and rather
just with the issue fixed by this patch, so the PR can be closed now as well.
The other testcase modified here, pragma-diagnostic-2.c, was explicitly
testing for the undesirable behavior that was xfailed in pr69543-3.c. I have
adjusted that and also added a new testcase verifying all 3 types of warning
that come from tree-ssa-uninit.cc get the proper location information now.
gcc/ChangeLog:
PR preprocessor/69543
* tree-ssa-uninit.cc (warn_uninit): Stop stripping macro tracking
information away from the diagnostic location.
(maybe_warn_read_write_only): Likewise.
(maybe_warn_operand): Likewise.
gcc/testsuite/ChangeLog:
PR preprocessor/69543
* c-c++-common/pr69543-3.c: Remove xfail.
* c-c++-common/pr69543-4.c: Likewise.
* gcc.dg/cpp/pragma-diagnostic-2.c: Adjust test for new behavior.
* c-c++-common/pragma-diag-16.c: New test.
Diffstat (limited to 'gcc/dwarf2out.cc')
0 files changed, 0 insertions, 0 deletions