public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* How to format code in GCC style?
@ 2024-04-30  5:52 Hanke Zhang
  2024-04-30 10:00 ` Filip Kastl
  0 siblings, 1 reply; 4+ messages in thread
From: Hanke Zhang @ 2024-04-30  5:52 UTC (permalink / raw)
  To: GCC Development

Hi
I'm trying to format my code in GCC style.

But I don't know how to finish it. I try `indent` and
`check_GNU_style.sh` in the `contrib` directory. But none of them seem
to work well.

So I wondered is there any official tools to do that?

Thanks
Hanke Zhang

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

* Re: How to format code in GCC style?
  2024-04-30  5:52 How to format code in GCC style? Hanke Zhang
@ 2024-04-30 10:00 ` Filip Kastl
  2024-05-01  2:25   ` Hanke Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: Filip Kastl @ 2024-04-30 10:00 UTC (permalink / raw)
  To: Hanke Zhang; +Cc: GCC Development

On Tue 2024-04-30 13:52:16, Hanke Zhang via Gcc wrote:
> Hi
> I'm trying to format my code in GCC style.
> 
> But I don't know how to finish it. I try `indent` and
> `check_GNU_style.sh` in the `contrib` directory. But none of them seem
> to work well.
> 
> So I wondered is there any official tools to do that?
> 
> Thanks
> Hanke Zhang

Hi Hanke,

Not sure if this will help you but this is what I use: While writing code in
GCC style, I use the vim options listed here:

https://gcc.gnu.org/wiki/FormattingCodeForGCC

Then, before I submit a patch I run it through check_GNU_style.sh.  This works
fine for me.

Cheers,
Filip Kastl

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

* Re: How to format code in GCC style?
  2024-04-30 10:00 ` Filip Kastl
@ 2024-05-01  2:25   ` Hanke Zhang
  2024-05-01 10:09     ` Marc
  0 siblings, 1 reply; 4+ messages in thread
From: Hanke Zhang @ 2024-05-01  2:25 UTC (permalink / raw)
  To: Filip Kastl; +Cc: GCC Development

Hi Filip,

Thanks for your reply. But I'm not so familiar with VIM actually. Thus
when I try the options listed there, nothing happened. (VSCODE is the
IDE I'm using for development.)

And I notice that there is a `vimrc` in the `contrib` directory, I
tried it too, but sadly, it didn't work for me.

Maybe I configured vim in some wrong way.

Thanks
Hanke Zhang

Filip Kastl <fkastl@suse.cz> 于2024年4月30日周二 18:00写道:
>
> On Tue 2024-04-30 13:52:16, Hanke Zhang via Gcc wrote:
> > Hi
> > I'm trying to format my code in GCC style.
> >
> > But I don't know how to finish it. I try `indent` and
> > `check_GNU_style.sh` in the `contrib` directory. But none of them seem
> > to work well.
> >
> > So I wondered is there any official tools to do that?
> >
> > Thanks
> > Hanke Zhang
>
> Hi Hanke,
>
> Not sure if this will help you but this is what I use: While writing code in
> GCC style, I use the vim options listed here:
>
> https://gcc.gnu.org/wiki/FormattingCodeForGCC
>
> Then, before I submit a patch I run it through check_GNU_style.sh.  This works
> fine for me.
>
> Cheers,
> Filip Kastl

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

* Re: How to format code in GCC style?
  2024-05-01  2:25   ` Hanke Zhang
@ 2024-05-01 10:09     ` Marc
  0 siblings, 0 replies; 4+ messages in thread
From: Marc @ 2024-05-01 10:09 UTC (permalink / raw)
  To: gcc; +Cc: Filip Kastl, Hanke Zhang

Hanke Zhang via Gcc <gcc@gcc.gnu.org> writes:

> Hi Filip,
>
> Thanks for your reply. But I'm not so familiar with VIM actually. Thus
> when I try the options listed there, nothing happened. (VSCODE is the
> IDE I'm using for development.)
>
> And I notice that there is a `vimrc` in the `contrib` directory, I
> tried it too, but sadly, it didn't work for me.
>
> Maybe I configured vim in some wrong way.

Hello,

there's also a clang-format config file in contrib/clang-format. We're
using this for gcc-rs.

Marc

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

end of thread, other threads:[~2024-05-01 10:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-30  5:52 How to format code in GCC style? Hanke Zhang
2024-04-30 10:00 ` Filip Kastl
2024-05-01  2:25   ` Hanke Zhang
2024-05-01 10:09     ` Marc

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