public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* [question] If the code format is wrong, the _initialize_xxx functions cannot be generated?
@ 2023-01-30  2:15 hilbert
  2023-01-30  3:03 ` Simon Marchi
  0 siblings, 1 reply; 9+ messages in thread
From: hilbert @ 2023-01-30  2:15 UTC (permalink / raw)
  To: gdb

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

Hi,


Does newly added code need a fixed code format. I registered a new target.
But if I use the command "clang-format -style=LLVM -i newtarget.c" to reformat the code, and then compile it, the _initialize_new_target() function will not be generated in init.c;
 if I use the original code format, gdb The _initialize_new_target() function is generated. 
Is this understanding correct?
Thank you very much.




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

* Re: [question] If the code format is wrong, the _initialize_xxx functions cannot be generated?
  2023-01-30  2:15 [question] If the code format is wrong, the _initialize_xxx functions cannot be generated? hilbert
@ 2023-01-30  3:03 ` Simon Marchi
  2023-01-30  8:30   ` hilbert
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Marchi @ 2023-01-30  3:03 UTC (permalink / raw)
  To: hilbert, gdb



On 1/29/23 21:15, hilbert via Gdb wrote:
> Hi,
> 
> 
> Does newly added code need a fixed code format. I registered a new target.
> But if I use the command "clang-format -style=LLVM -i newtarget.c" to reformat the code, and then compile it, the _initialize_new_target() function will not be generated in init.c;
>  if I use the original code format, gdb The _initialize_new_target() function is generated. 
> Is this understanding correct?
> Thank you very much.

Yes, the function name in the definition needs to be at column 0 (like
the GNU coding style prescribes).  Otherwise, the script
(gdb/make-init-c) will not find it.

Simon

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

* Re:Re: [question] If the code format is wrong, the _initialize_xxx functions cannot be generated?
  2023-01-30  3:03 ` Simon Marchi
@ 2023-01-30  8:30   ` hilbert
  2023-01-31  1:28     ` Simon Marchi
  0 siblings, 1 reply; 9+ messages in thread
From: hilbert @ 2023-01-30  8:30 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb

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



Sorry, I have another question;
Mt clang-format tool version does not seem to match, it does not recognize the .clang-fromat script;
 where can I find the clang-format version required by gdb?


Thanks.







At 2023-01-30 11:03:07, "Simon Marchi" <simark@simark.ca> wrote:
>
>
>On 1/29/23 21:15, hilbert via Gdb wrote:
>> Hi,
>> 
>> 
>> Does newly added code need a fixed code format. I registered a new target.
>> But if I use the command "clang-format -style=LLVM -i newtarget.c" to reformat the code, and then compile it, the _initialize_new_target() function will not be generated in init.c;
>>  if I use the original code format, gdb The _initialize_new_target() function is generated. 
>> Is this understanding correct?
>> Thank you very much.
>
>Yes, the function name in the definition needs to be at column 0 (like
>the GNU coding style prescribes).  Otherwise, the script
>(gdb/make-init-c) will not find it.
>
>Simon

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

* Re: [question] If the code format is wrong, the _initialize_xxx functions cannot be generated?
  2023-01-30  8:30   ` hilbert
@ 2023-01-31  1:28     ` Simon Marchi
  2023-01-31  1:58       ` hilbert
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Marchi @ 2023-01-31  1:28 UTC (permalink / raw)
  To: hilbert; +Cc: gdb



On 1/30/23 03:30, hilbert via Gdb wrote:
> 
> 
> Sorry, I have another question;
> Mt clang-format tool version does not seem to match, it does not recognize the .clang-fromat script;
>  where can I find the clang-format version required by gdb?
> 
> 
> Thanks.

Where did you see a .clang-format file?

Simon

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

* Re:Re: [question] If the code format is wrong, the _initialize_xxx functions cannot be generated?
  2023-01-31  1:28     ` Simon Marchi
@ 2023-01-31  1:58       ` hilbert
  2023-01-31  2:01         ` Simon Marchi
  0 siblings, 1 reply; 9+ messages in thread
From: hilbert @ 2023-01-31  1:58 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb

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

Sorry, it was my mistake.

I downloaded a custom cudagdb project which has .clang-format file inside.
 So, which formatting tool do you need to use for the original GNU-GDB project?

















At 2023-01-31 09:28:41, "Simon Marchi" <simark@simark.ca> wrote:
>
>
>On 1/30/23 03:30, hilbert via Gdb wrote:
>> 
>> 
>> Sorry, I have another question;
>> Mt clang-format tool version does not seem to match, it does not recognize the .clang-fromat script;
>>  where can I find the clang-format version required by gdb?
>> 
>> 
>> Thanks.
>
>Where did you see a .clang-format file?
>
>Simon

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

