Commit Graph

15 Commits

Author SHA1 Message Date
Christian Brauner
cf0fd972be
autotools: add -Wimplicit-fallthrough
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-21 15:24:14 +02:00
Tobin C. Harding
7419c83f44 CODING_STYLE: Update section header format
Currently for section headings we use fourth level markdown heading
level (####).  We do not have levels two or three.

We can use standard incremental levels for heading adornments i.e

1) =========
2) ##
3) ###
ect.

Since this document is likely referenced by maintainers when guiding new
contributors it can save maintainer time to be able to quickly reference
a section in the coding stlye guide.  If we add numbers to each heading
(like the kernel stlye guide) then maintainers can say:

   Nice patch, please see section 3 of the coding style guide and ...

So, this patch makes two changes

- Use incremental level heading adornments
- Add a number to each section heading

Signed-off-by: Tobin C. Harding <me@tobin.cc>
2018-08-17 14:54:35 +10:00
Tobin C. Harding
efcb7f361b CODING_STYLE: Fix non-uniform heading level
Heading uses only 3 level header (###) but the rest of the file uses
four (####).  We should be uniform.

Use uniform heading level in line with the rest of the file.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
2018-08-17 14:37:15 +10:00
Tobin C. Harding
524440e920 CODING_STLYE: Remove sections implied by 'kernel style'
We explicitly state that LXC uses coding style based on Linux kernel
style.  It is redundant to then document obvious, and well known, kernel
style rules.  Identifier names certainly fall into this category as does
usage of braces.

Remove sections implied by 'kernel style'.  Naming conventions and brace
placement conventions.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
2018-08-17 14:37:15 +10:00
Tobin C. Harding
39a1e1fa19 CODING_STLYE: Simplify explanation for use of 'extern'
Current explanation of rules around usage of 'extern' are overly
verbose.  It is not necessary to state that functions should be declared
in header files, the compiler already enforces this.  These rules are
simple, they are better described with simple statements.  An example is
not necessary for such simple rules and serves only to make the document
longer.

Use two simple statements describing the rules that govern function
declaration and the usage of the 'extern' keyword.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
2018-08-17 14:37:13 +10:00
Tobin C. Harding
183d7fa5ce CODING_STYLE: Mention kernel style in introduction
Currently the coding style guide does not mention that we use kernel
coding style as a base style for LXC.  We have just linked to
CODING_STLYE.md from CONTRIBUTING (which mentions use of kernel coding
style).  We can increase documentation congruence and completeness by
mentioning kernel coding style guide in the introduction to our style
guide.

Add heading and introduction to coding style guide informing readers
that we follow kernel coding style as a base before explaining our style
additions.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
2018-08-17 14:36:30 +10:00
Christian Brauner
77f6262f61
CODING_STYLE: add section about using strlcat()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-07-01 20:00:15 +02:00
Christian Brauner
a3759c1b25
CODING_STYLE: add section about using strlcpy()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-05-11 13:32:01 +02:00
Christian Brauner
b0c407f7d2
CODING_STYLE: add languages to highlight
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-03-02 12:57:18 +01:00
Christian Brauner
b629739c34
CODING_STYLE: arrays of structs
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-03-02 12:54:58 +01:00
Christian Brauner
c67cb61950
CODING_STYLE: clang-format
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-03-02 12:54:58 +01:00
Christian Brauner
0c9119fc1f
CODING_STYLE: remove duplicate _exit() entry
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-03-02 12:18:38 +01:00
Christian Brauner
4ad78f87c7
CODING_STYLE: add section about _exit()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-26 11:21:51 +01:00
Christian Brauner
ed06b69ce6
CODING_STYLE: add section for str{n}cmp()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-16 16:02:08 +01:00
Christian Brauner
4a308d6693
CODING_STYLE: add CODING_STYLE.md
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-14 19:58:05 +01:00