Skip to content

Commit

Permalink
chore: change include guards to pragma
Browse files Browse the repository at this point in the history
Exceptions:
- LVGL font code doesn't like pragma,
- thirdparty libraries
- STM32 generated headers
  • Loading branch information
pfeerick committed Aug 12, 2024
1 parent a223f0d commit c74155e
Show file tree
Hide file tree
Showing 84 changed files with 110 additions and 373 deletions.
5 changes: 1 addition & 4 deletions radio/src/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/

#ifndef _AUDIO_H_
#define _AUDIO_H_
#pragma once

#include <stddef.h>
#include <string.h>
Expand Down Expand Up @@ -697,5 +696,3 @@ void referenceSystemAudioFiles();
void referenceModelAudioFiles();

bool isAudioFileReferenced(uint32_t i, char * filename/*at least AUDIO_FILENAME_MAXLEN+1 long*/);

#endif // _AUDIO_H_
5 changes: 1 addition & 4 deletions radio/src/bin_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/

#ifndef _BIN_ALLOCATOR_H_
#define _BIN_ALLOCATOR_H_
#pragma once

#include "debug.h"

Expand Down Expand Up @@ -95,5 +94,3 @@ extern BinAllocator_slots2 slots2;
// wrapper for our BinAllocator for Lua
void *bin_l_alloc (void *ud, void *ptr, size_t osize, size_t nsize);
#endif //#if defined(USE_BIN_ALLOCATOR)

#endif // _BIN_ALLOCATOR_H_
6 changes: 1 addition & 5 deletions radio/src/buzzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/

#ifndef _BUZZER_H_
#define _BUZZER_H_
#pragma once

#if defined(BUZZER)
extern uint8_t beepAgainOrig;
Expand Down Expand Up @@ -118,6 +117,3 @@ inline void beep(uint8_t) { }
#define PLAY_MODEL_NAME()
#define START_SILENCE_PERIOD()
#endif /* !AUDIO */


#endif // _BUZZER_H_
5 changes: 1 addition & 4 deletions radio/src/chksize.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@
* GNU General Public License for more details.
*/

#ifndef CHKSIZE_H
#define CHKSIZE_H
#pragma once

#include <inttypes.h>

template <typename ToCheck, size_t expectedSize, size_t realSize = sizeof(ToCheck)>
void check_size() {
static_assert(expectedSize == realSize, "struct size changed");
}

#endif
5 changes: 1 addition & 4 deletions radio/src/cli.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/

#ifndef _CLI_H_
#define _CLI_H_
#pragma once

#include "hal/serial_driver.h"

Expand All @@ -29,5 +28,3 @@ void cliStart();

// Connect serial driver to CLI
void cliSetSerialDriver(void* ctx, const etx_serial_driver_t* drv);

#endif // _CLI_H_
5 changes: 1 addition & 4 deletions radio/src/crc.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/

#ifndef __CRC_H__
#define __CRC_H__
#pragma once

#include <inttypes.h>

Expand All @@ -34,5 +33,3 @@ extern const unsigned short * const crc16tab[2];
uint8_t crc8(const uint8_t * ptr, uint32_t len);
uint8_t crc8_BA(const uint8_t * ptr, uint32_t len);
uint16_t crc16(uint8_t index, const uint8_t * buf, uint32_t len, uint16_t start = 0);

#endif
5 changes: 1 addition & 4 deletions radio/src/curves.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/

#ifndef _CURVES_H_
#define _CURVES_H_
#pragma once

enum BaseCurves {
CURVE_NONE,
Expand Down Expand Up @@ -48,5 +47,3 @@ int applyCurve(int x, CurveRef & curve);
int applyCurrentCurve(int x);

char *getCurveRefString(char *dest, size_t len, const CurveRef& curve);

#endif
6 changes: 1 addition & 5 deletions radio/src/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/

#ifndef _DEBUG_H_
#define _DEBUG_H_
#pragma once

#include <float.h>
#include "definitions.h"
Expand Down Expand Up @@ -415,6 +414,3 @@ extern const char * const debugTimerNames[DEBUG_TIMERS_COUNT];
#define DEBUG_TIMER_SAMPLE(timer)

#endif //#if defined(DEBUG_TIMERS)

#endif // _DEBUG_H_

5 changes: 1 addition & 4 deletions radio/src/definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/

#ifndef _DEFINITIONS_H_
#define _DEFINITIONS_H_
#pragma once

#include <inttypes.h>
#include <stdbool.h>
Expand Down Expand Up @@ -115,5 +114,3 @@
#define EXTERN_C_START
#define EXTERN_C_END
#endif

#endif // _DEFINITIONS_H_
5 changes: 1 addition & 4 deletions radio/src/dump.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@
* GNU General Public License for more details.
*/

#ifndef _DUMP_H_
#define _DUMP_H_
#pragma once

#if defined(DEBUG) || defined(CLI)
void dump(const void * data, unsigned int size);
#else
#define dump(data, size)
#endif

#endif // _DUMP_H_
5 changes: 1 addition & 4 deletions radio/src/fifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/

#ifndef _FIFO_H_
#define _FIFO_H_
#pragma once

#include <inttypes.h>

Expand Down Expand Up @@ -114,5 +113,3 @@ class Fifo
return (idx + 1) & (N - 1);
}
};

#endif // _FIFO_H_
5 changes: 1 addition & 4 deletions radio/src/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/

#ifndef _GLOBALS_H_
#define _GLOBALS_H_
#pragma once

#include "definitions.h"
#include "dataconstants.h"
Expand Down Expand Up @@ -97,5 +96,3 @@ extern uint8_t beepAgain;
extern uint16_t lightOffCounter;
extern uint8_t flashCounter;
extern uint8_t mixWarning;

