clean build warnings
This commit is contained in:
@@ -115,6 +115,7 @@ add_executable(
|
|||||||
platform/src/system_stm32f0xx.c
|
platform/src/system_stm32f0xx.c
|
||||||
hal/uart/src/uart_stm32.cpp
|
hal/uart/src/uart_stm32.cpp
|
||||||
cstdlib_support/retarget.cpp
|
cstdlib_support/retarget.cpp
|
||||||
|
cstdlib_support/nosys_stubs.c
|
||||||
${MAIN_CPP_PATH}/${MAIN_CPP_FILE_NAME}
|
${MAIN_CPP_PATH}/${MAIN_CPP_FILE_NAME}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,9 @@ int main()
|
|||||||
|
|
||||||
printf("Assert example\r\n");
|
printf("Assert example\r\n");
|
||||||
|
|
||||||
const option opt = uint8_to_option(3);
|
|
||||||
|
// maybe_unused attribute will silence unused variable warning
|
||||||
|
[[maybe_unused]] const option opt = uint8_to_option(3);
|
||||||
|
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
|
|||||||
21
Chapter07/error_handling/cstdlib_support/nosys_stubs.c
Normal file
21
Chapter07/error_handling/cstdlib_support/nosys_stubs.c
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#include <sys/stat.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <_ansi.h>
|
||||||
|
#include <reent.h>
|
||||||
|
|
||||||
|
/* Minimal implementation of _fstat_r */
|
||||||
|
int _fstat_r(struct _reent *r, int file, struct stat *st) {
|
||||||
|
st->st_mode = S_IFCHR; /* Character device */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Minimal implementation of _getpid_r */
|
||||||
|
int _getpid_r(struct _reent *r) {
|
||||||
|
return 1; /* Return a dummy process ID */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Minimal implementation of _kill_r */
|
||||||
|
int _kill_r(struct _reent *r, int pid, int sig) {
|
||||||
|
r->_errno = EINVAL;
|
||||||
|
return -1; /* Indicate failure */
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user