From 91ea17ead5f5b961899ff35164ddc816fc9e77e6 Mon Sep 17 00:00:00 2001 From: Pranjal Chanda Date: Thu, 13 Jan 2022 13:28:43 +0530 Subject: [PATCH] Local integration and Test complete --- .gitignore | 2 ++ sonar-project.properties | 11 ++++++ src/lib/libc/printf.c | 2 +- src/lib/libposix/include/posix/errno.h | 19 ----------- src/lib/libposix/src/posix_semaphore.c | 46 +++++++++++++++++--------- 5 files changed, 45 insertions(+), 35 deletions(-) create mode 100644 sonar-project.properties diff --git a/.gitignore b/.gitignore index 5946d6fc..3ae990a4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +.scannerwork +sonar-cfamily-reproducer.zip temp out/ toolchain/ diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..643645d7 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,11 @@ +sonar.login=a15620523b79247d23371f05082ab54e16fbb805 +sonar.organization=cyancore +sonar.projectKey=VisorFolks_cyancore +sonar.sources=src +sonar.cfamily.build-wrapper-output=toolchain/bw-output +sonar.verbose=false +sonar.host.url=https://sonarcloud.io +sonar.verbose=true +sonar.cfamily.threads=8 +sonar.cfamily.cache.enabled=true +sonar.cfamily.cache.path=toolchain/bw-output/cfamily_cache diff --git a/src/lib/libc/printf.c b/src/lib/libc/printf.c index 570f72b7..efb48528 100644 --- a/src/lib/libc/printf.c +++ b/src/lib/libc/printf.c @@ -107,7 +107,7 @@ int vprintf(const char *fmt, va_list args) break; case 'c': str = va_arg(args, char *); - ret += console_putc((int)str); + ret += console_putc((int)str[0]); break; case 's': str = va_arg(args, char *); diff --git a/src/lib/libposix/include/posix/errno.h b/src/lib/libposix/include/posix/errno.h index c20a3b75..01501b40 100644 --- a/src/lib/libposix/include/posix/errno.h +++ b/src/lib/libposix/include/posix/errno.h @@ -14,25 +14,6 @@ #include -/* Undefine all errnos to avoid redefinition errors with system errnos. */ -#undef EPERM -#undef ENOENT -#undef EBADF -#undef EAGAIN -#undef ENOMEM -#undef EEXIST -#undef EBUSY -#undef EINVAL -#undef ENOSPC -#undef ERANGE -#undef ENAMETOOLONG -#undef EDEADLK -#undef EOVERFLOW -#undef ENOSYS -#undef EMSGSIZE -#undef ENOTSUP -#undef ETIMEDOUT - /** * @name Definition of POSIX errnos. */ diff --git a/src/lib/libposix/src/posix_semaphore.c b/src/lib/libposix/src/posix_semaphore.c index ed0a09f7..d1d943ff 100644 --- a/src/lib/libposix/src/posix_semaphore.c +++ b/src/lib/libposix/src/posix_semaphore.c @@ -20,10 +20,13 @@ ********************/ static int s_sem_wait( sem_t * sem ) { - sret_t sem_sys_ret; - ASSERT_IF_FALSE(sem == NULL, int); + sret_t sem_sys_ret= + { + .status = SUCCESS + }; + ASSERT_IF_FALSE(sem != NULL, int); - super_call(scall_id_sem_wait, (unsigned int) *sem, RST_VAL, RST_VAL, &sem_sys_ret); + super_call(scall_id_sem_wait, (uintptr_t) *sem, RST_VAL, RST_VAL, &sem_sys_ret); return sem_sys_ret.status; } @@ -33,10 +36,13 @@ static int s_sem_wait( sem_t * sem ) ********************/ int sem_destroy( sem_t * sem ) { - sret_t sem_sys_ret; - ASSERT_IF_FALSE(sem == NULL, int); + sret_t sem_sys_ret= + { + .status = SUCCESS + }; + ASSERT_IF_FALSE(sem != NULL, int); - super_call(scall_id_sem_destroy, (unsigned int) *sem, RST_VAL, RST_VAL, &sem_sys_ret); + super_call(scall_id_sem_destroy, (uintptr_t) *sem, RST_VAL, RST_VAL, &sem_sys_ret); RET_ERR_IF_FALSE(sem_sys_ret.status == SUCCESS, sem_sys_ret.status, int); *sem = (sem_t) NULL; @@ -47,10 +53,13 @@ int sem_destroy( sem_t * sem ) int sem_getvalue( sem_t * sem, int * sval ) { - sret_t sem_sys_ret; - ASSERT_IF_FALSE(sem == NULL, int); + sret_t sem_sys_ret= + { + .status = SUCCESS + }; + ASSERT_IF_FALSE(sem != NULL, int); - super_call(scall_id_sem_getvalue, (unsigned int) *sem, RST_VAL, RST_VAL, &sem_sys_ret); + super_call(scall_id_sem_getvalue, (uintptr_t) *sem, RST_VAL, RST_VAL, &sem_sys_ret); RET_ERR_IF_FALSE(sem_sys_ret.status == SUCCESS, sem_sys_ret.status, int); *sval = (int) sem_sys_ret.p; @@ -62,8 +71,12 @@ int sem_init( sem_t * sem, int pshared _UNUSED, unsigned value ) { - sret_t sem_sys_ret; - ASSERT_IF_FALSE(sem == NULL, int); + sret_t sem_sys_ret= + { + .status = SUCCESS + }; + + ASSERT_IF_FALSE(sem != NULL, int); super_call(scall_id_sem_init, value, RST_VAL, RST_VAL, &sem_sys_ret); RET_ERR_IF_FALSE(sem_sys_ret.status == SUCCESS, sem_sys_ret.status, int); @@ -75,10 +88,13 @@ int sem_init( sem_t * sem, int sem_post( sem_t * sem ) { - sret_t sem_sys_ret; - ASSERT_IF_FALSE(sem == NULL, int); + sret_t sem_sys_ret= + { + .status = SUCCESS + }; + ASSERT_IF_FALSE(sem != NULL, int); - super_call(scall_id_sem_post, (unsigned int) *sem, RST_VAL, RST_VAL, &sem_sys_ret); + super_call(scall_id_sem_post, (uintptr_t) *sem, RST_VAL, RST_VAL, &sem_sys_ret); return sem_sys_ret.status; } @@ -86,7 +102,7 @@ int sem_post( sem_t * sem ) int sem_timedwait( sem_t * sem, const struct timespec * abstime ) { - ASSERT_IF_FALSE(sem == NULL, int); + ASSERT_IF_FALSE(sem != NULL, int); int err = SUCCESS; TickType_t abs_ticks;