Skip to content

Commit

Permalink
Warning cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
srdja committed Feb 3, 2024
1 parent ec0c427 commit 573ef53
Show file tree
Hide file tree
Showing 32 changed files with 786 additions and 66 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.15)

set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)

Expand All @@ -8,7 +8,7 @@ if(UNIX)
set(CFLAGS "-Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CFLAGS}")
elseif(MSVC)
set(CFLAGS "/W4")
set(CFLAGS "/W3")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CFLAGS}")
endif()

Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.15)

set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)

Expand Down
2 changes: 1 addition & 1 deletion examples/hashtable/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.15)
project(collectc_hashtable_examples)

include_directories(${PROJECT_SOURCE_DIR}/include ${collectc_INCLUDE_DIRS})
Expand Down
3 changes: 3 additions & 0 deletions examples/hashtable/initialization/configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

int main(int argc, char **argv)
{
(void)argc;
(void)argv;

CC_HashTableConf config;
cc_hashtable_conf_init(&config);

Expand Down
3 changes: 3 additions & 0 deletions examples/hashtable/initialization/custom_key_types.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ int point_compare(const void *key1, const void *key2)

int main(int argc, char **argv)
{
(void)argc;
(void)argv;

/* Define the config structure (for more details check the
configuration example) */
CC_HashTableConf config;
Expand Down
3 changes: 3 additions & 0 deletions examples/hashtable/initialization/pointer_keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ int pointer_equality(const void *k1, const void *k2)

int main(int argc, char **argv)
{
(void)argc;
(void)argv;

/* ************************************************************
Config strcture
************************************************************/
Expand Down
3 changes: 3 additions & 0 deletions examples/hashtable/initialization/string_keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

int main(int argc, char **argv)
{
(void)argc;
(void)argv;

/* Define a new table pointer */
CC_HashTable *string_table;

Expand Down
3 changes: 3 additions & 0 deletions examples/hashtable/operations/adding_key_value_pairs.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

int main(int argc, char **argv)
{
(void)argc;
(void)argv;

/* Make a new string key table */
CC_HashTable *table;
cc_hashtable_new(&table);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

int main(int argc, char **argv)
{
(void)argc;
(void)argv;

// Make a new string key table
CC_HashTable *table;
cc_hashtable_new(&table);
Expand All @@ -21,7 +24,7 @@ int main(int argc, char **argv)
// Size represents the number of key value pairs currently
// stored inside the table.
size_t size = cc_hashtable_size(table);
printf("Table size: %lu\n", size);
printf("Table size: %llu\n", size);

// ************************************************************
// Getting the capacity of the table
Expand All @@ -30,7 +33,7 @@ int main(int argc, char **argv)
// Capacity represents the size of the internal array. (check
// the initialization example for more info).
size_t capacity = cc_hashtable_capacity(table);
printf("Table capacity: %lu\n", capacity);
printf("Table capacity: %llu\n", capacity);

// ************************************************************
// Check if a key is present
Expand Down
3 changes: 3 additions & 0 deletions examples/hashtable/operations/iterating_over_pairs.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

int main(int argc, char **argv)
{
(void)argc;
(void)argv;

CC_HashTable *table;
cc_hashtable_new(&table);

Expand Down
3 changes: 3 additions & 0 deletions examples/hashtable/operations/removing_key_value_pairs.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

int main(int argc, char **argv)
{
(void)argc;
(void)argv;

// Make a new string key table
CC_HashTable *table;
cc_hashtable_new(&table);
Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cmake_minimum_required(VERSION 3.15)

project(collectc VERSION 0.0.1)

file(GLOB source_files "*.c" "sized/*.c" "memory/*.c")
Expand Down
2 changes: 1 addition & 1 deletion src/sized/cc_array_sized.c
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ static enum cc_stat expand_capacity(CC_ArraySized *ar)
return CC_ERR_MAX_CAPACITY;
}

size_t new_capacity = ar->capacity * ar->exp_factor;
size_t new_capacity = (size_t) (ar->capacity * ar->exp_factor);

/* As long as the capacity is greater that the expansion factor
* at the point of overflow, this is check is valid. */
Expand Down
2 changes: 1 addition & 1 deletion test/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.15)

set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)

Expand Down
9 changes: 6 additions & 3 deletions test/benchmark/pool/dpool_bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void bench_malloc()
t_start = clock();

CC_SLIST_FOREACH(v, list, {
(int*)v += 1;
*((int*)v) += 1;
});
t_end = clock();
t_delta = (double)(t_end - t_start)/CLOCKS_PER_SEC;
Expand Down Expand Up @@ -85,7 +85,7 @@ void bench_pool_packed()
t_start = clock();

CC_SLIST_FOREACH(v, list, {
(int*)v += 1;
*((int*)v) += 1;
});
t_end = clock();
t_delta = (double)(t_end - t_start)/CLOCKS_PER_SEC;
Expand Down Expand Up @@ -127,7 +127,7 @@ void bench_pool_aligned()
t_start = clock();

CC_SLIST_FOREACH(v, list, {
(int*)v += 1;
*((int*)v) += 1;
});
t_end = clock();
t_delta = (double)(t_end - t_start)/CLOCKS_PER_SEC;
Expand All @@ -140,6 +140,9 @@ void bench_pool_aligned()

int main(int argc, char** argv)
{
(void)argc;
(void)argv;

bench_pool_aligned();
bench_pool_packed();
bench_malloc();
Expand Down
2 changes: 1 addition & 1 deletion test/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.15)
project(collectc_test)

#find_package(PkgConfig)
Expand Down
Loading

0 comments on commit 573ef53

Please sign in to comment.