public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* GNU style checker for GDB
@ 2021-03-08 13:10 Zied Guermazi
  2021-03-08 17:35 ` Simon Marchi
  0 siblings, 1 reply; 9+ messages in thread
From: Zied Guermazi @ 2021-03-08 13:10 UTC (permalink / raw)
  To: gdb

hi,

is there a style checker that I can use to detect styles issues before 
sending patches to gdb-patches@sourceware.org?

I have the program indent installed on my machine. can it be used for 
this purpose? which options shall i use?

Kind Regards

Zied Guermazi



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

* Re: GNU style checker for GDB
  2021-03-08 13:10 GNU style checker for GDB Zied Guermazi
@ 2021-03-08 17:35 ` Simon Marchi
  2021-03-08 20:39   ` David Blaikie
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Marchi @ 2021-03-08 17:35 UTC (permalink / raw)
  To: Zied Guermazi, gdb

On 2021-03-08 8:10 a.m., Zied Guermazi wrote:
> hi,
> 
> is there a style checker that I can use to detect styles issues before sending patches to gdb-patches@sourceware.org?
> 
> I have the program indent installed on my machine. can it be used for this purpose? which options shall i use?
> 
> Kind Regards
> 
> Zied Guermazi

People try now and then to configure tools to do this, but so
unfortunately so far there is no tool/configuration that matches exactly
the style we use.  If I remember correctly, indent does not know C++, so
it's not useful here.  clang-format can get quite close, but not enough
so that we can say "just run this and it will be fine".

To be clear, I really wish there existed such a tool, it would simplify
things a lot.

Simon



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

* Re: GNU style checker for GDB
  2021-03-08 17:35 ` Simon Marchi
@ 2021-03-08 20:39   ` David Blaikie
  2021-03-08 22:31     ` Simon Marchi
  0 siblings, 1 reply; 9+ messages in thread
From: David Blaikie @ 2021-03-08 20:39 UTC (permalink / raw)
  To: Simon Marchi; +Cc: Zied Guermazi, gdb

If anyone's interested in investing some time in it, I expect clang-format
would be open to bugs/patches to support whatever formatting idioms gdb
needs.

On Mon, Mar 8, 2021 at 10:26 AM Simon Marchi via Gdb <gdb@sourceware.org>
wrote:

> On 2021-03-08 8:10 a.m., Zied Guermazi wrote:
> > hi,
> >
> > is there a style checker that I can use to detect styles issues before
> sending patches to gdb-patches@sourceware.org?
> >
> > I have the program indent installed on my machine. can it be used for
> this purpose? which options shall i use?
> >
> > Kind Regards
> >
> > Zied Guermazi
>
> People try now and then to configure tools to do this, but so
> unfortunately so far there is no tool/configuration that matches exactly
> the style we use.  If I remember correctly, indent does not know C++, so
> it's not useful here.  clang-format can get quite close, but not enough
> so that we can say "just run this and it will be fine".
>
> To be clear, I really wish there existed such a tool, it would simplify
> things a lot.
>
> Simon
>
>
>

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

* Re: GNU style checker for GDB
  2021-03-08 20:39   ` David Blaikie
@ 2021-03-08 22:31     ` Simon Marchi
  2021-03-08 22:39       ` David Blaikie
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Marchi @ 2021-03-08 22:31 UTC (permalink / raw)
  To: David Blaikie; +Cc: Zied Guermazi, gdb

On 2021-03-08 3:39 p.m., David Blaikie wrote:
> If anyone's interested in investing some time in it, I expect clang-format would be open to bugs/patches to support whatever formatting idioms gdb needs.

That's one of those things I'd really like to try, but will never have
time.  But I can at least file some bugs.

What stopped me from doing so in the past is that the missing things
were really some things I would consider like oddities / inconsistency
of our style.  For example, we use space before parenthesis, except for
the `_` (gettext) macro:

  printf (_("Hello %s\n"), name);

If we tell clang-format we want spaces before function call parenthesis,
it (rightfully) inserts a space after the `_`.  To prevent that, I
suppose we'd need a way to say: in general I want this style, but for
this macro I want this other style.  I fear I'll be called crazy if I
request that :).

Simon

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

* Re: GNU style checker for GDB
  2021-03-08 22:31     ` Simon Marchi
