Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
NetworkManager
NetworkManager
Commits
27427bad
Verified
Commit
27427bad
authored
Aug 26, 2021
by
Thomas Haller
Browse files
CONTRIBUTING: explain order of includes of header files
parent
83ee8bd8
Pipeline
#389068
passed with stages
in 62 minutes and 3 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CONTRIBUTING.md
View file @
27427bad
...
...
@@ -264,6 +264,35 @@ source code and navigate it. These tools can integrate with editors like `Vim` a
Miscellaneous
---------------------------
### Header Includes
Almost all C source header should include a certain set of default headers.
That comes from the fact, that (almost) all source should include autotools'
`"config.h"`
as first.
That means, (almost) all our C sources should start with
```
C
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "$BASE/nm-default$EXTRA.h"
```
that is, the first header is one of the several
`"*/nm-default*.h"`
headers.
This header ensure that certain headers like
[
`libnm-std-aux/nm-std-aux.h`
](
src/libnm-std-aux/nm-std-aux.h
)
and basics like
`nm_assert()`
and
`nm_auto_g_free`
are available everywhere.
The second include is the header that belongs to the C source file. This
is so that header files are self-contained (aside what default dependencies that
they get and everybody can rely on).
The next includes are system headers with
`<>`
.
Finally, all other headers from our source tree. Note that all build targets
have
`-I. -I./src/`
in their build arguments. So to include a header like
[
`src/libnm-glib-aux/nm-random-utils.h`
](
src/libnm-glib-aux/nm-random-utils.h
)
you'd do
`#include "libnm-glib-aux/nm-random-utils.h"`
.
See an example
[
here
](
src/core/nm-manager.c#L1
)
.
### GObject Properties
We use GObjects and GObject Properties in various cases. For example:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment