Skip to content

Commit

Permalink
Reduce compiler warnings for -Wall -Wpedantic -Wextra
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Jul 27, 2022
1 parent 8b35532 commit 32a9530
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
13 changes: 10 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,28 @@ target_sources(${PROJECT_NAME} PUBLIC
# Port files
${CMAKE_CURRENT_LIST_DIR}/lwow/src/system/lwow_sys_win32.c
${CMAKE_CURRENT_LIST_DIR}/lwow/src/system/lwow_ll_win32.c
)
)

# Add key include paths
target_include_directories(${PROJECT_NAME} PUBLIC
${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_LIST_DIR}/dev
)
)

# Compilation definition information
target_compile_definitions(${PROJECT_NAME} PUBLIC
WIN32
_DEBUG
CONSOLE
LWOW_DEV
)
)

# Compiler options
target_compile_options(${PROJECT_NAME} PRIVATE
-Wall
-Wextra
-Wpedantic
)

# Add subdir with lwow and link to the project
add_subdirectory("lwow")
Expand Down
6 changes: 5 additions & 1 deletion lwow/src/system/lwow_ll_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ static DCB dcb = { 0 };
static uint8_t
init(void* arg) {
dcb.DCBlength = sizeof(dcb);
LWOW_UNUSED(arg);

/* Open virtual file as read/write */
com_port = CreateFile(L"\\\\.\\COM4",
com_port = CreateFileA("\\\\.\\COM4",
GENERIC_READ | GENERIC_WRITE,
0,
0,
Expand Down Expand Up @@ -108,12 +109,14 @@ init(void* arg) {
uint8_t
deinit(void* arg) {
/* Disable UART peripheral */
LWOW_UNUSED(arg);

return 1;
}

uint8_t
set_baudrate(uint32_t baud, void* arg) {
LWOW_UNUSED(arg);
/* Configure UART to selected baudrate */
dcb.BaudRate = baud;

Expand All @@ -131,6 +134,7 @@ transmit_receive(const uint8_t* tx, uint8_t* rx, size_t len, void* arg) {
/* Perform data exchange */
size_t read = 0;
DWORD br;
LWOW_UNUSED(arg);

if (com_port != NULL) {
/*
Expand Down
4 changes: 4 additions & 0 deletions lwow/src/system/lwow_sys_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,28 @@

uint8_t
lwow_sys_mutex_create(LWOW_CFG_OS_MUTEX_HANDLE* mutex, void* arg) {
LWOW_UNUSED(arg);
*mutex = CreateMutex(NULL, 0, NULL);
return 1;
}

uint8_t
lwow_sys_mutex_delete(LWOW_CFG_OS_MUTEX_HANDLE* mutex, void* arg) {
LWOW_UNUSED(arg);
CloseHandle(*mutex);
*mutex = NULL;
return 1;
}

uint8_t
lwow_sys_mutex_wait(LWOW_CFG_OS_MUTEX_HANDLE* mutex, void* arg) {
LWOW_UNUSED(arg);
return WaitForSingleObject(*mutex, INFINITE) == WAIT_OBJECT_0;
}

uint8_t
lwow_sys_mutex_release(LWOW_CFG_OS_MUTEX_HANDLE* mutex, void* arg) {
LWOW_UNUSED(arg);
return ReleaseMutex(*mutex);
}

Expand Down

0 comments on commit 32a9530

Please sign in to comment.