Skip to content

Commit 660d9fc

Browse files
committed
Remove unused values and functions in LibCN
1 parent b95cc71 commit 660d9fc

File tree

7 files changed

+7
-22
lines changed

7 files changed

+7
-22
lines changed

.github/workflows/style.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
9797
- name: Check Clang warnings
9898
run: |
99-
find runtime/libcn/ -iname '*.c' | xargs clang-19 -I runtime/libcn/include/ -fsyntax-only -Werror
99+
find runtime/libcn/ -iname '*.c' | xargs clang-19 -I runtime/libcn/include/ -fsyntax-only -Werror -Wall
100100
101101
gcc-warnings:
102102
name: GCC warnings
@@ -115,7 +115,7 @@ jobs:
115115
116116
- name: Check GCC warnings
117117
run: |
118-
find runtime/libcn/ -iname '*.c' | xargs gcc -I runtime/libcn/include/ -fsyntax-only -Werror
118+
find runtime/libcn/ -iname '*.c' | xargs gcc -I runtime/libcn/include/ -fsyntax-only -Werror -Wall
119119
120120
shellcheck:
121121
name: ShellCheck

runtime/libcn/lib/compile.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
FLAGS=""
44
if [[ -n "${GITHUB_ACTIONS+isset}" ]]; then
5-
FLAGS="-Werror"
5+
FLAGS="-Werror -Wall"
66
fi
77

88
cc ${FLAGS} -I ../../include/ -c -g "$@"

runtime/libcn/src/cn-executable/alloc.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,6 @@ static inline uint32_t fl_offset(block_header* fl) {
248248
return (uintptr_t)fl - (uintptr_t)block_list;
249249
}
250250

251-
static inline free_block_header* fl_by_offset(uint32_t offset) {
252-
return (free_block_header*)((uintptr_t)block_list + offset);
253-
}
254-
255251
static inline free_block_header* fl_next_free_node(free_block_header* fl) {
256252
if (fl->next > MAX_BLOCK_INDEX) {
257253
return NULL;

runtime/libcn/src/cn-executable/utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ void dump_ownership_state() {
291291
hash_table_iterator it = ht_iterator(cn_ownership_global_ghost_state);
292292
// cn_printf(CN_LOGGING_INFO, "BEGIN ownership state\n");
293293
while (ht_next(&it)) {
294-
int depth = it.value ? *(int*)it.value : -1;
294+
// int depth = it.value ? *(int*)it.value : -1;
295295
// cn_printf(CN_LOGGING_INFO, "[%#lx] => depth: %d\n", *it.key, depth);
296296
}
297297
// cn_printf(CN_LOGGING_INFO, "END\n");

runtime/libcn/src/cn-testing/alloc.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,6 @@ int cn_gen_ownership_check(void* p, size_t sz) {
186186
return 1;
187187
}
188188

189-
int bytes = sz;
190-
191189
struct pointer_data* q =
192190
(struct pointer_data*)((uintptr_t)ownership_curr - sizeof(struct pointer_data));
193191
for (; (uintptr_t)q >= (uintptr_t)ownership_buf; q--) {

runtime/libcn/src/cn-testing/rand.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ void cn_gen_shuffle(void* arr, size_t len, size_t size) {
293293
// byte size is implementation-defined (6.5.3.4, bullet 2)
294294
// but `sizeof(char) == 1` is guaranteed.
295295
char tmp[size];
296-
char* p = arr;
297296

298297
for (int i = len - 1; i >= 0; i--) {
299298
uint8_t j = cn_gen_range_u8(0, i + 1);
@@ -303,17 +302,6 @@ void cn_gen_shuffle(void* arr, size_t len, size_t size) {
303302
}
304303
}
305304

306-
static int comp_size_t(const void* x, const void* y) {
307-
size_t a = *(const size_t*)x;
308-
size_t b = *(const size_t*)y;
309-
310-
if (a < b)
311-
return -1;
312-
if (b > a)
313-
return 1;
314-
return 0;
315-
}
316-
317305
void cn_gen_split(size_t n, size_t* arr[], size_t len) {
318306
if (len == 1) {
319307
*(arr[0]) = n;

runtime/libcn/src/cn-testing/test.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ size_t cn_gen_compute_size(enum cn_gen_sizing_strategy strategy,
178178
}
179179

180180
return max_size + 1;
181+
182+
default:
183+
assert(false);
181184
}
182185
}
183186

0 commit comments

Comments
 (0)