Skip to content

Commit cb8429f

Browse files
committed
Solved warnings, trying to mto make windows work.
1 parent e804bef commit cb8429f

File tree

15 files changed

+192
-265
lines changed

15 files changed

+192
-265
lines changed

cmake/Warnings.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ if(WARNINGS_ENABLED)
4646

4747
# Define C compiler warning flags
4848
if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang")
49+
# TODO: Uncomment the rest of the warnings, enable Weverything for clang
4950
add_compile_options(-Wall)
5051
add_compile_options(-Wextra)
5152
add_compile_options(-Wunused)
@@ -85,7 +86,7 @@ if(WARNINGS_ENABLED)
8586
string(REPLACE "/W1" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
8687
string(REPLACE "/W2" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
8788
string(REPLACE "/W3" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
88-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4 /Wall")
89+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") # /Wall
8990
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CTR_NONSTDC_NO_WARNINGS=1")
9091
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CTR_SECURE_NO_WARNINGS=1")
9192
set(WARNINGS_C_AVAILABLE 1)
@@ -105,7 +106,7 @@ if(WARNINGS_ENABLED)
105106
string(REPLACE "/W1" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
106107
string(REPLACE "/W2" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
107108
string(REPLACE "/W3" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
108-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /Wall")
109+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") # /Wall
109110
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D _CTR_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1")
110111
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D _CTR_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT=1")
111112
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D _CTR_NONSTDC_NO_WARNINGS=1")

source/adt/source/adt_map.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ vector map_get(map m, map_key key)
239239
{
240240
if (m != NULL && key != NULL)
241241
{
242-
map_hash hash = m->hash_cb(key);
242+
map_hash h = m->hash_cb(key);
243243

244-
size_t index = hash % m->capacity;
244+
size_t index = h % m->capacity;
245245

246246
bucket b = &m->buckets[index];
247247

@@ -255,9 +255,9 @@ int map_contains(map m, map_key key)
255255
{
256256
if (m != NULL && key != NULL)
257257
{
258-
map_hash hash = m->hash_cb(key);
258+
map_hash h = m->hash_cb(key);
259259

260-
size_t index = hash % m->capacity;
260+
size_t index = h % m->capacity;
261261

262262
bucket b = &m->buckets[index];
263263

source/adt/source/adt_set.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,9 @@ set_value set_get(set s, set_key key)
256256
{
257257
if (s != NULL && key != NULL)
258258
{
259-
set_hash hash = s->hash_cb(key);
259+
set_hash h = s->hash_cb(key);
260260

261-
size_t index = hash % s->capacity;
261+
size_t index = h % s->capacity;
262262

263263
bucket b = &s->buckets[index];
264264

@@ -277,9 +277,9 @@ int set_contains(set s, set_key key)
277277
{
278278
if (s != NULL && key != NULL)
279279
{
280-
set_hash hash = s->hash_cb(key);
280+
set_hash h = s->hash_cb(key);
281281

282-
size_t index = hash % s->capacity;
282+
size_t index = h % s->capacity;
283283

284284
bucket b = &s->buckets[index];
285285

source/dynlink/source/dynlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ int dynlink_library_path(const char *name, dynlink_path path, size_t *length)
240240

241241
dynlink_impl_get_name(name, name_impl, PORTABILITY_PATH_SIZE);
242242

243-
if (portability_library_path(name_impl, path, length) != 0)
243+
if (portability_library_path_find(name_impl, path, length) != 0)
244244
{
245245
return 1;
246246
}

source/loader/source/loader_host.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ union loader_host_invoke_cast
4444

4545
static value function_host_interface_invoke(function func, function_impl func_impl, function_args args, size_t size);
4646

47-
static function_return function_host_interface_await(function func, function_impl impl, function_args args, size_t size, function_resolve_callback resolve_callback, function_reject_callback reject_callback, void *context);
47+
static function_return function_host_interface_await(function func, function_impl impl, function_args args, size_t size, function_resolve_callback resolve_callback, function_reject_callback reject_callback, void *ctx);
4848

4949
static function_interface function_host_singleton(void);
5050

@@ -64,7 +64,7 @@ function_return function_host_interface_invoke(function func, function_impl func
6464
return invoke_cast.fn(size, args, data);
6565
}
6666

67-
function_return function_host_interface_await(function func, function_impl impl, function_args args, size_t size, function_resolve_callback resolve_callback, function_reject_callback reject_callback, void *context)
67+
function_return function_host_interface_await(function func, function_impl impl, function_args args, size_t size, function_resolve_callback resolve_callback, function_reject_callback reject_callback, void *ctx)
6868
{
6969
/* TODO */
7070

@@ -74,7 +74,7 @@ function_return function_host_interface_await(function func, function_impl impl,
7474
(void)size;
7575
(void)resolve_callback;
7676
(void)reject_callback;
77-
(void)context;
77+
(void)ctx;
7878

7979
return NULL;
8080
}

source/loader/source/loader_impl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
#include <configuration/configuration.h>
3838

39-
#include <portability/portability_dependency.h>
39+
#include <portability/portability_library_path.h>
4040

4141
#include <stdlib.h>
4242
#include <string.h>
@@ -457,7 +457,7 @@ int loader_impl_dependencies(loader_impl impl, detour d)
457457
return 1;
458458
}
459459

460-
if (portability_dependendency_iterate(&loader_impl_dependencies_self_list, (void *)dependencies_self) != 0)
460+
if (portability_library_path_list(&loader_impl_dependencies_self_list, (void *)dependencies_self) != 0)
461461
{
462462
vector_destroy(dependencies_self);
463463
return 1;

source/loaders/node_loader/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,9 @@ target_link_libraries(${target}
178178
PRIVATE
179179
${META_PROJECT_NAME}::metacall # MetaCall library
180180

181-
# Delay load for MSVC
182-
$<$<CXX_COMPILER_ID:MSVC>:libnode2>
183-
$<$<CXX_COMPILER_ID:MSVC>:delayimp>
181+
# Delay load for MSVC
182+
$<$<CXX_COMPILER_ID:MSVC>:${NodeJS_LIBRARY}> # NodeJS library
183+
$<$<CXX_COMPILER_ID:MSVC>:delayimp>
184184

185185
PUBLIC
186186
${DEFAULT_LIBRARIES}

source/loaders/node_loader/source/node_loader_impl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ extern char **environ;
4949
#include <node_loader/node_loader_trampoline.h>
5050

5151
#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER >= 1200)
52-
#include <node_loader/node_loader_win32_delay_load.h>
52+
#include <detour/detour.h>
5353

5454
/* Required for the DelayLoad hook interposition, solves bug of NodeJS extensions requiring node.exe instead of node.dll*/
5555
#include <intrin.h>
@@ -3701,7 +3701,7 @@ void *node_loader_impl_register(void *node_impl_ptr, void *env_ptr, void *functi
37013701
/* As the library handle is correctly resolved here, either to executable, library of the executable,
37023702
or the loader dependency we can directly obtain the handle of this dependency from a function pointer,
37033703
use any function that is contained in node runtime, in this case we are using napi_create_array */
3704-
if (!GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT | GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, &napi_create_array, &node_loader_node_dll_handle))
3704+
if (!GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT | GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCSTR)&napi_create_array, &node_loader_node_dll_handle))
37053705
{
37063706
napi_throw_type_error(env, nullptr, "Failed to initialize the hooking against node extensions load mechanism");
37073707
}

source/plugin/source/plugin_manager.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ int plugin_manager_initialize(plugin_manager manager, const char *name, const ch
105105
/* Initialize the library path */
106106
if (manager->library_path == NULL)
107107
{
108-
const char name[] = "metacall"
108+
const char library_name[] = "metacall"
109109
#if (!defined(NDEBUG) || defined(DEBUG) || defined(_DEBUG) || defined(__DEBUG) || defined(__DEBUG__))
110-
"d"
110+
"d"
111111
#endif
112112
;
113113

@@ -119,7 +119,7 @@ int plugin_manager_initialize(plugin_manager manager, const char *name, const ch
119119
* 2) Dynamic link library path of the host library
120120
* 3) Default compile time path
121121
*/
122-
if (dynlink_library_path(name, path, &length) == 0)
122+
if (dynlink_library_path(library_name, path, &length) == 0)
123123
{
124124
default_library_path = path;
125125
}

source/portability/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ set(headers
4141
${include_path}/portability_working_path.h
4242
${include_path}/portability_path.h
4343
${include_path}/portability_atexit.h
44-
${include_path}/portability_dependency.h
4544
)
4645

4746
set(sources
@@ -51,7 +50,6 @@ set(sources
5150
${source_path}/portability_working_path.c
5251
${source_path}/portability_path.c
5352
${source_path}/portability_atexit.c
54-
${source_path}/portability_dependency.c
5553
)
5654

5755
# Group source files

0 commit comments

Comments
 (0)