From: Виктор Чернякин <56512186+LocalSpook@users.noreply.github.com> Date: Fri, 22 Dec 2023 10:30:50 +0000 (-0700) Subject: Fix a variety of warnings (#811) X-Git-Tag: upstream/3.4.7~44 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a1c391bd8e604c611c7e9c8f6705dc723d403eb5;p=platform%2Fupstream%2Flibffi.git Fix a variety of warnings (#811) --- diff --git a/include/ffi_common.h b/include/ffi_common.h index c53a794..a9839b3 100644 --- a/include/ffi_common.h +++ b/include/ffi_common.h @@ -49,8 +49,10 @@ extern "C" { # endif # endif # define MAYBE_UNUSED __attribute__((__unused__)) +# define NORETURN __attribute__((__noreturn__)) #else # define MAYBE_UNUSED +# define NORETURN # if HAVE_ALLOCA_H # include # else @@ -82,9 +84,9 @@ char *alloca (); #endif #ifdef FFI_DEBUG -void ffi_assert(char *expr, char *file, int line); +NORETURN void ffi_assert(const char *expr, const char *file, int line); void ffi_stop_here(void); -void ffi_type_test(ffi_type *a, char *file, int line); +void ffi_type_test(ffi_type *a, const char *file, int line); #define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__)) #define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l))) diff --git a/src/closures.c b/src/closures.c index 0f2d619..67a94a8 100644 --- a/src/closures.c +++ b/src/closures.c @@ -599,7 +599,7 @@ open_temp_exec_file_memfd (const char *name) /* Open a temporary file name, and immediately unlink it. */ static int -open_temp_exec_file_name (char *name, int flags) +open_temp_exec_file_name (char *name, int flags MAYBE_UNUSED) { int fd; @@ -795,7 +795,7 @@ open_temp_exec_file (void) Failure to allocate the space will cause SIGBUS to be thrown when the mapping is subsequently written to. */ static int -allocate_space (int fd, off_t offset, off_t len) +allocate_space (int fd, off_t len) { static long page_size; @@ -838,7 +838,7 @@ dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset) offset = execsize; - if (allocate_space (execfd, offset, length)) + if (allocate_space (execfd, length)) return MFAIL; flags &= ~(MAP_PRIVATE | MAP_ANONYMOUS); diff --git a/src/debug.c b/src/debug.c index f3172b1..63321dc 100644 --- a/src/debug.c +++ b/src/debug.c @@ -38,7 +38,7 @@ void ffi_stop_here(void) /* This function should only be called via the FFI_ASSERT() macro */ -void ffi_assert(char *expr, char *file, int line) +NORETURN void ffi_assert(const char *expr, const char *file, int line) { fprintf(stderr, "ASSERTION FAILURE: %s at %s:%d\n", expr, file, line); ffi_stop_here(); @@ -47,7 +47,7 @@ void ffi_assert(char *expr, char *file, int line) /* Perform a sanity check on an ffi_type structure */ -void ffi_type_test(ffi_type *a, char *file, int line) +void ffi_type_test(ffi_type *a, const char *file, int line) { FFI_ASSERT_AT(a != NULL, file, line); diff --git a/src/dlmalloc.c b/src/dlmalloc.c index 6f4a5f6..c61ef92 100644 --- a/src/dlmalloc.c +++ b/src/dlmalloc.c @@ -4452,7 +4452,7 @@ struct mallinfo dlmallinfo(void) { } #endif /* NO_MALLINFO */ -void dlmalloc_stats() { +void dlmalloc_stats(void) { internal_malloc_stats(gm); } diff --git a/src/tramp.c b/src/tramp.c index 5f19b55..8ec0848 100644 --- a/src/tramp.c +++ b/src/tramp.c @@ -307,7 +307,7 @@ ffi_tramp_lock(void) } static void -ffi_tramp_unlock() +ffi_tramp_unlock(void) { pthread_mutex_unlock (&tramp_globals_mutex); } diff --git a/src/x86/ffiw64.c b/src/x86/ffiw64.c index 8271658..2be8b99 100644 --- a/src/x86/ffiw64.c +++ b/src/x86/ffiw64.c @@ -227,7 +227,7 @@ EFI64(ffi_prep_closure_loc)(ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, - void *codeloc) + void *codeloc MAYBE_UNUSED) { static const unsigned char trampoline[FFI_TRAMPOLINE_SIZE - 8] = { /* endbr64 */