From a499ea34800ad3fe90733445829661b5dbac5215 Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Thu, 10 Dec 2020 23:00:11 +0000 Subject: [PATCH] stm32: timer/dmamux: fix broken includes bad Karl, you can't just _start_ using pragma on common files, and expect it to keep working. Just finish, convert them fully to pragma. pros: no more weird @cond boilerplate mess and trailing #endifs. easier to follow cons: no warning for people who deliberately try and include things in bad orders. --- .../libopencm3/stm32/common/dmamux_common_all.h | 13 +------------ .../libopencm3/stm32/common/timer_common_all.h | 13 +------------ .../libopencm3/stm32/common/timer_common_f24.h | 15 +-------------- include/libopencm3/stm32/f0/timer.h | 5 +---- include/libopencm3/stm32/f1/timer.h | 5 +---- include/libopencm3/stm32/f2/timer.h | 6 +----- include/libopencm3/stm32/f3/timer.h | 6 +----- include/libopencm3/stm32/f4/timer.h | 6 +----- include/libopencm3/stm32/f7/timer.h | 10 +--------- include/libopencm3/stm32/g0/dmamux.h | 4 +--- include/libopencm3/stm32/g0/timer.h | 6 +----- include/libopencm3/stm32/g4/timer.h | 6 +----- include/libopencm3/stm32/h7/timer.h | 10 +--------- include/libopencm3/stm32/l0/timer.h | 2 -- include/libopencm3/stm32/l1/timer.h | 6 +----- include/libopencm3/stm32/l4/timer.h | 10 +--------- 16 files changed, 15 insertions(+), 108 deletions(-) diff --git a/include/libopencm3/stm32/common/dmamux_common_all.h b/include/libopencm3/stm32/common/dmamux_common_all.h index c3bd0bf7..f8b1a528 100644 --- a/include/libopencm3/stm32/common/dmamux_common_all.h +++ b/include/libopencm3/stm32/common/dmamux_common_all.h @@ -25,11 +25,7 @@ * along with this library. If not, see . */ -/** @cond */ -#if defined(LIBOPENCM3_DMAMUX_H) -/** @endcond */ -#ifndef LIBOPENCM3_DMAMUX_COMMON_ALL_H -#define LIBOPENCM3_DMAMUX_COMMON_ALL_H +#pragma once /**@{*/ @@ -205,10 +201,3 @@ void dmamux_clear_request_generator_trigger_overrun_interrupt(uint32_t dmamux, u END_DECLS /**@}*/ - -#endif -/** @cond */ -#else -#warning "dmamux_common_all.h should not be included explicitly, only via dmamux.h" -#endif -/** @endcond */ diff --git a/include/libopencm3/stm32/common/timer_common_all.h b/include/libopencm3/stm32/common/timer_common_all.h index c3b8c048..08939d90 100644 --- a/include/libopencm3/stm32/common/timer_common_all.h +++ b/include/libopencm3/stm32/common/timer_common_all.h @@ -28,12 +28,7 @@ The order of header inclusion is important. timer.h includes the device specific memorymap.h header before including this header file.*/ -/** @cond */ -#if defined(LIBOPENCM3_TIMER_H) -/** @endcond */ -#ifndef LIBOPENCM3_TIMER_COMMON_H -#define LIBOPENCM3_TIMER_COMMON_H - +#pragma once /* --- Convenience macros -------------------------------------------------- */ /* Timer register base addresses (for convenience) */ @@ -1241,10 +1236,4 @@ void timer_slave_set_trigger(uint32_t timer, uint8_t trigger); END_DECLS -#endif -/** @cond */ -#else -#warning "timer_common_all.h should not be included directly, only via timer.h" -#endif -/** @endcond */ /**@}*/ diff --git a/include/libopencm3/stm32/common/timer_common_f24.h b/include/libopencm3/stm32/common/timer_common_f24.h index 6f483d86..2d9c98ad 100644 --- a/include/libopencm3/stm32/common/timer_common_f24.h +++ b/include/libopencm3/stm32/common/timer_common_f24.h @@ -27,12 +27,7 @@ The order of header inclusion is important. timer.h includes the device specific memorymap.h header before including this header file.*/ -/** @cond */ -#ifdef LIBOPENCM3_TIMER_H -/** @endcond */ -#ifndef LIBOPENCM3_TIMER_COMMON_F24_H -#define LIBOPENCM3_TIMER_COMMON_F24_H - +#pragma once #include /* @@ -104,11 +99,3 @@ void timer_ic_set_polarity(uint32_t timer, enum tim_ic_id ic, enum tim_ic_pol pol); END_DECLS - -#endif -/** @cond */ -#else -#warning "timer_common_f24.h should not be included directly, only via timer.h" -#endif -/** @endcond */ - diff --git a/include/libopencm3/stm32/f0/timer.h b/include/libopencm3/stm32/f0/timer.h index 5f59816c..2f5aea27 100644 --- a/include/libopencm3/stm32/f0/timer.h +++ b/include/libopencm3/stm32/f0/timer.h @@ -29,9 +29,6 @@ * along with this library. If not, see . */ -#ifndef LIBOPENCM3_TIMER_H -#define LIBOPENCM3_TIMER_H +#pragma once #include - -#endif diff --git a/include/libopencm3/stm32/f1/timer.h b/include/libopencm3/stm32/f1/timer.h index 6046d792..018c9c2e 100644 --- a/include/libopencm3/stm32/f1/timer.h +++ b/include/libopencm3/stm32/f1/timer.h @@ -32,8 +32,7 @@ LGPL License Terms @ref lgpl_license * along with this library. If not, see . */ -#ifndef LIBOPENCM3_TIMER_H -#define LIBOPENCM3_TIMER_H +#pragma once #include @@ -52,5 +51,3 @@ void timer_ic_set_polarity(uint32_t timer, enum tim_ic_pol pol); END_DECLS - -#endif diff --git a/include/libopencm3/stm32/f2/timer.h b/include/libopencm3/stm32/f2/timer.h index 7dc6d326..ad88dcff 100644 --- a/include/libopencm3/stm32/f2/timer.h +++ b/include/libopencm3/stm32/f2/timer.h @@ -31,9 +31,5 @@ LGPL License Terms @ref lgpl_license * along with this library. If not, see . */ -#ifndef LIBOPENCM3_TIMER_H -#define LIBOPENCM3_TIMER_H - +#pragma once #include - -#endif diff --git a/include/libopencm3/stm32/f3/timer.h b/include/libopencm3/stm32/f3/timer.h index f9284c7e..1201ec83 100644 --- a/include/libopencm3/stm32/f3/timer.h +++ b/include/libopencm3/stm32/f3/timer.h @@ -31,9 +31,5 @@ * along with this library. If not, see . */ -#ifndef LIBOPENCM3_TIMER_H -#define LIBOPENCM3_TIMER_H - +#pragma once #include - -#endif diff --git a/include/libopencm3/stm32/f4/timer.h b/include/libopencm3/stm32/f4/timer.h index 604a83f3..1155e8ed 100644 --- a/include/libopencm3/stm32/f4/timer.h +++ b/include/libopencm3/stm32/f4/timer.h @@ -31,9 +31,5 @@ LGPL License Terms @ref lgpl_license * along with this library. If not, see . */ -#ifndef LIBOPENCM3_TIMER_H -#define LIBOPENCM3_TIMER_H - +#pragma once #include - -#endif diff --git a/include/libopencm3/stm32/f7/timer.h b/include/libopencm3/stm32/f7/timer.h index da890943..0ebd4a4b 100644 --- a/include/libopencm3/stm32/f7/timer.h +++ b/include/libopencm3/stm32/f7/timer.h @@ -30,13 +30,5 @@ LGPL License Terms @ref lgpl_license * along with this library. If not, see . */ -#ifndef LIBOPENCM3_TIMER_H -#define LIBOPENCM3_TIMER_H - +#pragma once #include - -BEGIN_DECLS - -END_DECLS - -#endif diff --git a/include/libopencm3/stm32/g0/dmamux.h b/include/libopencm3/stm32/g0/dmamux.h index 27775344..6306d656 100644 --- a/include/libopencm3/stm32/g0/dmamux.h +++ b/include/libopencm3/stm32/g0/dmamux.h @@ -29,8 +29,7 @@ * along with this library. If not, see . */ -#ifndef LIBOPENCM3_DMAMUX_H -#define LIBOPENCM3_DMAMUX_H +#pragma once /**@{*/ #include @@ -169,4 +168,3 @@ /**@}*/ /**@}*/ -#endif diff --git a/include/libopencm3/stm32/g0/timer.h b/include/libopencm3/stm32/g0/timer.h index 1f102ba8..0b4dd226 100644 --- a/include/libopencm3/stm32/g0/timer.h +++ b/include/libopencm3/stm32/g0/timer.h @@ -27,9 +27,7 @@ * along with this library. If not, see . */ -#ifndef LIBOPENCM3_TIMER_H -#define LIBOPENCM3_TIMER_H - +#pragma once #include /**@{*/ @@ -70,5 +68,3 @@ BEGIN_DECLS END_DECLS /**@}*/ - -#endif diff --git a/include/libopencm3/stm32/g4/timer.h b/include/libopencm3/stm32/g4/timer.h index 06a661c7..3cf831f6 100644 --- a/include/libopencm3/stm32/g4/timer.h +++ b/include/libopencm3/stm32/g4/timer.h @@ -27,9 +27,5 @@ * along with this library. If not, see . */ -#ifndef LIBOPENCM3_TIMER_H -#define LIBOPENCM3_TIMER_H - +#pragma once #include - -#endif diff --git a/include/libopencm3/stm32/h7/timer.h b/include/libopencm3/stm32/h7/timer.h index 62a636a4..049cb49c 100644 --- a/include/libopencm3/stm32/h7/timer.h +++ b/include/libopencm3/stm32/h7/timer.h @@ -21,13 +21,5 @@ LGPL License Terms @ref lgpl_license * along with this library. If not, see . */ -#ifndef LIBOPENCM3_TIMER_H -#define LIBOPENCM3_TIMER_H - +#pragma once #include - -BEGIN_DECLS - -END_DECLS - -#endif diff --git a/include/libopencm3/stm32/l0/timer.h b/include/libopencm3/stm32/l0/timer.h index 1c6eb524..5e77059d 100644 --- a/include/libopencm3/stm32/l0/timer.h +++ b/include/libopencm3/stm32/l0/timer.h @@ -33,7 +33,6 @@ LGPL License Terms @ref lgpl_license */ #pragma once - #include /**@{*/ @@ -96,4 +95,3 @@ LGPL License Terms @ref lgpl_license #define TIM22_OR_TI1_RMP_COMP1_OUT (2 << TIM22_OR_TI1_RMP_SHIFT) /**@}*/ - diff --git a/include/libopencm3/stm32/l1/timer.h b/include/libopencm3/stm32/l1/timer.h index faef4346..fe1c0893 100644 --- a/include/libopencm3/stm32/l1/timer.h +++ b/include/libopencm3/stm32/l1/timer.h @@ -32,9 +32,7 @@ LGPL License Terms @ref lgpl_license * along with this library. If not, see . */ -#ifndef LIBOPENCM3_TIMER_H -#define LIBOPENCM3_TIMER_H - +#pragma once #include /**@{*/ @@ -84,5 +82,3 @@ void timer_set_option(uint32_t timer_peripheral, uint32_t option); END_DECLS /**@}*/ - -#endif diff --git a/include/libopencm3/stm32/l4/timer.h b/include/libopencm3/stm32/l4/timer.h index 355c1ca1..2486172b 100644 --- a/include/libopencm3/stm32/l4/timer.h +++ b/include/libopencm3/stm32/l4/timer.h @@ -32,13 +32,5 @@ LGPL License Terms @ref lgpl_license * along with this library. If not, see . */ -#ifndef LIBOPENCM3_TIMER_H -#define LIBOPENCM3_TIMER_H - +#pragma once #include - -BEGIN_DECLS - -END_DECLS - -#endif