From 935ca0e340318d5d6e6318036cd7e9e26c49626d Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Fri, 9 Aug 2024 11:45:00 +0200 Subject: [PATCH] improve header guards the following names are reserved to the language implementation: - (C and C++) starting with an underscore and a capital letter - (C++) containing any amount of double underscores https://en.wikipedia.org/wiki/Include_guard#Discussion --- include/ptk.h | 6 +++--- include/ptk_log.h | 6 +++--- include/ptk_vec.h | 4 ++-- src/ptk_list.h | 6 +++--- src/ptk_option.h | 6 +++--- src/ptk_vk/components.h | 6 +++--- src/ptk_vk/draw.h | 6 +++--- src/ptk_vk/init.h | 6 +++--- src/ptk_vk/utils.h | 6 +++--- test/test.h | 5 ++++- 10 files changed, 30 insertions(+), 27 deletions(-) diff --git a/include/ptk.h b/include/ptk.h index cc4dbef..36fe213 100644 --- a/include/ptk.h +++ b/include/ptk.h @@ -1,5 +1,5 @@ -#ifndef _PTK_PTK_H -#define _PTK_PTK_H +#ifndef PTK_PTK_H_ +#define PTK_PTK_H_ #include @@ -66,4 +66,4 @@ PtkHandle ptk_circle(PtkPos center, float radius, PtkColor color); int ptk_run(PtkHandle root); -#endif // _PTK_PTK_H +#endif // PTK_PTK_H_ diff --git a/include/ptk_log.h b/include/ptk_log.h index 807a1cf..df94d78 100644 --- a/include/ptk_log.h +++ b/include/ptk_log.h @@ -1,5 +1,5 @@ -#ifndef _PTK_PTK_LOG_H -#define _PTK_PTK_LOG_H +#ifndef PTK_PTK_LOG_H_ +#define PTK_PTK_LOG_H_ #include #include @@ -32,4 +32,4 @@ void ptk_trace(const char *file, int line, const char *fmt, ...); #define PTK_DEBUG(...) ptk_debug(__FILE__, __LINE__, __VA_ARGS__) #define PTK_TRACE(...) ptk_trace(__FILE__, __LINE__, __VA_ARGS__) -#endif // _PTK_PTK_LOG_H +#endif // PTK_PTK_LOG_H_ diff --git a/include/ptk_vec.h b/include/ptk_vec.h index 8c1ec8d..d63684d 100644 --- a/include/ptk_vec.h +++ b/include/ptk_vec.h @@ -1,5 +1,5 @@ -#ifndef _PTK_PTK_VEC_H -#define _PTK_PTK_VEC_H +#ifndef PTK_PTK_VEC_H_ +#define PTK_PTK_VEC_H_ typedef union { struct { // PtkVec2, PtkPos diff --git a/src/ptk_list.h b/src/ptk_list.h index 1d81472..9fde387 100644 --- a/src/ptk_list.h +++ b/src/ptk_list.h @@ -1,5 +1,5 @@ -#ifndef _PTK_PTK_LIST_H -#define _PTK_PTK_LIST_H +#ifndef PTK_PTK_LIST_H_ +#define PTK_PTK_LIST_H_ #include #include @@ -58,4 +58,4 @@ PTK_LIST_DEFINE(char); #define PTK_STRING_FREE(str) PTK_LIST_FREE(str) -#endif // _PTK_PTK_LIST_H +#endif // PTK_PTK_LIST_H_ diff --git a/src/ptk_option.h b/src/ptk_option.h index 01b6b70..1e42389 100644 --- a/src/ptk_option.h +++ b/src/ptk_option.h @@ -1,5 +1,5 @@ -#ifndef _PTK_PTK_OPTION_H -#define _PTK_PTK_OPTION_H +#ifndef PTK_PTK_OPTION_H_ +#define PTK_PTK_OPTION_H_ #include @@ -23,4 +23,4 @@ .exists = false,\ } -#endif // _PTK_PTK_OPTION_H +#endif // PTK_PTK_OPTION_H_ diff --git a/src/ptk_vk/components.h b/src/ptk_vk/components.h index 4b7c78b..2f0430d 100644 --- a/src/ptk_vk/components.h +++ b/src/ptk_vk/components.h @@ -1,5 +1,5 @@ -#ifndef _PTK_PTK_VK_COMPONENTS_H -#define _PTK_PTK_VK_COMPONENTS_H +#ifndef PTK_PTK_VK_COMPONENTS_H_ +#define PTK_PTK_VK_COMPONENTS_H_ #include #include @@ -23,4 +23,4 @@ void vk_ellipse(PtkEllipse *ellipse); void vk_components_cleanup(void); -#endif // _PTK_PTK_VK_COMPONENTS_H +#endif // PTK_PTK_VK_COMPONENTS_H_ diff --git a/src/ptk_vk/draw.h b/src/ptk_vk/draw.h index 7edb524..f1f824e 100644 --- a/src/ptk_vk/draw.h +++ b/src/ptk_vk/draw.h @@ -1,5 +1,5 @@ -#ifndef _PTK_PTK_VK_DRAW_H -#define _PTK_PTK_VK_DRAW_H +#ifndef PTK_PTK_VK_DRAW_H_ +#define PTK_PTK_VK_DRAW_H_ #include #include @@ -9,4 +9,4 @@ extern uint32_t g_current_frame; bool vk_draw_frame(void); -#endif // _PTK_PTK_VK_DRAW_H +#endif // PTK_PTK_VK_DRAW_H_ diff --git a/src/ptk_vk/init.h b/src/ptk_vk/init.h index 347c334..3e3844a 100644 --- a/src/ptk_vk/init.h +++ b/src/ptk_vk/init.h @@ -1,5 +1,5 @@ -#ifndef _PTK_PTK_VK_INIT_H -#define _PTK_PTK_VK_INIT_H +#ifndef PTK_PTK_VK_INIT_H_ +#define PTK_PTK_VK_INIT_H_ #ifndef GLFW_INCLUDE_VULKAN #define GLFW_INCLUDE_VULKAN @@ -38,4 +38,4 @@ bool vk_update_uniform_buffer(size_t current_frame); void vk_cleanup(void); -#endif // _PTK_PTK_VK_INIT_H +#endif // PTK_PTK_VK_INIT_H_ diff --git a/src/ptk_vk/utils.h b/src/ptk_vk/utils.h index baf79c0..b2a7836 100644 --- a/src/ptk_vk/utils.h +++ b/src/ptk_vk/utils.h @@ -1,5 +1,5 @@ -#ifndef _PTK_PTK_VK_UTILS_H -#define _PTK_PTK_VK_UTILS_H +#ifndef PTK_PTK_VK_UTILS_H_ +#define PTK_PTK_VK_UTILS_H_ #include #include @@ -14,4 +14,4 @@ const char *vk_result_string(VkResult res); }\ } while (0) -#endif // _PTK_PTK_VK_UTILS_H +#endif // PTK_PTK_VK_UTILS_H_ diff --git a/test/test.h b/test/test.h index 39465e6..9a192a8 100644 --- a/test/test.h +++ b/test/test.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef TEST_TEST_H_ +#define TEST_TEST_H_ #include #include @@ -48,3 +49,5 @@ tests_failed += 1;\ }\ } while (0) + +#endif // TEST_TEST_H_