public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [GSoC] Discussion of warnings and of a first patch (name-hiding)
@ 2023-03-22 22:49 Benjamin Priour
  2023-03-28 21:31 ` Martin Jambor
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Priour @ 2023-03-22 22:49 UTC (permalink / raw)
  To: Jason Merrill; +Cc: David Malcolm, gcc

[-- Attachment #1: Type: text/plain, Size: 2169 bytes --]

Hi Jason,

Sorry for the delayed answer, I was in my exam period!

I've almost finished the patch (PR12341
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12341>), and wrote a testcase
to compare it against.
In it I use dejaGNU instructions of the format:
 /* { dg-warning "'C::bbb' might shadow 'B::bbb'." "" { target *-*-* }
C_shadowing_bbb } */
and run the test with:
make check-gcc-c++ RUNTESTFLAGS="-v -v --target_board=unix\{-m32,-m64\}
dg.exp=pr12341-1.C"
I get expected results on most target, except on target hppa*-*-hpux*.
I have been looking around the documentation, yet I cannot find a way to
run on that target specifically, especially considering the wildcards. How
to test GCC on a simulator <https://gcc.gnu.org/simtest-howto.html> don't
specify that target in the bottom table.
Would you have any guidance on how to do so ? I would like to debug the
test on that platform.

Otherwise, I believe it is working just fine, I put it as an enhancement to
-Wshadow. Should I send it to gcc-patches ? I wasn't sure I was supposed to
since it's still buggy, so I preferred to refrain.


>   Up to now I have considered some extra warning

> 1- Warning for NULL smart pointers dereferencing. E.g. when a smart
> > pointer is left uninitialized yet is derefe0renced.
>
> I would expect that to be covered by (enhancements to?) the existing
> -Wuninitialized or -Wmaybe-uninitialized or
> -Wanalyzer-use-of-uninitialized-value.
>

> > 3- Use after move.
>
> Hmm, it might make sense to approach this as an enhancement to the
> uninitialized warnings whereby a move makes us consider the object no
> longer initialized, much like -Wuse-after-free and
> -Wanalyzer-use-after-free.
>
> > 4- Use references or raw pointers as parameters when ownership is not
> > considered. (For general use, take T* or T& arguments rather than smart
> > pointers
> > <
> https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#f7-for-general-use-take-t-or-t-arguments-rather-than-smart-pointers
> >)
>
> This seems feasible to implement in the front-end.
>
>
I will update on these warnings and a few questions on the analyzer
tomorrow, I now got some free time back.
Benjamin

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [GSoC] Discussion of warnings and of a first patch (name-hiding)
  2023-03-22 22:49 [GSoC] Discussion of warnings and of a first patch (name-hiding) Benjamin Priour
@ 2023-03-28 21:31 ` Martin Jambor
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Jambor @ 2023-03-28 21:31 UTC (permalink / raw)
  To: Benjamin Priour; +Cc: David Malcolm, gcc, Jason Merrill

Hello,

it feels like I have read only a small part of your conversation and so
may be missing quite some context, but...


On Wed, Mar 22 2023, Benjamin Priour via Gcc wrote:
> Hi Jason,
>
> Sorry for the delayed answer, I was in my exam period!
>
> I've almost finished the patch (PR12341
> <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12341>), and wrote a testcase
> to compare it against.
> In it I use dejaGNU instructions of the format:
>  /* { dg-warning "'C::bbb' might shadow 'B::bbb'." "" { target *-*-* }
> C_shadowing_bbb } */
> and run the test with:
> make check-gcc-c++ RUNTESTFLAGS="-v -v --target_board=unix\{-m32,-m64\}
> dg.exp=pr12341-1.C"
> I get expected results on most target, except on target hppa*-*-hpux*.

...don't worry about hppa or hpux at this point and...

> I have been looking around the documentation, yet I cannot find a way to
> run on that target specifically, especially considering the wildcards. How
> to test GCC on a simulator <https://gcc.gnu.org/simtest-howto.html> don't
> specify that target in the bottom table.
> Would you have any guidance on how to do so ? I would like to debug the
> test on that platform.
>
> Otherwise, I believe it is working just fine, I put it as an enhancement to
> -Wshadow. Should I send it to gcc-patches ? I wasn't sure I was supposed to
> since it's still buggy, so I preferred to refrain.

...yes, if you would like to get feedback, send it to gcc-patches.
Prefix the subject with "[RFC]" if you want to point out that you are
looking for feedback and not an approval to commit.  Spell out any known
issues.  It is a good idea to CC some maintainer of the gcc component
you modify, so Jason in this case.

Thanks for your perseverance, I know it is not easy,

Martin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-28 21:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22 22:49 [GSoC] Discussion of warnings and of a first patch (name-hiding) Benjamin Priour
2023-03-28 21:31 ` Martin Jambor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).