diff options
| author | Evan Travers <evantravers@gmail.com> | 2018-07-14 16:49:07 -0500 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2018-07-15 13:21:20 -0400 |
| commit | c5c112ae2927d2d026de16cc4cdfd692bb6e7ab9 (patch) | |
| tree | 1cd988114abeb936dea7d188863b1db87fb30bc6 | |
| parent | 3d7bfae2323f64778b1e9c6b402c84befaa30301 (diff) | |
| download | qmk_firmware-c5c112ae2927d2d026de16cc4cdfd692bb6e7ab9.tar.gz qmk_firmware-c5c112ae2927d2d026de16cc4cdfd692bb6e7ab9.zip | |
Update config.h boilerplate to use `#pragma once`
According to @fredizzimo, this is a safer and easier way to handle the
boilerplate.
| -rw-r--r-- | docs/getting_started_introduction.md | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/docs/getting_started_introduction.md b/docs/getting_started_introduction.md index 82a1ca19a..3b6a488ed 100644 --- a/docs/getting_started_introduction.md +++ b/docs/getting_started_introduction.md | |||
| @@ -35,15 +35,10 @@ There are 3 possible `config.h` locations: | |||
| 35 | * userspace (`/users/<user>/config.h`) | 35 | * userspace (`/users/<user>/config.h`) |
| 36 | * keymap (`/keyboards/<keyboard>/keymaps/<keymap>/config.h`) | 36 | * keymap (`/keyboards/<keyboard>/keymaps/<keymap>/config.h`) |
| 37 | 37 | ||
| 38 | The build system automatically picks up the config files in the above order. If you wish to override any setting set by a previous `config.h` you will need to first include some boilerplate code around the settings you wish to change. | 38 | The build system automatically picks up the config files in the above order. If you wish to override any setting set by a previous `config.h` you will need to first include some boilerplate code for the settings you wish to change. |
| 39 | 39 | ||
| 40 | ``` | 40 | ``` |
| 41 | #ifndef CONFIG_USER_H | 41 | #pragma once |
| 42 | #define CONFIG_USER_H | ||
| 43 | |||
| 44 | // overrides go here! | ||
| 45 | |||
| 46 | #endif | ||
| 47 | ``` | 42 | ``` |
| 48 | 43 | ||
| 49 | Then to override a setting from the previous `config.h` file you must `#undef` and then `#define` the setting again. | 44 | Then to override a setting from the previous `config.h` file you must `#undef` and then `#define` the setting again. |
| @@ -51,12 +46,9 @@ Then to override a setting from the previous `config.h` file you must `#undef` a | |||
| 51 | The boilerplate code and setting look like this together: | 46 | The boilerplate code and setting look like this together: |
| 52 | 47 | ||
| 53 | ``` | 48 | ``` |
| 54 | #ifndef CONFIG_USER_H | 49 | #pragma once |
| 55 | #define CONFIG_USER_H | ||
| 56 | 50 | ||
| 57 | // overrides go here! | 51 | // overrides go here! |
| 58 | #undef MY_SETTING | 52 | #undef MY_SETTING |
| 59 | #define MY_SETTING 4 | 53 | #define MY_SETTING 4 |
| 60 | |||
| 61 | #endif | ||
| 62 | ``` | 54 | ``` |
