cmake: warnings
This commit is contained in:
parent
947117e061
commit
2abd9f5a51
@ -4,7 +4,8 @@ project(cex)
|
|||||||
include(CMakePrintHelpers)
|
include(CMakePrintHelpers)
|
||||||
|
|
||||||
set(CMAKE_C_COMPILER clang)
|
set(CMAKE_C_COMPILER clang)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c17")
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror")
|
||||||
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS true)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS true)
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
typedef int64_t index_t;
|
||||||
|
|
||||||
typedef struct linked_list_node_t {
|
typedef struct linked_list_node_t {
|
||||||
struct linked_list_node_t* prev;
|
struct linked_list_node_t* prev;
|
||||||
struct linked_list_node_t* next;
|
struct linked_list_node_t* next;
|
||||||
@ -14,12 +16,10 @@ typedef struct linked_list_node_t {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
linked_list_node_t* first;
|
linked_list_node_t* first;
|
||||||
size_t length;
|
index_t length;
|
||||||
size_t data_size;
|
size_t data_size;
|
||||||
} linked_list_t;
|
} linked_list_t;
|
||||||
|
|
||||||
typedef int64_t index_t;
|
|
||||||
|
|
||||||
typedef void (*list_iterator_t)(index_t index, void* data, void* arg);
|
typedef void (*list_iterator_t)(index_t index, void* data, void* arg);
|
||||||
typedef bool (*list_filter_t)(index_t index, const void* data, void* arg);
|
typedef bool (*list_filter_t)(index_t index, const void* data, void* arg);
|
||||||
|
|
||||||
@ -45,9 +45,9 @@ void LL_set(linked_list_t* list, index_t index, const void* data);
|
|||||||
void LL_iterate(linked_list_t* list, list_iterator_t func, void* arg);
|
void LL_iterate(linked_list_t* list, list_iterator_t func, void* arg);
|
||||||
void LL_iterate_range(linked_list_t* list, list_iterator_t func, void* arg, index_t from, index_t to);
|
void LL_iterate_range(linked_list_t* list, list_iterator_t func, void* arg, index_t from, index_t to);
|
||||||
|
|
||||||
void LL_ITER_COPY(index_t _, void* data, void* list);
|
void LL_ITER_COPY(index_t, void* data, void* list);
|
||||||
void LL_ITER_SUM(index_t _, void* data, void* result);
|
void LL_ITER_SUM(index_t, void* data, void* result);
|
||||||
void LL_ITER_PRINT(index_t i, void* data, void* _);
|
void LL_ITER_PRINT(index_t i, void* data, void*);
|
||||||
|
|
||||||
linked_list_t LL_filter(linked_list_t* list, list_filter_t func, void* arg);
|
linked_list_t LL_filter(linked_list_t* list, list_filter_t func, void* arg);
|
||||||
linked_list_t LL_filter_range(linked_list_t* list, list_filter_t func, void* arg, index_t from, index_t to);
|
linked_list_t LL_filter_range(linked_list_t* list, list_filter_t func, void* arg, index_t from, index_t to);
|
||||||
|
@ -183,13 +183,16 @@ linked_list_t LL_filter(linked_list_t* list, list_filter_t func, void* arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LL_ITER_COPY(index_t _, void* data, void* list) {
|
void LL_ITER_COPY(index_t _, void* data, void* list) {
|
||||||
|
(void)_;
|
||||||
LL_add_value((linked_list_t*)list, data);
|
LL_add_value((linked_list_t*)list, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LL_ITER_SUM(index_t _, void* data, void* result) {
|
void LL_ITER_SUM(index_t _, void* data, void* result) {
|
||||||
|
(void)_;
|
||||||
*(int64_t*)result += *(int64_t*)data;
|
*(int64_t*)result += *(int64_t*)data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LL_ITER_PRINT(index_t i, void* data, void* _) {
|
void LL_ITER_PRINT(index_t i, void* data, void* _) {
|
||||||
|
(void)_;
|
||||||
printf("#%ld: %ld\n", i, *(int64_t*)data);
|
printf("#%ld: %ld\n", i, *(int64_t*)data);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user