On 21 Jul, David Malcolm wrote: > On Fri, 2017-07-21 at 19:58 +0200, Volker Reichelt wrote: >> On 21 Jul, David Malcolm wrote: >> > On Thu, 2017-07-20 at 18:35 +0200, Volker Reichelt wrote: >> >> Hi, >> >> >> >> the following patch introduces a new C++ warning option >> >> -Wduplicated-access-specifiers that warns about redundant >> >> access-specifiers in classes, e.g. >> >> >> >> class B >> >> { >> >> public: >> >> B(); >> >> >> >> private: >> >> void foo(); >> >> private: >> >> int i; >> >> }; >> >> >> >> test.cc:8:5: warning: duplicate 'private' access-specifier [ >> >> -Wduplicated-access-specifiers] >> >> private: >> >> ^~~~~~~ >> >> ------- >> >> test.cc:6:5: note: access-specifier was previously given here >> >> private: >> >> ^~~~~~~
{...snip...] >> > If you're going to implement a fix-it hint for this, there should >> be a >> > test case that tests it (probably as a separate file, e.g. >> Wduplicated >> > -access-specifiers-2.C, to allow for the extra option - >> -fdiagnostics >> > -show-caret, covering just one instance of the diagnostic firing, >> for >> > simplicity). >> >> I actually did try that, but dejagnu somehow gets confused. >> To me it looks like the reason for this is that both multi-line >> messages >> are so similar. I'll give it a second try, though. > > I'm not sure what you mean by "both" multi-line messages; shouldn't > there be just one multi-line message for the fix-it hint. > > Isn't this like e.g. g++.dg/cpp0x/auto1.C ? (an example of a testcase > that verifies a deletion fix-it hint) > > Dave There are two multi-line messages. One for the warning and one for the note, see the example above the "[...snip...]". The message after the note consists of the first two lines of the message after the warning. This seems to confuse dejagnu. However, I managed to work around this problem. I'll post an updated patch soon. Regards, Volker