about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorYang Liu <liuyang22@iscas.ac.cn>2025-06-18 23:13:34 +0800
committerGitHub <noreply@github.com>2025-06-18 17:13:34 +0200
commitc96c1ad5ddb977a3723b6d53317f7942546e0779 (patch)
treefa2ea910ed9cca3806de8a1020b4e0d4e78ef41f /src
parent71220b7fef4466f98cc78b1d013755aca8e217c6 (diff)
downloadbox64-c96c1ad5ddb977a3723b6d53317f7942546e0779.tar.gz
box64-c96c1ad5ddb977a3723b6d53317f7942546e0779.zip
[BIONIC] Fixed some compilation warnings (#2756)
Diffstat (limited to 'src')
-rw-r--r--src/core.c2
-rw-r--r--src/elfs/elfloader_private.h2
-rw-r--r--src/emu/x64emu.c13
-rw-r--r--src/libtools/signal_private.h4
-rw-r--r--src/os/perfmap.c5
-rw-r--r--src/tools/gtkclass.c6
-rw-r--r--src/wrapped/generated/functions_list.txt1
-rw-r--r--src/wrapped/wrappedgio2.c6
-rw-r--r--src/wrapped/wrappedopenal.c8
9 files changed, 25 insertions, 22 deletions
diff --git a/src/core.c b/src/core.c
index dae932a6..362ffab1 100644
--- a/src/core.c
+++ b/src/core.c
@@ -391,7 +391,7 @@ void KillAllInstances()
     snprintf(self_name_with_deleted, sizeof(self_name_with_deleted), "%s (deleted)", self_name);
 
     const pid_t self = getpid();
-    while (entry = readdir(proc_dir)) {
+    while ((entry = readdir(proc_dir))) {
         const pid_t pid = atoi(entry->d_name);
         if (!pid || pid == self) continue;
 
diff --git a/src/elfs/elfloader_private.h b/src/elfs/elfloader_private.h
index 61de1a43..f57d5fd8 100644
--- a/src/elfs/elfloader_private.h
+++ b/src/elfs/elfloader_private.h
@@ -145,6 +145,7 @@ typedef struct elfheader_s {
 
 } elfheader_t;
 
+#ifndef R_X86_64_NONE
 #define R_X86_64_NONE           0       /* No reloc */
 #define R_X86_64_64             1       /* Direct 64 bit  */
 #define R_X86_64_PC32           2       /* PC relative 32 bit signed */
@@ -188,6 +189,7 @@ typedef struct elfheader_s {
                                         /* 40 Reserved was R_X86_64_PLT32_BND */
 #define R_X86_64_GOTPCRELX      41      /* Load from 32 bit signed pc relative offset to GOT entry without REX prefix, relaxable.  */
 #define R_X86_64_REX_GOTPCRELX  42      /* Load from 32 bit signed pc relative offset to GOT entry with REX prefix, relaxable.  */
+#endif
 #define R_X86_64_NUM            43
 
 #ifndef STB_GNU_UNIQUE
diff --git a/src/emu/x64emu.c b/src/emu/x64emu.c
index 91172d76..9ce8c180 100644
--- a/src/emu/x64emu.c
+++ b/src/emu/x64emu.c
@@ -3,6 +3,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <inttypes.h>
 
 #include "os.h"
 #include "debug.h"
@@ -393,7 +394,7 @@ const char* DumpCPURegs(x64emu_t* emu, uintptr_t ip, int is32bits)
         int stack = emu->fpu_stack;
         if(stack>8) stack = 8;
         for (int i=0; i<stack; i++) {
-            sprintf(tmp, "ST%d=%f(0x%llx)", i, ST(i).d, ST(i).q);
+            sprintf(tmp, "ST%d=%f(0x%" PRIx64 ")", i, ST(i).d, ST(i).q);
             strcat(buff, tmp);
             int c = 20-strlen(tmp);
             if(c<1) c=1;
@@ -443,13 +444,13 @@ const char* DumpCPURegs(x64emu_t* emu, uintptr_t ip, int is32bits)
         for (int i=_AX; i<=_R15; ++i) {
 #ifdef HAVE_TRACE
             if (BOX64ENV(trace_regsdiff) && (emu->regs[i].q[0] != emu->oldregs[i].q[0])) {
-                sprintf(tmp, "\e[1;35m%s=%016llx\e[m ", regname[i], emu->regs[i].q[0]);
+                sprintf(tmp, "\e[1;35m%s=%016" PRIx64 "\e[m ", regname[i], emu->regs[i].q[0]);
                 emu->oldregs[i].q[0] = emu->regs[i].q[0];
             } else {
-                sprintf(tmp, "%s=%016llx ", regname[i], emu->regs[i].q[0]);
+                sprintf(tmp, "%s=%016" PRIx64, regname[i], emu->regs[i].q[0]);
             }
 #else
-            sprintf(tmp, "%s=%016llx ", regname[i], emu->regs[i].q[0]);
+            sprintf(tmp, "%s=%016" PRIx64, regname[i], emu->regs[i].q[0]);
 #endif
             strcat(buff, tmp);
 
@@ -472,9 +473,9 @@ const char* DumpCPURegs(x64emu_t* emu, uintptr_t ip, int is32bits)
             }
     }
     if(is32bits)
-        sprintf(tmp, "EIP=%08llx ", ip);
+        sprintf(tmp, "EIP=%08" PRIx64, ip);
     else
-        sprintf(tmp, "RIP=%016llx ", ip);
+        sprintf(tmp, "RIP=%016" PRIx64, ip);
     strcat(buff, tmp);
     return buff;
 }
diff --git a/src/libtools/signal_private.h b/src/libtools/signal_private.h
index 6d261c39..8f2eb734 100644
--- a/src/libtools/signal_private.h
+++ b/src/libtools/signal_private.h
@@ -185,9 +185,7 @@ typedef struct x64_mcontext_s
 } x64_mcontext_t;
 
 // /!\ signal sig_set is different than glibc __sig_set
-#ifdef ANDROID
-#define _NSIG_WORDS (64 / (sizeof(unsigned long int)*8))
-#else
+#ifndef ANDROID
 #define _NSIG_WORDS (1024 / (sizeof(unsigned long int)*8))
 #endif
 
diff --git a/src/os/perfmap.c b/src/os/perfmap.c
index 3d6e482d..753144d4 100644
--- a/src/os/perfmap.c
+++ b/src/os/perfmap.c
@@ -5,6 +5,7 @@
 #include <string.h>
 #include <assert.h>
 #include <unistd.h>
+#include <inttypes.h>
 
 #include "debug.h"
 #include "box64context.h"
@@ -20,9 +21,9 @@ void writePerfMap(uintptr_t func_addr, uintptr_t code_addr, size_t code_size, co
     uintptr_t start = 0;
     const char* symbname = FindNearestSymbolName(FindElfAddress(my_context, func_addr), (void*)func_addr, &start, &sz);
     if(!symbname || !strcmp(symbname, "???"))
-        snprintf(pbuf, sizeof(pbuf), "0x%lx %ld %p:%s\n", code_addr, code_size, func_addr, inst_name);
+        snprintf(pbuf, sizeof(pbuf), "0x%" PRIx64 " %" PRId64 " 0x%" PRIx64 ":%s\n", code_addr, code_size, func_addr, inst_name);
     else
-        snprintf(pbuf, sizeof(pbuf), "0x%lx %ld %s:%s\n", code_addr, code_size, symbname, inst_name);
+        snprintf(pbuf, sizeof(pbuf), "0x%" PRIx64 " %" PRId64 " %s:%s\n", code_addr, code_size, symbname, inst_name);
     (void)!write(BOX64ENV(dynarec_perf_map_fd), pbuf, strlen(pbuf));
 }
 #else
diff --git a/src/tools/gtkclass.c b/src/tools/gtkclass.c
index 55cfb99f..8f68b9df 100644
--- a/src/tools/gtkclass.c
+++ b/src/tools/gtkclass.c
@@ -5572,13 +5572,13 @@ my_GtkTypeInfo_t* findFreeGtkTypeInfo(my_GtkTypeInfo_t* fcts, size_t parent)
         my_gtktypeinfo_##A.type_name = fcts->type_name; \
         my_gtktypeinfo_##A.object_size = fcts->object_size; \
         my_gtktypeinfo_##A.class_size = fcts->class_size; \
-        my_gtktypeinfo_##A.class_init_func = (fcts->class_init_func)?((GetNativeFnc((uintptr_t)fcts->class_init_func))?GetNativeFnc((uintptr_t)fcts->class_init_func):my_gtk_class_init_##A):NULL;    \
+        my_gtktypeinfo_##A.class_init_func = (fcts->class_init_func)?((GetNativeFnc((uintptr_t)fcts->class_init_func))?GetNativeFnc((uintptr_t)fcts->class_init_func):(void*)my_gtk_class_init_##A):NULL;    \
         fct_gtk_class_init_##A = (uintptr_t)fcts->class_init_func;           \
-        my_gtktypeinfo_##A.object_init_func = (fcts->object_init_func)?((GetNativeFnc((uintptr_t)fcts->object_init_func))?GetNativeFnc((uintptr_t)fcts->object_init_func):my_gtk_object_init_##A):NULL;    \
+        my_gtktypeinfo_##A.object_init_func = (fcts->object_init_func)?((GetNativeFnc((uintptr_t)fcts->object_init_func))?GetNativeFnc((uintptr_t)fcts->object_init_func):(void*)my_gtk_object_init_##A):NULL;    \
         fct_gtk_object_init_##A = (uintptr_t)fcts->object_init_func;         \
         my_gtktypeinfo_##A.reserved_1 = fcts->reserved_1;                 \
         my_gtktypeinfo_##A.reserved_2 = fcts->reserved_2;                 \
-        my_gtktypeinfo_##A.base_class_init_func = (fcts->base_class_init_func)?((GetNativeFnc((uintptr_t)fcts->base_class_init_func))?GetNativeFnc((uintptr_t)fcts->base_class_init_func):my_gtk_base_class_init_##A):NULL;    \
+        my_gtktypeinfo_##A.base_class_init_func = (fcts->base_class_init_func)?((GetNativeFnc((uintptr_t)fcts->base_class_init_func))?GetNativeFnc((uintptr_t)fcts->base_class_init_func):(void*)my_gtk_base_class_init_##A):NULL;    \
         fct_gtk_base_class_init_##A = (uintptr_t)fcts->base_class_init_func;   \
         return &my_gtktypeinfo_##A;                       \
     }
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index bf306cfa..82b573e2 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -3506,6 +3506,7 @@
 #() iFEpuvvppp -> iFEpuppp
 wrappedalure:
 wrappedalut:
+wrappedandroidshmem:
 wrappedanl:
 wrappedatk:
 - vFp:
diff --git a/src/wrapped/wrappedgio2.c b/src/wrapped/wrappedgio2.c
index 45c650f1..47b92d63 100644
--- a/src/wrapped/wrappedgio2.c
+++ b/src/wrapped/wrappedgio2.c
@@ -356,11 +356,11 @@ static my_GDBusInterfaceVTable_t* findFreeGDBusInterfaceVTable(my_GDBusInterface
     #undef GO
     #define GO(A) if(ref_GDBusInterfaceVTable_##A == 0) {   \
         ref_GDBusInterfaceVTable_##A = fcts;                 \
-        my_GDBusInterfaceVTable_##A.method_call = (fcts->method_call)?((GetNativeFnc((uintptr_t)fcts->method_call))?GetNativeFnc((uintptr_t)fcts->method_call):my_funcs_method_call_##A):NULL;    \
+        my_GDBusInterfaceVTable_##A.method_call = (fcts->method_call)?((GetNativeFnc((uintptr_t)fcts->method_call))?GetNativeFnc((uintptr_t)fcts->method_call):(void*)my_funcs_method_call_##A):NULL;    \
         fct_funcs_method_call_##A = (uintptr_t)fcts->method_call;                            \
-        my_GDBusInterfaceVTable_##A.get_property = (fcts->get_property)?((GetNativeFnc((uintptr_t)fcts->get_property))?GetNativeFnc((uintptr_t)fcts->get_property):my_funcs_get_property_##A):NULL;    \
+        my_GDBusInterfaceVTable_##A.get_property = (fcts->get_property)?((GetNativeFnc((uintptr_t)fcts->get_property))?GetNativeFnc((uintptr_t)fcts->get_property):(void*)my_funcs_get_property_##A):NULL;    \
         fct_funcs_get_property_##A = (uintptr_t)fcts->get_property;                            \
-        my_GDBusInterfaceVTable_##A.set_property = (fcts->set_property)?((GetNativeFnc((uintptr_t)fcts->set_property))?GetNativeFnc((uintptr_t)fcts->set_property):my_funcs_set_property_##A):NULL;    \
+        my_GDBusInterfaceVTable_##A.set_property = (fcts->set_property)?((GetNativeFnc((uintptr_t)fcts->set_property))?GetNativeFnc((uintptr_t)fcts->set_property):(void*)my_funcs_set_property_##A):NULL;    \
         fct_funcs_set_property_##A = (uintptr_t)fcts->set_property;                            \
         return &my_GDBusInterfaceVTable_##A;                \
     }
diff --git a/src/wrapped/wrappedopenal.c b/src/wrapped/wrappedopenal.c
index fb478f33..c1fcd0a4 100644
--- a/src/wrapped/wrappedopenal.c
+++ b/src/wrapped/wrappedopenal.c
@@ -63,7 +63,7 @@ void my_alRequestFoldbackStop(x64emu_t* emu);
 
 #include "wrappedlib_init.h"
 
-void fillALProcWrapper()
+void fillALProcWrapper(box64context_t* context)
 {
     int cnt, ret;
     khint_t k;
@@ -82,7 +82,7 @@ void fillALProcWrapper()
         kh_value(symbolmap, k).w = openalmysymbolmap[i].w;
         kh_value(symbolmap, k).resolved = 0;
     }
-    my_context->alwrappers = symbolmap;
+    context->alwrappers = symbolmap;
     // fill my_* map
     symbolmap = kh_init(symbolmap);
     cnt = sizeof(MAPNAME(mysymbolmap))/sizeof(map_onesymbol_t);
@@ -91,7 +91,7 @@ void fillALProcWrapper()
         kh_value(symbolmap, k).w = openalmysymbolmap[i].w;
         kh_value(symbolmap, k).resolved = 0;
     }
-    my_context->almymap = symbolmap;
+    context->almymap = symbolmap;
 }
 void freeALProcWrapper(box64context_t* context)
 {
@@ -147,7 +147,7 @@ EXPORT void* my_alcGetProcAddress(x64emu_t* emu, void* device, void* name)
     const char* rname = (const char*)name;
     printf_log(LOG_DEBUG, "Calling alcGetProcAddress(%p, %s)\n", device, rname);
     if(!emu->context->alwrappers)   // could be moved in "my" structure...
-        fillALProcWrapper();
+        fillALProcWrapper(emu->context);
     // get proc adress using actual alGetProcAddress
     k = kh_get(symbolmap, emu->context->almymap, rname);
     int is_my = (k==kh_end(emu->context->almymap))?0:1;