From 1d1d5da43f86d9dded47c66afec94991d623f114 Mon Sep 17 00:00:00 2001 From: Ryan Date: Sat, 26 Dec 2020 15:56:11 +1100 Subject: [PATCH] Change include guards in tmk_core/ and drivers/ to pragma once (#11240) --- drivers/avr/hd44780.h | 6 +-- drivers/avr/i2c_master.h | 5 +-- drivers/avr/i2c_slave.h | 5 +-- drivers/avr/ssd1306.h | 5 +-- tmk_core/common/action.h | 6 +-- tmk_core/common/action_code.h | 6 +-- tmk_core/common/action_layer.h | 6 +-- tmk_core/common/action_macro.h | 7 ++- tmk_core/common/action_tapping.h | 6 +-- tmk_core/common/action_util.h | 6 +-- tmk_core/common/arm_atsam/printf.h | 5 +-- tmk_core/common/avr/suspend_avr.h | 5 +-- tmk_core/common/avr/timer_avr.h | 5 +-- tmk_core/common/avr/xprintf.h | 5 +-- tmk_core/common/bootloader.h | 5 +-- tmk_core/common/bootmagic.h | 5 +-- tmk_core/common/chibios/eeprom_stm32.h | 5 +-- tmk_core/common/chibios/flash_stm32.h | 5 +-- tmk_core/common/debug.h | 5 +-- tmk_core/common/eeconfig.h | 5 +-- tmk_core/common/eeprom.h | 5 +-- tmk_core/common/host_driver.h | 5 +-- tmk_core/common/keyboard.h | 5 +-- tmk_core/common/keycode.h | 5 +-- tmk_core/common/magic.h | 5 +-- tmk_core/common/matrix.h | 6 +-- tmk_core/common/mousekey.h | 4 +- tmk_core/common/nodebug.h | 5 +-- tmk_core/common/print.h | 5 +-- tmk_core/common/raw_hid.h | 5 +-- tmk_core/common/sendchar.h | 5 +-- tmk_core/common/sleep_led.h | 5 +-- tmk_core/common/suspend.h | 5 +-- tmk_core/common/timer.h | 5 +-- tmk_core/common/uart.h | 5 +-- tmk_core/common/util.h | 5 +-- tmk_core/common/virtser.h | 5 +-- tmk_core/common/wait.h | 5 +-- tmk_core/protocol/adb.h | 5 +-- tmk_core/protocol/chibios/usb_driver.h | 43 +++++++++---------- tmk_core/protocol/chibios/usb_main.h | 5 +-- tmk_core/protocol/ibm4704.h | 6 +-- tmk_core/protocol/lufa/lufa.h | 5 +-- tmk_core/protocol/m0110.h | 5 +-- tmk_core/protocol/midi/Config/LUFAConfig.h | 4 +- tmk_core/protocol/midi/bytequeue/bytequeue.h | 5 +-- .../midi/bytequeue/interrupt_setting.h | 5 +-- tmk_core/protocol/midi/midi.h | 5 +-- tmk_core/protocol/midi/midi_device.h | 5 +-- tmk_core/protocol/midi/midi_function_types.h | 5 +-- tmk_core/protocol/midi/sysex_tools.h | 5 +-- tmk_core/protocol/news.h | 6 +-- tmk_core/protocol/next_kbd.h | 11 ++--- tmk_core/protocol/ps2.h | 5 +-- tmk_core/protocol/ps2_io.h | 5 +-- tmk_core/protocol/ps2_mouse.h | 5 +-- tmk_core/protocol/serial_mouse.h | 5 +-- tmk_core/protocol/usb_descriptor.h | 5 +-- tmk_core/protocol/xt.h | 5 +-- tmk_core/ring_buffer.h | 6 +-- 60 files changed, 96 insertions(+), 258 deletions(-) diff --git a/drivers/avr/hd44780.h b/drivers/avr/hd44780.h index e60817e98..08e60f8a4 100644 --- a/drivers/avr/hd44780.h +++ b/drivers/avr/hd44780.h @@ -1,5 +1,3 @@ -#ifndef LCD_H -#define LCD_H /************************************************************************* Title : C include file for the HD44780U LCD library (lcd.c) Author: Peter Fleury http://tinyurl.com/peterfleury @@ -43,6 +41,8 @@ */ +#pragma once + #include #include @@ -346,5 +346,3 @@ extern void lcd_data(uint8_t data); #define lcd_puts_P(__s) lcd_puts_p(PSTR(__s)) /**@}*/ - -#endif // LCD_H diff --git a/drivers/avr/i2c_master.h b/drivers/avr/i2c_master.h index 4a35867cd..e5af73364 100644 --- a/drivers/avr/i2c_master.h +++ b/drivers/avr/i2c_master.h @@ -17,8 +17,7 @@ * GitHub repository: https://github.com/g4lvanix/I2C-master-lib */ -#ifndef I2C_MASTER_H -#define I2C_MASTER_H +#pragma once #define I2C_READ 0x01 #define I2C_WRITE 0x00 @@ -42,5 +41,3 @@ i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16 i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout); i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout); void i2c_stop(void); - -#endif // I2C_MASTER_H diff --git a/drivers/avr/i2c_slave.h b/drivers/avr/i2c_slave.h index 5d92150e6..1cd0625ef 100644 --- a/drivers/avr/i2c_slave.h +++ b/drivers/avr/i2c_slave.h @@ -20,8 +20,7 @@ Read or write to the necessary buffer according to the opperation. */ -#ifndef I2C_SLAVE_H -#define I2C_SLAVE_H +#pragma once #define I2C_SLAVE_REG_COUNT 30 @@ -29,5 +28,3 @@ extern volatile uint8_t i2c_slave_reg[I2C_SLAVE_REG_COUNT]; void i2c_slave_init(uint8_t address); void i2c_slave_stop(void); - -#endif // I2C_SLAVE_H diff --git a/drivers/avr/ssd1306.h b/drivers/avr/ssd1306.h index 9131afcf6..6eecdcfaa 100644 --- a/drivers/avr/ssd1306.h +++ b/drivers/avr/ssd1306.h @@ -1,5 +1,4 @@ -#ifndef SSD1306_H -#define SSD1306_H +#pragma once #include #include @@ -86,5 +85,3 @@ void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c); void matrix_write(struct CharacterMatrix *matrix, const char *data); void matrix_write_P(struct CharacterMatrix *matrix, const char *data); void matrix_render(struct CharacterMatrix *matrix); - -#endif diff --git a/tmk_core/common/action.h b/tmk_core/common/action.h index 345c030c9..81cd54369 100644 --- a/tmk_core/common/action.h +++ b/tmk_core/common/action.h @@ -14,8 +14,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef ACTION_H -#define ACTION_H + +#pragma once #include #include @@ -124,5 +124,3 @@ void debug_action(action_t action); #ifdef __cplusplus } #endif - -#endif /* ACTION_H */ diff --git a/tmk_core/common/action_code.h b/tmk_core/common/action_code.h index eea554ff2..eb18c36ae 100644 --- a/tmk_core/common/action_code.h +++ b/tmk_core/common/action_code.h @@ -14,8 +14,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef ACTION_CODE_H -#define ACTION_CODE_H + +#pragma once /** \brief Action codes * @@ -306,5 +306,3 @@ enum swap_hands_param_tap_op { #define ACTION_SWAP_HANDS_OFF_ON() ACTION(ACT_SWAP_HANDS, OP_SH_OFF_ON) #define ACTION_SWAP_HANDS_ON() ACTION(ACT_SWAP_HANDS, OP_SH_ON) #define ACTION_SWAP_HANDS_OFF() ACTION(ACT_SWAP_HANDS, OP_SH_OFF) - -#endif /* ACTION_CODE_H */ diff --git a/tmk_core/common/action_layer.h b/tmk_core/common/action_layer.h index f9f686112..d72cd3e3a 100644 --- a/tmk_core/common/action_layer.h +++ b/tmk_core/common/action_layer.h @@ -14,8 +14,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef ACTION_LAYER_H -#define ACTION_LAYER_H + +#pragma once #include #include "keyboard.h" @@ -120,5 +120,3 @@ uint8_t layer_switch_get_layer(keypos_t key); /* return action depending on current layer status */ action_t layer_switch_get_action(keypos_t key); - -#endif diff --git a/tmk_core/common/action_macro.h b/tmk_core/common/action_macro.h index 21004ead6..685e2c6ff 100644 --- a/tmk_core/common/action_macro.h +++ b/tmk_core/common/action_macro.h @@ -14,8 +14,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef ACTION_MACRO_H -#define ACTION_MACRO_H + +#pragma once + #include #include "progmem.h" @@ -120,5 +121,3 @@ enum macro_command_id { /* for backward comaptibility */ #define MD(key) DOWN(KC_##key) #define MU(key) UP(KC_##key) - -#endif /* ACTION_MACRO_H */ diff --git a/tmk_core/common/action_tapping.h b/tmk_core/common/action_tapping.h index 7015ce761..087090f80 100644 --- a/tmk_core/common/action_tapping.h +++ b/tmk_core/common/action_tapping.h @@ -14,8 +14,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef ACTION_TAPPING_H -#define ACTION_TAPPING_H + +#pragma once /* period of tapping(ms) */ #ifndef TAPPING_TERM @@ -36,5 +36,3 @@ uint16_t get_event_keycode(keyevent_t event, bool update_layer_cache); uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record); void action_tapping_process(keyrecord_t record); #endif - -#endif diff --git a/tmk_core/common/action_util.h b/tmk_core/common/action_util.h index 743ff1406..ff29f79b0 100644 --- a/tmk_core/common/action_util.h +++ b/tmk_core/common/action_util.h @@ -14,8 +14,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef ACTION_UTIL_H -#define ACTION_UTIL_H + +#pragma once #include #include "report.h" @@ -98,5 +98,3 @@ void clear_oneshot_swaphands(void); #ifdef __cplusplus } #endif - -#endif diff --git a/tmk_core/common/arm_atsam/printf.h b/tmk_core/common/arm_atsam/printf.h index ad6672220..95557f5b0 100644 --- a/tmk_core/common/arm_atsam/printf.h +++ b/tmk_core/common/arm_atsam/printf.h @@ -1,10 +1,7 @@ -#ifndef _PRINTF_H_ -#define _PRINTF_H_ +#pragma once #define CONSOLE_PRINTBUF_SIZE 512 void console_printf(char *fmt, ...); #define __xprintf console_printf - -#endif //_PRINTF_H_ diff --git a/tmk_core/common/avr/suspend_avr.h b/tmk_core/common/avr/suspend_avr.h index e4cc0be50..6df048f3b 100644 --- a/tmk_core/common/avr/suspend_avr.h +++ b/tmk_core/common/avr/suspend_avr.h @@ -1,5 +1,4 @@ -#ifndef SUSPEND_AVR_H -#define SUSPEND_AVR_H +#pragma once #include #include @@ -24,5 +23,3 @@ __asm__ __volatile__ ( \ : "r0" \ ) // clang-format on - -#endif diff --git a/tmk_core/common/avr/timer_avr.h b/tmk_core/common/avr/timer_avr.h index 9aea21c65..c1b726bd0 100644 --- a/tmk_core/common/avr/timer_avr.h +++ b/tmk_core/common/avr/timer_avr.h @@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef TIMER_AVR_H -#define TIMER_AVR_H 1 +#pragma once #include @@ -38,5 +37,3 @@ along with this program. If not, see . #if (TIMER_RAW_TOP > 255) # error "Timer0 can't count 1ms at this clock freq. Use larger prescaler." #endif - -#endif diff --git a/tmk_core/common/avr/xprintf.h b/tmk_core/common/avr/xprintf.h index 70e0f8e48..80834f171 100644 --- a/tmk_core/common/avr/xprintf.h +++ b/tmk_core/common/avr/xprintf.h @@ -2,8 +2,7 @@ Extended itoa, puts and printf (C)ChaN, 2011 -----------------------------------------------------------------------------*/ -#ifndef XPRINTF_H -#define XPRINTF_H +#pragma once #include #include @@ -102,5 +101,3 @@ char xatoi(char **str, long *ret); #ifdef __cplusplus } #endif - -#endif diff --git a/tmk_core/common/bootloader.h b/tmk_core/common/bootloader.h index 19260a079..25ebd9528 100644 --- a/tmk_core/common/bootloader.h +++ b/tmk_core/common/bootloader.h @@ -15,10 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef BOOTLOADER_H -#define BOOTLOADER_H +#pragma once /* give code for your bootloader to come up if needed */ void bootloader_jump(void); - -#endif diff --git a/tmk_core/common/bootmagic.h b/tmk_core/common/bootmagic.h index c64dc1785..8209d0194 100644 --- a/tmk_core/common/bootmagic.h +++ b/tmk_core/common/bootmagic.h @@ -1,5 +1,4 @@ -#ifndef BOOTMAGIC_H -#define BOOTMAGIC_H +#pragma once /* FIXME: Add special doxygen comments for defines here. */ @@ -101,5 +100,3 @@ void bootmagic(void); bool bootmagic_scan_keycode(uint8_t keycode); - -#endif diff --git a/tmk_core/common/chibios/eeprom_stm32.h b/tmk_core/common/chibios/eeprom_stm32.h index 373325cd2..4dac7c1b5 100644 --- a/tmk_core/common/chibios/eeprom_stm32.h +++ b/tmk_core/common/chibios/eeprom_stm32.h @@ -21,8 +21,7 @@ * This library also assumes that the pages are not used by the firmware. */ -#ifndef __EEPROM_H -#define __EEPROM_H +#pragma once #include #include @@ -83,5 +82,3 @@ uint16_t EEPROM_Init(void); void EEPROM_Erase(void); uint16_t EEPROM_WriteDataByte(uint16_t Address, uint8_t DataByte); uint8_t EEPROM_ReadDataByte(uint16_t Address); - -#endif /* __EEPROM_H */ diff --git a/tmk_core/common/chibios/flash_stm32.h b/tmk_core/common/chibios/flash_stm32.h index 8a874f606..90d5bff47 100644 --- a/tmk_core/common/chibios/flash_stm32.h +++ b/tmk_core/common/chibios/flash_stm32.h @@ -16,8 +16,7 @@ * Modifications for QMK and STM32F303 by Yiancar */ -#ifndef __FLASH_STM32_H -#define __FLASH_STM32_H +#pragma once #ifdef __cplusplus extern "C" { @@ -41,5 +40,3 @@ void FLASH_ClearFlag(uint32_t FLASH_FLAG); #ifdef __cplusplus } #endif - -#endif /* __FLASH_STM32_H */ diff --git a/tmk_core/common/debug.h b/tmk_core/common/debug.h index f9d611bb0..3d2e2315e 100644 --- a/tmk_core/common/debug.h +++ b/tmk_core/common/debug.h @@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef DEBUG_H -#define DEBUG_H 1 +#pragma once #include #include "print.h" @@ -168,5 +167,3 @@ extern debug_config_t debug_config; # define debug_bin_reverse(data) #endif /* NO_DEBUG */ - -#endif diff --git a/tmk_core/common/eeconfig.h b/tmk_core/common/eeconfig.h index 6fbe78903..c4f048391 100644 --- a/tmk_core/common/eeconfig.h +++ b/tmk_core/common/eeconfig.h @@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef EECONFIG_H -#define EECONFIG_H +#pragma once #include #include @@ -111,5 +110,3 @@ void eeconfig_update_haptic(uint32_t val); bool eeconfig_read_handedness(void); void eeconfig_update_handedness(bool val); - -#endif diff --git a/tmk_core/common/eeprom.h b/tmk_core/common/eeprom.h index 8a81e7066..f5b3f0ad5 100644 --- a/tmk_core/common/eeprom.h +++ b/tmk_core/common/eeprom.h @@ -1,5 +1,4 @@ -#ifndef TMK_CORE_COMMON_EEPROM_H_ -#define TMK_CORE_COMMON_EEPROM_H_ +#pragma once #if defined(__AVR__) && !defined(EEPROM_DRIVER) # include @@ -20,5 +19,3 @@ void eeprom_update_word(uint16_t *__p, uint16_t __value); void eeprom_update_dword(uint32_t *__p, uint32_t __value); void eeprom_update_block(const void *__src, void *__dst, size_t __n); #endif - -#endif /* TMK_CORE_COMMON_EEPROM_H_ */ diff --git a/tmk_core/common/host_driver.h b/tmk_core/common/host_driver.h index 3cfec40cc..f34a22053 100644 --- a/tmk_core/common/host_driver.h +++ b/tmk_core/common/host_driver.h @@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef HOST_DRIVER_H -#define HOST_DRIVER_H +#pragma once #include #include "report.h" @@ -31,5 +30,3 @@ typedef struct { void (*send_system)(uint16_t); void (*send_consumer)(uint16_t); } host_driver_t; - -#endif diff --git a/tmk_core/common/keyboard.h b/tmk_core/common/keyboard.h index caa18e7e7..d04e685cd 100644 --- a/tmk_core/common/keyboard.h +++ b/tmk_core/common/keyboard.h @@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef KEYBOARD_H -#define KEYBOARD_H +#pragma once #include #include @@ -77,5 +76,3 @@ void housekeeping_task_user(void); #ifdef __cplusplus } #endif - -#endif diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h index 5c8ba8fe6..d35e44d8d 100644 --- a/tmk_core/common/keycode.h +++ b/tmk_core/common/keycode.h @@ -21,8 +21,8 @@ along with this program. If not, see . * See https://web.archive.org/web/20060218214400/http://www.usb.org/developers/devclass_docs/Hut1_12.pdf * or http://www.usb.org/developers/hidpage/Hut1_12v2.pdf (older) */ -#ifndef KEYCODE_H -#define KEYCODE_H + +#pragma once /* FIXME: Add doxygen comments here */ @@ -542,4 +542,3 @@ enum mouse_keys { KC_MS_ACCEL1, KC_MS_ACCEL2 }; -#endif diff --git a/tmk_core/common/magic.h b/tmk_core/common/magic.h index 3fa2d8b81..a6552c04d 100644 --- a/tmk_core/common/magic.h +++ b/tmk_core/common/magic.h @@ -1,6 +1,3 @@ -#ifndef MAGIC_H -#define MAGIC_H +#pragma once void magic(void); - -#endif diff --git a/tmk_core/common/matrix.h b/tmk_core/common/matrix.h index 31ec84430..e36f01460 100644 --- a/tmk_core/common/matrix.h +++ b/tmk_core/common/matrix.h @@ -14,8 +14,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef MATRIX_H -#define MATRIX_H + +#pragma once #include #include @@ -76,5 +76,3 @@ void matrix_scan_user(void); #ifdef __cplusplus } #endif - -#endif diff --git a/tmk_core/common/mousekey.h b/tmk_core/common/mousekey.h index 05e453823..300d262f5 100644 --- a/tmk_core/common/mousekey.h +++ b/tmk_core/common/mousekey.h @@ -15,9 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef MOUSEKEY_H -# define MOUSEKEY_H -#endif +#pragma once #include #include "host.h" diff --git a/tmk_core/common/nodebug.h b/tmk_core/common/nodebug.h index b9c8b3ac0..0b176684b 100644 --- a/tmk_core/common/nodebug.h +++ b/tmk_core/common/nodebug.h @@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef NODEBUG_H -#define NODEBUG_H +#pragma once #ifndef NO_DEBUG # define NO_DEBUG @@ -25,5 +24,3 @@ along with this program. If not, see . #else # include "debug.h" #endif - -#endif diff --git a/tmk_core/common/print.h b/tmk_core/common/print.h index 1c7723621..647a5aa05 100644 --- a/tmk_core/common/print.h +++ b/tmk_core/common/print.h @@ -22,8 +22,7 @@ * THE SOFTWARE. */ -#ifndef PRINT_H__ -#define PRINT_H__ 1 +#pragma once #include #include @@ -269,5 +268,3 @@ extern "C" #define pbin16(data) print_bin16(data) #define pbin_reverse(data) print_bin_reverse8(data) #define pbin_reverse16(data) print_bin_reverse16(data) - -#endif diff --git a/tmk_core/common/raw_hid.h b/tmk_core/common/raw_hid.h index c579157f1..6d60ab2bf 100644 --- a/tmk_core/common/raw_hid.h +++ b/tmk_core/common/raw_hid.h @@ -1,8 +1,5 @@ -#ifndef _RAW_HID_H_ -#define _RAW_HID_H_ +#pragma once void raw_hid_receive(uint8_t *data, uint8_t length); void raw_hid_send(uint8_t *data, uint8_t length); - -#endif diff --git a/tmk_core/common/sendchar.h b/tmk_core/common/sendchar.h index bd7b94fd9..b150dd464 100644 --- a/tmk_core/common/sendchar.h +++ b/tmk_core/common/sendchar.h @@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef SENDCHAR_H -#define SENDCHAR_H +#pragma once #include @@ -30,5 +29,3 @@ int8_t sendchar(uint8_t c); #ifdef __cplusplus } #endif - -#endif diff --git a/tmk_core/common/sleep_led.h b/tmk_core/common/sleep_led.h index d160213f1..38f80a660 100644 --- a/tmk_core/common/sleep_led.h +++ b/tmk_core/common/sleep_led.h @@ -1,5 +1,4 @@ -#ifndef SLEEP_LED_H -#define SLEEP_LED_H +#pragma once #ifdef SLEEP_LED_ENABLE @@ -16,5 +15,3 @@ void sleep_led_toggle(void); # define sleep_led_toggle() #endif - -#endif diff --git a/tmk_core/common/suspend.h b/tmk_core/common/suspend.h index 87f5025da..766df95aa 100644 --- a/tmk_core/common/suspend.h +++ b/tmk_core/common/suspend.h @@ -1,5 +1,4 @@ -#ifndef SUSPEND_H -#define SUSPEND_H +#pragma once #include #include @@ -13,5 +12,3 @@ void suspend_wakeup_init_user(void); void suspend_wakeup_init_kb(void); void suspend_power_down_user(void); void suspend_power_down_kb(void); - -#endif diff --git a/tmk_core/common/timer.h b/tmk_core/common/timer.h index 7ee7feac2..58f637dd9 100644 --- a/tmk_core/common/timer.h +++ b/tmk_core/common/timer.h @@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef TIMER_H -#define TIMER_H 1 +#pragma once #include #include @@ -51,5 +50,3 @@ uint32_t timer_elapsed32(uint32_t last); #ifdef __cplusplus } #endif - -#endif diff --git a/tmk_core/common/uart.h b/tmk_core/common/uart.h index 59a1a7cd1..ea247b17b 100644 --- a/tmk_core/common/uart.h +++ b/tmk_core/common/uart.h @@ -1,5 +1,4 @@ -#ifndef _uart_included_h_ -#define _uart_included_h_ +#pragma once #include @@ -7,5 +6,3 @@ void uart_init(uint32_t baud); void uart_putchar(uint8_t c); uint8_t uart_getchar(void); uint8_t uart_available(void); - -#endif diff --git a/tmk_core/common/util.h b/tmk_core/common/util.h index 68642e7fd..db57f268c 100644 --- a/tmk_core/common/util.h +++ b/tmk_core/common/util.h @@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef UTIL_H -#define UTIL_H +#pragma once #include @@ -46,5 +45,3 @@ uint32_t bitrev32(uint32_t bits); #ifdef __cplusplus } #endif - -#endif diff --git a/tmk_core/common/virtser.h b/tmk_core/common/virtser.h index 74891b6ae..a0645f9e0 100644 --- a/tmk_core/common/virtser.h +++ b/tmk_core/common/virtser.h @@ -1,10 +1,7 @@ -#ifndef _VIRTSER_H_ -#define _VIRTSER_H_ +#pragma once /* Define this function in your code to process incoming bytes */ void virtser_recv(const uint8_t ch); /* Call this to send a character over the Virtual Serial Device */ void virtser_send(const uint8_t byte); - -#endif diff --git a/tmk_core/common/wait.h b/tmk_core/common/wait.h index f5ef12ac0..89128e9da 100644 --- a/tmk_core/common/wait.h +++ b/tmk_core/common/wait.h @@ -1,5 +1,4 @@ -#ifndef WAIT_H -#define WAIT_H +#pragma once #include @@ -41,5 +40,3 @@ void wait_ms(uint32_t ms); #ifdef __cplusplus } #endif - -#endif diff --git a/tmk_core/protocol/adb.h b/tmk_core/protocol/adb.h index 7d37485fc..34cbcf769 100644 --- a/tmk_core/protocol/adb.h +++ b/tmk_core/protocol/adb.h @@ -35,8 +35,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ADB_H -#define ADB_H +#pragma once #include #include @@ -57,5 +56,3 @@ void adb_host_listen(uint8_t cmd, uint8_t data_h, uint8_t data_l); void adb_host_kbd_led(uint8_t led); void adb_mouse_task(void); void adb_mouse_init(void); - -#endif diff --git a/tmk_core/protocol/chibios/usb_driver.h b/tmk_core/protocol/chibios/usb_driver.h index 6d71bcec4..f94387deb 100644 --- a/tmk_core/protocol/chibios/usb_driver.h +++ b/tmk_core/protocol/chibios/usb_driver.h @@ -22,10 +22,9 @@ * @{ */ -#ifndef USB_DRIVER_H -# define USB_DRIVER_H +#pragma once -# include +#include /*===========================================================================*/ /* Driver constants. */ @@ -35,9 +34,9 @@ /* Derived constants and error checks. */ /*===========================================================================*/ -# if HAL_USE_USB == FALSE -# error "The USB Driver requires HAL_USE_USB" -# endif +#if HAL_USE_USB == FALSE +# error "The USB Driver requires HAL_USE_USB" +#endif /*===========================================================================*/ /* Driver data structures and types. */ @@ -112,21 +111,21 @@ typedef struct { /** * @brief @p SerialDriver specific data. */ -# define _qmk_usb_driver_data \ - _base_asynchronous_channel_data /* Driver state.*/ \ - qmkusbstate_t state; \ - /* Input buffers queue.*/ \ - input_buffers_queue_t ibqueue; \ - /* Output queue.*/ \ - output_buffers_queue_t obqueue; \ - /* End of the mandatory fields.*/ \ - /* Current configuration data.*/ \ - const QMKUSBConfig *config; +#define _qmk_usb_driver_data \ + _base_asynchronous_channel_data /* Driver state.*/ \ + qmkusbstate_t state; \ + /* Input buffers queue.*/ \ + input_buffers_queue_t ibqueue; \ + /* Output queue.*/ \ + output_buffers_queue_t obqueue; \ + /* End of the mandatory fields.*/ \ + /* Current configuration data.*/ \ + const QMKUSBConfig *config; /** * @brief @p SerialUSBDriver specific methods. */ -# define _qmk_usb_driver_methods _base_asynchronous_channel_methods +#define _qmk_usb_driver_methods _base_asynchronous_channel_methods /** * @extends BaseAsynchronousChannelVMT @@ -158,9 +157,9 @@ struct QMKUSBDriver { /* External declarations. */ /*===========================================================================*/ -# ifdef __cplusplus +#ifdef __cplusplus extern "C" { -# endif +#endif void qmkusbInit(void); void qmkusbObjectInit(QMKUSBDriver *qmkusbp, const QMKUSBConfig *config); void qmkusbStart(QMKUSBDriver *qmkusbp, const QMKUSBConfig *config); @@ -173,10 +172,8 @@ void qmkusbSOFHookI(QMKUSBDriver *qmkusbp); void qmkusbDataTransmitted(USBDriver *usbp, usbep_t ep); void qmkusbDataReceived(USBDriver *usbp, usbep_t ep); void qmkusbInterruptTransmitted(USBDriver *usbp, usbep_t ep); -# ifdef __cplusplus +#ifdef __cplusplus } -# endif - -#endif /* USB_DRIVER_H */ +#endif /** @} */ diff --git a/tmk_core/protocol/chibios/usb_main.h b/tmk_core/protocol/chibios/usb_main.h index 1381d0765..eaa08d8f7 100644 --- a/tmk_core/protocol/chibios/usb_main.h +++ b/tmk_core/protocol/chibios/usb_main.h @@ -15,8 +15,7 @@ * GPL v2 or later. */ -#ifndef _USB_MAIN_H_ -#define _USB_MAIN_H_ +#pragma once // TESTING // extern uint8_t blinkLed; @@ -89,5 +88,3 @@ int8_t sendchar(uint8_t c); void console_flush_output(void); #endif /* CONSOLE_ENABLE */ - -#endif /* _USB_MAIN_H_ */ diff --git a/tmk_core/protocol/ibm4704.h b/tmk_core/protocol/ibm4704.h index cc2418ee6..4f88d148b 100644 --- a/tmk_core/protocol/ibm4704.h +++ b/tmk_core/protocol/ibm4704.h @@ -1,8 +1,8 @@ /* Copyright 2014 Jun WAKO */ -#ifndef IBM4704_H -#define IBM4704_H + +#pragma once #define IBM4704_ERR_NONE 0 #define IBM4704_ERR_PARITY 0x70 @@ -101,5 +101,3 @@ static inline void inhibit(void) { clock_hi(); data_lo(); } - -#endif diff --git a/tmk_core/protocol/lufa/lufa.h b/tmk_core/protocol/lufa/lufa.h index 71fd7aad8..348a84c03 100644 --- a/tmk_core/protocol/lufa/lufa.h +++ b/tmk_core/protocol/lufa/lufa.h @@ -36,8 +36,7 @@ this software. */ -#ifndef _LUFA_H_ -#define _LUFA_H_ +#pragma once #include #include @@ -68,5 +67,3 @@ extern host_driver_t lufa_driver; // The header and terminator are not stored to save a few bytes of precious ram # define MIDI_SYSEX_BUFFER (API_SYSEX_MAX_SIZE + API_SYSEX_MAX_SIZE / 7 + (API_SYSEX_MAX_SIZE % 7 ? 1 : 0)) #endif - -#endif diff --git a/tmk_core/protocol/m0110.h b/tmk_core/protocol/m0110.h index 3f9686b0d..63ff3e90e 100644 --- a/tmk_core/protocol/m0110.h +++ b/tmk_core/protocol/m0110.h @@ -35,8 +35,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef M0110_H -#define M0110_H +#pragma once /* port settings for clock and data line */ #if !(defined(M0110_CLOCK_PORT) && defined(M0110_CLOCK_PIN) && defined(M0110_CLOCK_DDR) && defined(M0110_CLOCK_BIT)) @@ -80,5 +79,3 @@ uint8_t m0110_recv(void); uint8_t m0110_recv_key(void); uint8_t m0110_inquiry(void); uint8_t m0110_instant(void); - -#endif diff --git a/tmk_core/protocol/midi/Config/LUFAConfig.h b/tmk_core/protocol/midi/Config/LUFAConfig.h index b346c05bd..dead96de7 100644 --- a/tmk_core/protocol/midi/Config/LUFAConfig.h +++ b/tmk_core/protocol/midi/Config/LUFAConfig.h @@ -39,8 +39,7 @@ * manual section "Summary of Compile Tokens". */ -#ifndef _LUFA_CONFIG_H_ -#define _LUFA_CONFIG_H_ +#pragma once #if (ARCH == ARCH_AVR8) @@ -90,4 +89,3 @@ # error Unsupported architecture for this LUFA configuration file. #endif -#endif diff --git a/tmk_core/protocol/midi/bytequeue/bytequeue.h b/tmk_core/protocol/midi/bytequeue/bytequeue.h index 33fb63a8c..29d15abbd 100644 --- a/tmk_core/protocol/midi/bytequeue/bytequeue.h +++ b/tmk_core/protocol/midi/bytequeue/bytequeue.h @@ -17,8 +17,7 @@ // You should have received a copy of the GNU General Public License // along with avr-bytequeue. If not, see . -#ifndef BYTEQUEUE_H -#define BYTEQUEUE_H +#pragma once #ifdef __cplusplus extern "C" { @@ -54,5 +53,3 @@ void bytequeue_remove(byteQueue_t* queue, byteQueueIndex_t numToRemove); #ifdef __cplusplus } #endif - -#endif diff --git a/tmk_core/protocol/midi/bytequeue/interrupt_setting.h b/tmk_core/protocol/midi/bytequeue/interrupt_setting.h index 788f75d79..78294f076 100644 --- a/tmk_core/protocol/midi/bytequeue/interrupt_setting.h +++ b/tmk_core/protocol/midi/bytequeue/interrupt_setting.h @@ -16,8 +16,7 @@ // You should have received a copy of the GNU General Public License // along with avr-bytequeue. If not, see . -#ifndef INTERRUPT_SETTING_H -#define INTERRUPT_SETTING_H +#pragma once #ifdef __cplusplus extern "C" { @@ -34,5 +33,3 @@ void restore_interrupt_setting(interrupt_setting_t setting); #ifdef __cplusplus } #endif - -#endif diff --git a/tmk_core/protocol/midi/midi.h b/tmk_core/protocol/midi/midi.h index 07d8cebc1..75f3b13b0 100644 --- a/tmk_core/protocol/midi/midi.h +++ b/tmk_core/protocol/midi/midi.h @@ -25,8 +25,7 @@ * */ -#ifndef XNOR_MIDI_H -#define XNOR_MIDI_H +#pragma once #ifdef __cplusplus extern "C" { @@ -486,5 +485,3 @@ midi_packet_length_t midi_packet_length(uint8_t status); #ifdef __cplusplus } #endif - -#endif diff --git a/tmk_core/protocol/midi/midi_device.h b/tmk_core/protocol/midi/midi_device.h index 693d81a8e..79e8f7a93 100644 --- a/tmk_core/protocol/midi/midi_device.h +++ b/tmk_core/protocol/midi/midi_device.h @@ -21,8 +21,7 @@ * @brief Device implementation functions */ -#ifndef MIDI_DEVICE_H -#define MIDI_DEVICE_H +#pragma once #ifdef __cplusplus extern "C" { @@ -147,5 +146,3 @@ void midi_device_set_pre_input_process_func(MidiDevice* device, midi_no_byte_fun #ifdef __cplusplus } #endif - -#endif diff --git a/tmk_core/protocol/midi/midi_function_types.h b/tmk_core/protocol/midi/midi_function_types.h index 761e88117..6f98a7298 100644 --- a/tmk_core/protocol/midi/midi_function_types.h +++ b/tmk_core/protocol/midi/midi_function_types.h @@ -21,8 +21,7 @@ * @brief Function signature definitions */ -#ifndef MIDI_FUNCTION_TYPES_H -#define MIDI_FUNCTION_TYPES_H +#pragma once #ifdef __cplusplus extern "C" { @@ -46,5 +45,3 @@ typedef void (*midi_sysex_func_t)(MidiDevice *device, uint16_t start_byte, uint8 #ifdef __cplusplus } #endif - -#endif diff --git a/tmk_core/protocol/midi/sysex_tools.h b/tmk_core/protocol/midi/sysex_tools.h index 454a92ea5..7d7f10d24 100644 --- a/tmk_core/protocol/midi/sysex_tools.h +++ b/tmk_core/protocol/midi/sysex_tools.h @@ -16,8 +16,7 @@ // You should have received a copy of the GNU General Public License // along with avr-midi. If not, see . -#ifndef SYSEX_TOOLS_H -#define SYSEX_TOOLS_H +#pragma once #ifdef __cplusplus extern "C" { @@ -91,5 +90,3 @@ uint16_t sysex_decode(uint8_t *decoded, const uint8_t *source, uint16_t length); #ifdef __cplusplus } #endif - -#endif diff --git a/tmk_core/protocol/news.h b/tmk_core/protocol/news.h index d0c4bc6a4..327a13856 100644 --- a/tmk_core/protocol/news.h +++ b/tmk_core/protocol/news.h @@ -35,8 +35,8 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef NEWS_H -#define NEWS_H +#pragma once + /* * Primitive PS/2 Library for AVR */ @@ -46,5 +46,3 @@ void news_init(void); uint8_t news_recv(void); /* device role */ - -#endif diff --git a/tmk_core/protocol/next_kbd.h b/tmk_core/protocol/next_kbd.h index bff7a474d..1249ebf39 100644 --- a/tmk_core/protocol/next_kbd.h +++ b/tmk_core/protocol/next_kbd.h @@ -45,13 +45,12 @@ POSSIBILITY OF SUCH DAMAGE. */ +#pragma once + #include -#ifndef NEXT_KBD_H -# define NEXT_KBD_H - -# define NEXT_KBD_KMBUS_IDLE 0x300600 -# define NEXT_KBD_TIMING 50 +#define NEXT_KBD_KMBUS_IDLE 0x300600 +#define NEXT_KBD_TIMING 50 extern uint8_t next_kbd_error; @@ -59,5 +58,3 @@ extern uint8_t next_kbd_error; void next_kbd_init(void); void next_kbd_set_leds(bool left, bool right); uint32_t next_kbd_recv(void); - -#endif diff --git a/tmk_core/protocol/ps2.h b/tmk_core/protocol/ps2.h index e32cc9603..f12319285 100644 --- a/tmk_core/protocol/ps2.h +++ b/tmk_core/protocol/ps2.h @@ -35,8 +35,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef PS2_H -#define PS2_H +#pragma once #include #include "wait.h" @@ -138,5 +137,3 @@ static inline void inhibit(void) { clock_lo(); data_hi(); } - -#endif diff --git a/tmk_core/protocol/ps2_io.h b/tmk_core/protocol/ps2_io.h index 35e26561d..de93cb7a3 100644 --- a/tmk_core/protocol/ps2_io.h +++ b/tmk_core/protocol/ps2_io.h @@ -1,5 +1,4 @@ -#ifndef PS2_IO_H -#define PS2_IO_H +#pragma once void clock_init(void); void clock_lo(void); @@ -10,5 +9,3 @@ void data_init(void); void data_lo(void); void data_hi(void); bool data_in(void); - -#endif diff --git a/tmk_core/protocol/ps2_mouse.h b/tmk_core/protocol/ps2_mouse.h index d743fb3d8..c97c6c893 100644 --- a/tmk_core/protocol/ps2_mouse.h +++ b/tmk_core/protocol/ps2_mouse.h @@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef PS2_MOUSE_H -#define PS2_MOUSE_H +#pragma once #include #include "debug.h" @@ -176,5 +175,3 @@ void ps2_mouse_set_resolution(ps2_mouse_resolution_t resolution); void ps2_mouse_set_sample_rate(ps2_mouse_sample_rate_t sample_rate); void ps2_mouse_moved_user(report_mouse_t *mouse_report); - -#endif diff --git a/tmk_core/protocol/serial_mouse.h b/tmk_core/protocol/serial_mouse.h index b10315f36..cb83cf4f6 100644 --- a/tmk_core/protocol/serial_mouse.h +++ b/tmk_core/protocol/serial_mouse.h @@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#ifndef SERIAL_MOUSE_H -#define SERIAL_MOUSE_H +#pragma once #include @@ -28,5 +27,3 @@ static inline uint8_t serial_mouse_init(void) { } void serial_mouse_task(void); - -#endif diff --git a/tmk_core/protocol/usb_descriptor.h b/tmk_core/protocol/usb_descriptor.h index 3a7c0bdba..4c6728ebb 100644 --- a/tmk_core/protocol/usb_descriptor.h +++ b/tmk_core/protocol/usb_descriptor.h @@ -40,8 +40,8 @@ * * Header file for Descriptors.c. */ -#ifndef _DESCRIPTORS_H_ -#define _DESCRIPTORS_H_ + +#pragma once #include @@ -286,4 +286,3 @@ enum usb_endpoints { #define JOYSTICK_EPSIZE 8 uint16_t get_usb_descriptor(const uint16_t wValue, const uint16_t wIndex, const void** const DescriptorAddress); -#endif diff --git a/tmk_core/protocol/xt.h b/tmk_core/protocol/xt.h index e7e1a13f4..6dc5f19d0 100644 --- a/tmk_core/protocol/xt.h +++ b/tmk_core/protocol/xt.h @@ -36,8 +36,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef XT_H -#define XT_H +#pragma once #define XT_DATA_IN() \ do { \ @@ -69,5 +68,3 @@ POSSIBILITY OF SUCH DAMAGE. void xt_host_init(void); uint8_t xt_host_recv(void); - -#endif diff --git a/tmk_core/ring_buffer.h b/tmk_core/ring_buffer.h index 25fab638e..8f887c8f7 100644 --- a/tmk_core/ring_buffer.h +++ b/tmk_core/ring_buffer.h @@ -1,5 +1,5 @@ -#ifndef RING_BUFFER_H -#define RING_BUFFER_H +#pragma once + /*-------------------------------------------------------------------- * Ring buffer to store scan codes from keyboard *------------------------------------------------------------------*/ @@ -43,5 +43,3 @@ static inline bool rbuf_has_data(void) { static inline void rbuf_clear(void) { ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { rbuf_head = rbuf_tail = 0; } } - -#endif /* RING_BUFFER_H */