@ 2021-03-08 22:39       ` David Blaikie
  2021-03-08 22:53         ` Simon Marchi
  2021-03-08 23:21         ` Dave Marples
  0 siblings, 2 replies; 9+ messages in thread
From: David Blaikie @ 2021-03-08 22:39 UTC (permalink / raw)
  To: Simon Marchi; +Cc: Zied Guermazi, gdb

On Mon, Mar 8, 2021 at 2:31 PM Simon Marchi <simon.marchi@polymtl.ca> wrote:

> On 2021-03-08 3:39 p.m., David Blaikie wrote:
> > If anyone's interested in investing some time in it, I expect
> clang-format would be open to bugs/patches to support whatever formatting
> idioms gdb needs.
>
> That's one of those things I'd really like to try, but will never have
> time.  But I can at least file some bugs.
>
> What stopped me from doing so in the past is that the missing things
> were really some things I would consider like oddities / inconsistency
> of our style.  For example, we use space before parenthesis, except for
> the `_` (gettext) macro:
>
>   printf (_("Hello %s\n"), name);
>
> If we tell clang-format we want spaces before function call parenthesis,
> it (rightfully) inserts a space after the `_`.  To prevent that, I
> suppose we'd need a way to say: in general I want this style, but for
> this macro I want this other style.  I fear I'll be called crazy if I
> request that :).
>

I think if you can point to a widely used style (the gdb (& binutils more
generally?) codebase) there's probably going to be a fair bit of
sympathy/understanding there.

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

* Re: GNU style checker for GDB
  2021-03-08 22:39       ` David Blaikie
@ 2021-03-08 22:53         ` Simon Marchi
  2021-03-08 23:21         ` Dave Marples
  1 sibling, 0 replies; 9+ messages in thread
From: Simon Marchi @ 2021-03-08 22:53 UTC (permalink / raw)
  To: David Blaikie; +Cc: Zied Guermazi, gdb



On 2021-03-08 5:39 p.m., David Blaikie wrote:
> 
> 
> On Mon, Mar 8, 2021 at 2:31 PM Simon Marchi <simon.marchi@polymtl.ca <mailto:simon.marchi@polymtl.ca>> wrote:
> 
>     On 2021-03-08 3:39 p.m., David Blaikie wrote:
>     > If anyone's interested in investing some time in it, I expect clang-format would be open to bugs/patches to support whatever formatting idioms gdb needs.
> 
>     That's one of those things I'd really like to try, but will never have
>     time.  But I can at least file some bugs.
> 
>     What stopped me from doing so in the past is that the missing things
>     were really some things I would consider like oddities / inconsistency
>     of our style.  For example, we use space before parenthesis, except for
>     the `_` (gettext) macro:
> 
>       printf (_("Hello %s\n"), name);
> 
>     If we tell clang-format we want spaces before function call parenthesis,
>     it (rightfully) inserts a space after the `_`.  To prevent that, I
>     suppose we'd need a way to say: in general I want this style, but for
>     this macro I want this other style.  I fear I'll be called crazy if I
>     request that :).
> 
> 
> I think if you can point to a widely used style (the gdb (& binutils more generally?) codebase) there's probably going to be a fair bit of sympathy/understanding there. 

Ok, I will.  Worst case, the idea is shot down.

I filed a first one here:

https://bugs.llvm.org/show_bug.cgi?id=49481

Simon

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

* Re: GNU style checker for GDB
  2021-03-08 22:39       ` David Blaikie
  2021-03-08 22:53         ` Simon Marchi
@ 2021-03-08 23:21         ` Dave Marples
  2021-03-09  6:08           ` Metzger, Markus T
  1 sibling, 1 reply; 9+ messages in thread
From: Dave Marples @ 2021-03-08 23:21 UTC (permalink / raw)
  To: gdb


On 08/03/2021 22:39, David Blaikie via Gdb wrote:
>
> I think if you can point to a widely used style (the gdb (& binutils more
> generally?) codebase) there's probably going to be a fair bit of
> sympathy/understanding there.

It seems to me that this is a problem screaming out for Machine 
Learning. I see so many projects that don't have a formal style guide 
but have a "please format your code like the rest of the code is already 
formatted 'cos we like that" policy. Nothing wrong with that policy at 
all, except that it's obviously incredibly difficult to automate.

It would make a really nice final year undergrad project for someone to 
train up an AI on the style of an existing codebase, then use the 
developed knowledge to edit new code into that same format.

...anyone got any suitably smart final year students that would bite on 
a project like that? I can think of plenty of projects that could make 
use of it!

DAVE


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

