GNU bug report logs -
#6617
linux kernel C style (fwd)
Previous Next
Full log
View this message in rfc822 format
Hello,
On Wed 08 Sep 2021 at 10:40AM +02, Lars Ingebrigtsen wrote:
> Dan Nicolaescu <dann <at> gnu.org> writes:
>
>> Statements longer than 80 columns will be broken into sensible
>> chunks. Descendants are always substantially shorter than the parent
>> and are placed substantially to the right. The same applies to
>> function headers with a long argument list. Long strings are as well
>> broken into shorter strings. The only exception to this is where
>> exceeding 80 columns significantly increases readability and does not
>> hide information.
>>
>> It is then followed by an example which is is indented only with tabs.
>>
>>> Looking at a random file in the linux-2.6.34.1 kernel:
>>> kernel/sched.c one can see:
>>>
>>> static void update_group_shares_cpu(struct task_group *tg, int cpu,
>>> unsigned long sd_shares,
>>> unsigned long sd_rq_weight,
>>> unsigned long *usd_rq_weight)
>>> {
>
> (I'm going through old bug reports that unfortunately weren't resolved
> at the time.)
>
> It still seems to be the case that the "linux" style indents using both
> tabs and spaces in Emacs 28. I don't know what the Linux kernel style
> is these days, but the suggestion in this bug report is to add a
> tab-only variant. Alan, do you have any comments about this?
The Linux kernel style is tabs only. I think that Emacs DTRT if
indent-tabs-mode is t. So, currently I have this fix in my init file:
(c-add-style "linux-tabs" '("linux" (indent-tabs-mode . t)))
(setq c-default-style "linux-tabs")
--
Sean Whitton
This bug report was last modified 3 years and 103 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.