#endif
12 changes: 5 additions & 7 deletions radio/src/gps.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/

#ifndef _GPS_H_
#define _GPS_H_
#pragma once

#include "edgetx.h"
#include <inttypes.h>
Expand Down Expand Up @@ -50,14 +49,13 @@ extern uint8_t gpsTraceEnabled;
#define GPS_PROTOCOL_UBX 2

// Setup GPS serial port
void gpsSetSerialDriver(void* ctx, const etx_serial_driver_t* drv, int protocol);
void gpsSetSerialDriver(void* ctx, const etx_serial_driver_t* drv,
int protocol);

// Periodic processing
void gpsWakeup();

// Send a 0-terminated frame
void gpsSendFrame(const char * frame);
void gpsSendFrame(const char* frame);

uint32_t GPS_coord_to_degrees(const char * coordinateString);

#endif // _GPS_H_
uint32_t GPS_coord_to_degrees(const char* coordinateString);
7 changes: 2 additions & 5 deletions radio/src/gps_nmea.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@
* GNU General Public License for more details.
*/

#ifndef _GPS_NMEA_H_
#define _GPS_NMEA_H_
#pragma once

#include <inttypes.h>

bool gpsNewFrameNMEA(char c);

void gpsSendFrameNMEA(const char * frame);

#endif // _GPS_NMEA_H_
void gpsSendFrameNMEA(const char* frame);
5 changes: 1 addition & 4 deletions radio/src/gps_ubx.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@
* GNU General Public License for more details.
*/

#ifndef _GPS_UBX_H_
#define _GPS_UBX_H_
#pragma once

#include <inttypes.h>

bool gpsNewFrameUBX(uint8_t c, bool detect);

#endif // _GPS_UBX_H_
5 changes: 1 addition & 4 deletions radio/src/gui/128x64/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/

#ifndef _GUI_H_
#define _GUI_H_
#pragma once

#include "gui_common.h"
#include "menus.h"
Expand Down Expand Up @@ -209,5 +208,3 @@ FlightModesType editFlightModes(coord_t x, coord_t y, event_t event, FlightModes
#else
#define displayFlightModes(...)
#endif

#endif // _GUI_H_
5 changes: 1 addition & 4 deletions radio/src/gui/128x64/popups.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/

#ifndef _POPUPS_H_
#define _POPUPS_H_
#pragma once

#include <keys.h>

Expand All @@ -46,5 +45,3 @@ enum {
};

#include "../common/stdlcd/popups.h"

#endif // _POPUPS_H_
5 changes: 1 addition & 4 deletions radio/src/gui/212x64/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/

#ifndef _GUI_H_
#define _GUI_H_
#pragma once

#include "gui_common.h"
#include "lcd.h"
Expand Down Expand Up @@ -193,5 +192,3 @@ FlightModesType editFlightModes(coord_t x, coord_t y, event_t event, FlightModes
#define IS_MAIN_VIEW_DISPLAYED() menuHandlers[0] == menuMainView
#define IS_TELEMETRY_VIEW_DISPLAYED() menuHandlers[0] == menuViewTelemetry
#define IS_OTHER_VIEW_DISPLAYED() (menuHandlers[0] == menuMainViewChannelsMonitor || menuHandlers[0] == menuChannelsView)

#endif // _GUI_H_
5 changes: 1 addition & 4 deletions radio/src/gui/212x64/menus.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/

#ifndef _MENUS_H_
#define _MENUS_H_
#pragma once

#include "keys.h"
#include "common/stdlcd/menus.h"
Expand Down Expand Up @@ -128,5 +127,3 @@ void menuModelUSBJoystick(event_t event);
#endif

extern const MenuHandler menuTabModel[MENU_MODEL_PAGES_COUNT];

#endif // _MENUS_H_
5 changes: 1 addition & 4 deletions radio/src/gui/212x64/popups.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/

#ifndef _POPUPS_H_
#define _POPUPS_H_
#pragma once

#define MESSAGEBOX_X 10
#define MESSAGEBOX_Y 8
Expand All @@ -44,5 +43,3 @@ enum {
};

#include "../common/stdlcd/popups.h"

#endif // _POPUPS_H_
40 changes: 20 additions & 20 deletions radio/src/gui/colorlcd/lv_conf.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
/**
* @file lv_conf.h
* Configuration file for v8.2.0
*/

/*
* Copy this file as `lv_conf.h`
* 1. simply next to the `lvgl` folder
* 2. or any other places and
* - define `LV_CONF_INCLUDE_SIMPLE`
* - add the path as include path
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/

/* clang-format off */
#if 1 /*Set it to "1" to enable content*/
#pragma once

#ifndef LV_CONF_H
#define LV_CONF_H
/* clang-format off */

#include <stdint.h>

Expand Down Expand Up @@ -841,9 +847,3 @@
# define LV_DEMO_MUSIC_LARGE 0
# define LV_DEMO_MUSIC_AUTO_PLAY 0
#endif

/*--END OF LV_CONF_H--*/

#endif /*LV_CONF_H*/

#endif /*End of "Content enable"*/
5 changes: 1 addition & 4 deletions radio/src/gui/common/stdlcd/menus.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/

#ifndef _COMMON_MENUS_H_
#define _COMMON_MENUS_H_
#pragma once

#include "edgetx_types.h"

Expand Down Expand Up @@ -62,5 +61,3 @@ inline MenuHandlerFunc lastPopMenu()
{
return menuHandlers[menuLevel + 1];
}

#endif // _COMMON_MENUS_H_
Loading

0 comments on commit c74155e

Please sign in to comment.