* RE: GNU style checker for GDB
  2021-03-08 23:21         ` Dave Marples
@ 2021-03-09  6:08           ` Metzger, Markus T
  2021-03-10 10:32             ` Zied Guermazi
  0 siblings, 1 reply; 9+ messages in thread
From: Metzger, Markus T @ 2021-03-09  6:08 UTC (permalink / raw)
  To: Zied Guermazi; +Cc: Dave Marples, David Blaikie, gdb, Simon Marchi

There's gcc.git/contrib/check_GNU_style.sh.

Regards,
Markus.

> -----Original Message-----
> From: Gdb <gdb-bounces@sourceware.org> On Behalf Of Dave Marples
> Sent: Dienstag, 9. März 2021 00:22
> To: gdb@sourceware.org
> Subject: Re: GNU style checker for GDB
> 
> 
> On 08/03/2021 22:39, David Blaikie via Gdb wrote:
> >
> > I think if you can point to a widely used style (the gdb (& binutils more
> > generally?) codebase) there's probably going to be a fair bit of
> > sympathy/understanding there.
> 
> It seems to me that this is a problem screaming out for Machine
> Learning. I see so many projects that don't have a formal style guide
> but have a "please format your code like the rest of the code is already
> formatted 'cos we like that" policy. Nothing wrong with that policy at
> all, except that it's obviously incredibly difficult to automate.
> 
> It would make a really nice final year undergrad project for someone to
> train up an AI on the style of an existing codebase, then use the
> developed knowledge to edit new code into that same format.
> 
> ...anyone got any suitably smart final year students that would bite on
> a project like that? I can think of plenty of projects that could make
> use of it!
> 
> DAVE

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

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

* Re: GNU style checker for GDB
  2021-03-09  6:08           ` Metzger, Markus T
@ 2021-03-10 10:32             ` Zied Guermazi
  0 siblings, 0 replies; 9+ messages in thread
From: Zied Guermazi @ 2021-03-10 10:32 UTC (permalink / raw)
  To: Metzger, Markus T; +Cc: Dave Marples, David Blaikie, gdb, Simon Marchi

hi

thanks Markus, the script was helpful spotting style mismatch.

can this script be referred from 
https://sourceware.org/gdb/wiki/Internals%20Coding-Standards ?

Kind Regards

Zied Guermazi

On 09.03.21 07:08, Metzger, Markus T wrote:
> There's gcc.git/contrib/check_GNU_style.sh.
>
> Regards,
> Markus.
>
>> -----Original Message-----
>> From: Gdb <gdb-bounces@sourceware.org> On Behalf Of Dave Marples
>> Sent: Dienstag, 9. März 2021 00:22
>> To: gdb@sourceware.org
>> Subject: Re: GNU style checker for GDB
>>
>>
>> On 08/03/2021 22:39, David Blaikie via Gdb wrote:
>>> I think if you can point to a widely used style (the gdb (& binutils more
>>> generally?) codebase) there's probably going to be a fair bit of
>>> sympathy/understanding there.
>> It seems to me that this is a problem screaming out for Machine
>> Learning. I see so many projects that don't have a formal style guide
>> but have a "please format your code like the rest of the code is already
>> formatted 'cos we like that" policy. Nothing wrong with that policy at
>> all, except that it's obviously incredibly difficult to automate.
>>
>> It would make a really nice final year undergrad project for someone to
>> train up an AI on the style of an existing codebase, then use the
>> developed knowledge to edit new code into that same format.
>>
>> ...anyone got any suitably smart final year students that would bite on
>> a project like that? I can think of plenty of projects that could make
>> use of it!
>>
>> DAVE
> Intel Deutschland GmbH
> Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
> Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
> Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
> Chairperson of the Supervisory Board: Nicole Lau
> Registered Office: Munich
> Commercial Register: Amtsgericht Muenchen HRB 186928
-- 

*Zied Guermazi*
founder

Trande UG
Leuschnerstraße 2
69469 Weinheim/Germany

Mobile: +491722645127
mailto:zied.guermazi@trande.de

*Trande UG*
Leuschnerstraße 2, D-69469 Weinheim; Telefon: +491722645127
Sitz der Gesellschaft: Weinheim- Registergericht: AG Mannheim HRB 736209 
- Geschäftsführung: Zied Guermazi

*Confidentiality Note*
This message is intended only for the use of the named recipient(s) and 
may contain confidential and/or privileged information. If you are not 
the intended recipient, please contact the sender and delete the 
message. Any unauthorized use of the information contained in this 
message is prohibited.



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

end of thread, other threads:[~2021-03-10 10:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08 13:10 GNU style checker for GDB Zied Guermazi
2021-03-08 17:35 ` Simon Marchi
2021-03-08 20:39   ` David Blaikie
2021-03-08 22:31     ` Simon Marchi
2021-03-08 22:39       ` David Blaikie
2021-03-08 22:53         ` Simon Marchi
2021-03-08 23:21         ` Dave Marples
2021-03-09  6:08           ` Metzger, Markus T
2021-03-10 10:32             ` Zied Guermazi

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).