1
0
Fork 0

Update config.h boilerplate to use #pragma once

According to @fredizzimo, this is a safer and easier way to handle the
boilerplate.
This commit is contained in:
Evan Travers 2018-07-14 16:49:07 -05:00 committed by Jack Humbert
parent 3d7bfae232
commit c5c112ae29

View file

@ -35,15 +35,10 @@ There are 3 possible `config.h` locations:
* userspace (`/users/<user>/config.h`) * userspace (`/users/<user>/config.h`)
* keymap (`/keyboards/<keyboard>/keymaps/<keymap>/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 #pragma once
#define CONFIG_USER_H
// overrides go here!
#endif
``` ```
Then to override a setting from the previous `config.h` file you must `#undef` and then `#define` the setting again. 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: The boilerplate code and setting look like this together:
``` ```
#ifndef CONFIG_USER_H #pragma once
#define CONFIG_USER_H
// overrides go here! // overrides go here!
#undef MY_SETTING #undef MY_SETTING
#define MY_SETTING 4 #define MY_SETTING 4
#endif
``` ```