]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Update config.h boilerplate to use `#pragma once`
authorEvan Travers <evantravers@gmail.com>
Sat, 14 Jul 2018 21:49:07 +0000 (16:49 -0500)
committerJack Humbert <jack.humb@gmail.com>
Sun, 15 Jul 2018 17:21:20 +0000 (13:21 -0400)
According to @fredizzimo, this is a safer and easier way to handle the
boilerplate.

docs/getting_started_introduction.md

index 82a1ca19ae0c9b3b5e88d687590aac0b90db5bf7..3b6a488ed603f19b32480b966dcd940d2a6bd766 100644 (file)
@@ -35,15 +35,10 @@ There are 3 possible `config.h` locations:
 * userspace (`/users/<user>/config.h`)
 * keymap (`/keyboards/<keyboard>/keymaps/<keymap>/config.h`)
 
-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.
+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.
 
 ```
-#ifndef CONFIG_USER_H
-#define CONFIG_USER_H
-
-// overrides go here!
-
-#endif
+#pragma once
 ```
 
 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
 The boilerplate code and setting look like this together:
 
 ```
-#ifndef CONFIG_USER_H
-#define CONFIG_USER_H
+#pragma once
 
 // overrides go here!
 #undef MY_SETTING
 #define MY_SETTING 4
-
-#endif
 ```