Skip to content

Commit c0b76ca

Browse files
committed
Add include guards to header files and update Makefiles
Replaced #pragma once with explicit include guards in all header files for consistency and portability. Renamed and reorganized several headers for better structure. Refactored Makefile logic to remove Extra.mk, add CppOps.mk and Timestamp.mk, and centralize object file generation in lib/Objects.mk. Updated Makefiles to use new includes and improved build directory handling.
1 parent 57d7d78 commit c0b76ca

190 files changed

Lines changed: 1531 additions & 812 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

common/include/common/firmware/jamstapl/handleroled.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#pragma once
1+
#ifndef COMMON_FIRMWARE_JAMSTAPL_HANDLEROLED_H_
2+
#define COMMON_FIRMWARE_JAMSTAPL_HANDLEROLED_H_
3+
24
/**
35
* @file handleroled.h
46
*
@@ -50,3 +52,5 @@ struct HandlerOled : public JamSTAPLDisplay
5052
private:
5153
inline static HandlerOled* s_this;
5254
};
55+
56+
#endif // COMMON_FIRMWARE_JAMSTAPL_HANDLEROLED_H_

common/include/common/firmware/pixeldmx/show.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#pragma once
1+
#ifndef COMMON_FIRMWARE_PIXELDMX_SHOW_H_
2+
#define COMMON_FIRMWARE_PIXELDMX_SHOW_H_
3+
24
/*
35
* display.h
46
*
@@ -49,4 +51,6 @@ inline void Show(uint32_t line, pixelpatterns::Pattern pattern = pixelpatterns::
4951
display->Printf(6, "%s:%u", PixelPatterns::GetName(pattern), static_cast<uint32_t>(pattern));
5052
}
5153
}
52-
} // namespace common::firmware::pixeldmx
54+
} // namespace common::firmware::pixeldmx
55+
56+
#endif // COMMON_FIRMWARE_PIXELDMX_SHOW_H_

common/include/common/utils/utils_array.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#pragma once
1+
#ifndef COMMON_UTILS_UTILS_ARRAY_H_
2+
#define COMMON_UTILS_UTILS_ARRAY_H_
3+
24
/**
35
* @file utils_array.h
46
*
@@ -33,3 +35,5 @@ template <typename T, size_t N> constexpr size_t ArraySize(const T (&)[N]) noexc
3335
return N;
3436
}
3537
} // namespace common
38+
39+
#endif // COMMON_UTILS_UTILS_ARRAY_H_

common/include/common/utils/utils_enum.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#pragma once
1+
#ifndef COMMON_UTILS_UTILS_ENUM_H_
2+
#define COMMON_UTILS_UTILS_ENUM_H_
3+
24
/**
35
* @file utils_enum.h
46
*
@@ -42,3 +44,5 @@ inline Enum FromValue(std::underlying_type_t<Enum> value) noexcept {
4244
}
4345

4446
} // namespace common
47+
48+
#endif // COMMON_UTILS_UTILS_ENUM_H_

common/include/common/utils/utils_flags.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#pragma once
1+
#ifndef COMMON_UTILS_UTILS_FLAGS_H_
2+
#define COMMON_UTILS_UTILS_FLAGS_H_
3+
24
/**
35
* @file utils_flags.h
46
* Generic enum class bitmask helpers (C++20, freestanding-safe, Google Style)
@@ -103,4 +105,6 @@ constexpr bool IsFlagSet(uint32_t flags, E bit) {
103105
return (flags & ToValue(bit)) != 0;
104106
}
105107

106-
} // namespace common
108+
} // namespace common
109+
110+
#endif // COMMON_UTILS_UTILS_FLAGS_H_
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#pragma once
1+
#ifndef COMMON_UTILS_UTILS_HASH_H_
2+
#define COMMON_UTILS_UTILS_HASH_H_
3+
24
/**
35
* @file hash.h
46
*
@@ -49,3 +51,5 @@ inline uint32_t Fnv1a32Runtime(const char* str, uint32_t length)
4951
}
5052
return hash;
5153
}
54+
55+
#endif // COMMON_UTILS_UTILS_HASH_H_

common/include/common/utils/utils_hex.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#pragma once
1+
#ifndef COMMON_UTILS_UTILS_HEX_H_
2+
#define COMMON_UTILS_UTILS_HEX_H_
3+
24
/**
35
* @file utils_hex.h
46
*
@@ -111,3 +113,5 @@ template <size_t N> constexpr uint32_t FromHex(const char (&string)[N])
111113
}
112114

113115
} // namespace common::hex
116+
117+
#endif // COMMON_UTILS_UTILS_HEX_H_

common/include/dmx/board_gd32f303rc.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#pragma once
1+
#ifndef DMX_BOARD_GD32F303RC_H_
2+
#define DMX_BOARD_GD32F303RC_H_
3+
24
/**
35
* @file board_gd32f303rc.h
46
*
@@ -40,3 +42,5 @@ static constexpr auto USART2_PORT = 0;
4042

4143
static constexpr auto DIR_PORT_0_GPIO_PORT = GPIOB;
4244
static constexpr auto DIR_PORT_0_GPIO_PIN = GPIO_PIN_10;
45+
46+
#endif // DMX_BOARD_GD32F303RC_H_

common/include/dmx/dmx_config.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#pragma once
1+
#ifndef DMX_DMX_CONFIG_H_
2+
#define DMX_DMX_CONFIG_H_
3+
24
/**
35
* @file dmx_config.h
46
*
@@ -65,3 +67,5 @@ static constexpr auto SIZE = 516; // multiple of uint32_t
6567
} // namespace dmx::buffer
6668

6769
#include "gd32/dmx_dma_check.h"
70+
71+
#endif // DMX_DMX_CONFIG_H_
Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#pragma once
1+
#ifndef JSON_JSON_FORMAT_HELPERS_H_
2+
#define JSON_JSON_FORMAT_HELPERS_H_
3+
24
/**
35
* @file format_helpers.h
46
*
@@ -27,21 +29,11 @@
2729
#include <cstdio>
2830
#include <cstdint>
2931

30-
#include "net/ip4_address.h"
31-
3232
namespace format
3333
{
34-
35-
constexpr size_t kIpBufferSize = 18; // For "255.255.255.255" + null
3634
constexpr size_t kFloatBufferSize = 8; // For "%.2f", "%.1f"
3735
constexpr size_t kOffsetBufferSize = 12; // For timezone offsets e.g. "+01:00"
3836

39-
[[nodiscard]] inline const char* FormatIp(uint32_t ip, char (&buf)[kIpBufferSize])
40-
{
41-
snprintf(buf, sizeof(buf) - 1, IPSTR, IP2STR(ip));
42-
return buf;
43-
}
44-
4537
[[nodiscard]] inline const char* FormatFloat(float value, char (&buf)[kFloatBufferSize], const char* fmt = "%.2f")
4638
{
4739
snprintf(buf, sizeof(buf) - 1, fmt, value);
@@ -62,3 +54,5 @@ constexpr size_t kOffsetBufferSize = 12; // For timezone offsets e.g. "+01:00"
6254
}
6355

6456
} // namespace format
57+
58+
#endif // JSON_JSON_FORMAT_HELPERS_H_

0 commit comments

Comments
 (0)