bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6617: linux kernel C style (fwd)


From: Dan Nicolaescu
Subject: bug#6617: linux kernel C style (fwd)
Date: Tue, 13 Jul 2010 04:51:17 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Dimitrios Apostolou <jimis@gmx.net> writes:

> Hi, I sent the following to help-gnu-emacs and got no reply, maybe
> this list is more relevant.
>
> ---------- Forwarded message ----------
> Date: Thu, 8 Jul 2010 21:56:09 +0300 (EEST)
> From: Dimitrios Apostolou <jimis@gmx.net>
> To: help-gnu-emacs@gnu.org
> Subject: linux kernel C style
>
> Hello list,
>
> is the "linux" c-style supposed to be compliant to the linux kernel
> style guidelines? I just realised that all this time emacs was
> indenting my code slightly wrong, specifically the use of spaces is
> forbidden, even when continuing the argument list of a function.

Is that really the case?  Is this requirement documented anywhere?
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)
{ 
[snip]

The arguments starting from sd_shares are indented using a few tabs
followed by a few spaces.
The above is not the only occurrence, there are many others in the same file.


Another point: to enforce the use of the correct style, a file called
.dir-locals.el should be placed at the top level of the kernel tree
with the following [completely untested] contents:

((c-mode . ((c-file-style . "linux")
            (tab-width . 8)
            (indent-tabs-mode . t))))

With this users of emacs-23+ will get the correct settings for editing
the kernel by default.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]