* Re: [question] If the code format is wrong, the _initialize_xxx functions cannot be generated?
  2023-01-31  1:58       ` hilbert
@ 2023-01-31  2:01         ` Simon Marchi
  2023-01-31  2:10           ` Joel Sherrill
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Marchi @ 2023-01-31  2:01 UTC (permalink / raw)
  To: hilbert; +Cc: gdb



On 1/30/23 20:58, hilbert via Gdb wrote:
> Sorry, it was my mistake.
> 
> I downloaded a custom cudagdb project which has .clang-format file inside.
>  So, which formatting tool do you need to use for the original GNU-GDB project?

There is none, we format the code by hand.

Many of us wish we could use a tool such as clang-format, but
unfortunately it's not configurable enough (despite its many
configuration options) to match our formatting and its many quirks.

Simon

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

* Re: [question] If the code format is wrong, the _initialize_xxx functions cannot be generated?
  2023-01-31  2:01         ` Simon Marchi
@ 2023-01-31  2:10           ` Joel Sherrill
  2023-01-31  3:31             ` hilbert
  2023-02-08 19:58             ` Tom Tromey
  0 siblings, 2 replies; 9+ messages in thread
From: Joel Sherrill @ 2023-01-31  2:10 UTC (permalink / raw)
  To: Simon Marchi; +Cc: hilbert, Eli Zaretskii via Gdb

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

On Mon, Jan 30, 2023, 8:01 PM Simon Marchi via Gdb <gdb@sourceware.org>
wrote:

>
>
> On 1/30/23 20:58, hilbert via Gdb wrote:
> > Sorry, it was my mistake.
> >
> > I downloaded a custom cudagdb project which has .clang-format file
> inside.
> >  So, which formatting tool do you need to use for the original GNU-GDB
> project?
>
> There is none, we format the code by hand.
>
> Many of us wish we could use a tool such as clang-format, but
> unfortunately it's not configurable enough (despite its many
> configuration options) to match our formatting and its many quirks.
>

FWIW RTEMS also has its own formatting quirks and clang-format appears to
be within one option for us now. One of our core folks was considering
addressing that one.

They get better and better so worth looking periodically.

--joel

>
> Simon
>

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

* Re:Re: [question] If the code format is wrong, the _initialize_xxx functions cannot be generated?
  2023-01-31  2:10           ` Joel Sherrill
@ 2023-01-31  3:31             ` hilbert
  2023-02-08 19:58             ` Tom Tromey
  1 sibling, 0 replies; 9+ messages in thread
From: hilbert @ 2023-01-31  3:31 UTC (permalink / raw)
  To: joel; +Cc: Simon Marchi, Eli Zaretskii via Gdb

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

Got it .
Thank you very much.










在 2023-01-31 10:10:27,"Joel Sherrill" <joel@rtems.org> 写道:




On Mon, Jan 30, 2023, 8:01 PM Simon Marchi via Gdb <gdb@sourceware.org> wrote:



On 1/30/23 20:58, hilbert via Gdb wrote:
> Sorry, it was my mistake.
>
> I downloaded a custom cudagdb project which has .clang-format file inside.
>  So, which formatting tool do you need to use for the original GNU-GDB project?

There is none, we format the code by hand.

Many of us wish we could use a tool such as clang-format, but
unfortunately it's not configurable enough (despite its many
configuration options) to match our formatting and its many quirks.



FWIW RTEMS also has its own formatting quirks and clang-format appears to be within one option for us now. One of our core folks was considering addressing that one.


They get better and better so worth looking periodically.


--joel 

Simon

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

* Re: [question] If the code format is wrong, the _initialize_xxx functions cannot be generated?
  2023-01-31  2:10           ` Joel Sherrill
  2023-01-31  3:31             ` hilbert
@ 2023-02-08 19:58             ` Tom Tromey
  1 sibling, 0 replies; 9+ messages in thread
From: Tom Tromey @ 2023-02-08 19:58 UTC (permalink / raw)
  To: Joel Sherrill; +Cc: Simon Marchi, hilbert, Eli Zaretskii via Gdb

Joel> FWIW RTEMS also has its own formatting quirks and clang-format appears to
Joel> be within one option for us now. One of our core folks was considering
Joel> addressing that one.

Joel> They get better and better so worth looking periodically.

I try periodically for gdb.  Today I updated to clang-format 14, went
through all the options, and tried again.

I don't really understand what I'm doing, though, so it's not completely
clear the results are definitive.  But anyway, my experience has been
pretty negative.  There are a lot of minor differences that I don't
really care about, but the way bin-packing works for function arguments
leaves some calls unreadable to me.

I filed https://sourceware.org/bugzilla/show_bug.cgi?id=30098 to track
our progress here.

Tom

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

end of thread, other threads:[~2023-02-08 19:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-30  2:15 [question] If the code format is wrong, the _initialize_xxx functions cannot be generated? hilbert
2023-01-30  3:03 ` Simon Marchi
2023-01-30  8:30   ` hilbert
2023-01-31  1:28     ` Simon Marchi
2023-01-31  1:58       ` hilbert
2023-01-31  2:01         ` Simon Marchi
2023-01-31  2:10           ` Joel Sherrill
2023-01-31  3:31             ` hilbert
2023-02-08 19:58             ` Tom Tromey

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