diff options
author | 3gg <3gg@shellblade.net> | 2024-09-16 08:50:50 -0700 |
---|---|---|
committer | 3gg <3gg@shellblade.net> | 2024-09-16 08:50:50 -0700 |
commit | b540364f3842fe6ea41a908c905e12e4458e4fef (patch) | |
tree | c33cb2f37af0901091306c97f5164b18fe297221 | |
parent | 448343bc6f092e0dd08591d97007034533fb473b (diff) |
Fix warnings.
-rw-r--r-- | cassert/CMakeLists.txt | 4 | ||||
-rw-r--r-- | cassert/include/cassert.h | 17 | ||||
-rw-r--r-- | log/CMakeLists.txt | 6 | ||||
-rw-r--r-- | log/include/log/log.h | 23 |
4 files changed, 20 insertions, 30 deletions
diff --git a/cassert/CMakeLists.txt b/cassert/CMakeLists.txt index 13e5560..fedb082 100644 --- a/cassert/CMakeLists.txt +++ b/cassert/CMakeLists.txt | |||
@@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.5) | |||
2 | 2 | ||
3 | project(cassert) | 3 | project(cassert) |
4 | 4 | ||
5 | set(CMAKE_C_STANDARD 23) | ||
6 | set(CMAKE_C_STANDARD_REQUIRED On) | ||
7 | set(CMAKE_C_EXTENSIONS Off) | ||
8 | |||
5 | add_library(cassert INTERFACE) | 9 | add_library(cassert INTERFACE) |
6 | 10 | ||
7 | target_include_directories(cassert INTERFACE | 11 | target_include_directories(cassert INTERFACE |
diff --git a/cassert/include/cassert.h b/cassert/include/cassert.h index bb98f50..590f684 100644 --- a/cassert/include/cassert.h +++ b/cassert/include/cassert.h | |||
@@ -6,18 +6,11 @@ | |||
6 | // Allow the client to define their own LOGE() macro. | 6 | // Allow the client to define their own LOGE() macro. |
7 | #ifndef LOGE | 7 | #ifndef LOGE |
8 | #include <stdio.h> | 8 | #include <stdio.h> |
9 | // __VA_OPT__ is not available until C2X. | 9 | #define LOGE(...) \ |
10 | /*#define LOGE(format, ...) \ | 10 | { \ |
11 | { \ | 11 | fprintf(stderr, "[ASSERT] %s:%d", __FILE__, __LINE__); \ |
12 | fprintf( \ | 12 | fprintf(stderr, " " __VA_ARGS__); \ |
13 | stderr, "[ASSERT] %s:%d " format "\n", __FILE__, \ | 13 | fprintf(stderr, "\n"); \ |
14 | __LINE__ __VA_OPT__(, ) __VA_ARGS__); \ | ||
15 | }*/ | ||
16 | #define LOGE(...) \ | ||
17 | { \ | ||
18 | fprintf(stderr, "[ASSERT] %s:%d ", __FILE__, __LINE__); \ | ||
19 | fprintf(stderr, __VA_ARGS__); \ | ||
20 | fprintf(stderr, "\n"); \ | ||
21 | } | 14 | } |
22 | #endif // LOGE | 15 | #endif // LOGE |
23 | 16 | ||
diff --git a/log/CMakeLists.txt b/log/CMakeLists.txt index cc103c5..615e200 100644 --- a/log/CMakeLists.txt +++ b/log/CMakeLists.txt | |||
@@ -1,5 +1,11 @@ | |||
1 | cmake_minimum_required(VERSION 3.5) | 1 | cmake_minimum_required(VERSION 3.5) |
2 | 2 | ||
3 | project(log) | ||
4 | |||
5 | set(CMAKE_C_STANDARD 23) | ||
6 | set(CMAKE_C_STANDARD_REQUIRED On) | ||
7 | set(CMAKE_C_EXTENSIONS Off) | ||
8 | |||
3 | add_library(log | 9 | add_library(log |
4 | src/log.c) | 10 | src/log.c) |
5 | 11 | ||
diff --git a/log/include/log/log.h b/log/include/log/log.h index c660881..f94ba84 100644 --- a/log/include/log/log.h +++ b/log/include/log/log.h | |||
@@ -10,24 +10,11 @@ | |||
10 | #undef LOGW | 10 | #undef LOGW |
11 | #undef LOGE | 11 | #undef LOGE |
12 | 12 | ||
13 | // __VA_OPT__ is not available until C2X. | 13 | #define LOG(channel, tag, ...) \ |
14 | /*#define LOG(channel, tag, format, ...) \ | 14 | { \ |
15 | { \ | 15 | fprintf(channel, "[%s] %s:%d", #tag, __FILE__, __LINE__); \ |
16 | fprintf( \ | 16 | fprintf(channel, " " __VA_ARGS__); \ |
17 | channel, "[%s] %s:%d " format "\n", #tag, __FILE__, \ | 17 | fprintf(channel, "\n"); \ |
18 | __LINE__ __VA_OPT__(, ) __VA_ARGS__); \ | ||
19 | }*/ | ||
20 | |||
21 | /*#define LOGD(format, ...) LOG(stdout, DEBUG, format, __VA_ARGS__) | ||
22 | #define LOGI(format, ...) LOG(stdout, INFO, format, __VA_ARGS__) | ||
23 | #define LOGW(format, ...) LOG(stdout, WARN, format, __VA_ARGS__) | ||
24 | #define LOGE(format, ...) LOG(stderr, ERROR, format, __VA_ARGS__)*/ | ||
25 | |||
26 | #define LOG(channel, tag, ...) \ | ||
27 | { \ | ||
28 | fprintf(channel, "[%s] %s:%d ", #tag, __FILE__, __LINE__); \ | ||
29 | fprintf(channel, __VA_ARGS__); \ | ||
30 | fprintf(channel, "\n"); \ | ||
31 | } | 18 | } |
32 | 19 | ||
33 | #define LOGD(...) LOG(stdout, DEBUG, __VA_ARGS__) | 20 | #define LOGD(...) LOG(stdout, DEBUG, __VA_ARGS__) |