fix clang warnings#3915
Merged
Merged
Conversation
Collaborator
|
Thank you for merging this! |
ptitSeb
reviewed
May 29, 2026
ptitSeb
requested changes
May 29, 2026
Owner
ptitSeb
left a comment
There was a problem hiding this comment.
Remove the needs of a C++ compiler.
building for neoverse-n1 (-DADLINK) with clang warns about unsupported linker flags: ``` clang: warning: optimization flag '-fuse-linker-plugin' is not supported [-Wignored-optimization-argument] clang: warning: argument unused during compilation: '-fuse-ld=gold' [-Wunused-command-line-argument] ``` add check for ld.gold and only use it if available Signed-off-by: Pepper Gray <hello@peppergray.xyz>
building using clang warns about format specifier mismatch
```
src/os/sysinfo.c:173:26: warning: format specifies type 'unsigned long long' but the argument has type 'uint64_t' (aka 'unsigned long') [-Wformat]
173 | sprintf(str, "%llu", info->frequency);
| ~~~~ ^~~~~~~~~~~~~~~
| %lu
src/os/sysinfo.c:193:129: warning: format specifies type 'int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Wformat]
193 | snprintf(branding, sizeof(branding), BOX64_BUILD_INFO_STRING_SHORT " on %.*s @%04d MHz", 28, box64_sysinfo.cpuname, box64_sysinfo.frequency / 1000000);
| ~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| %04lu
```
use inttypes format macros instead of format specifiers directly
Signed-off-by: Pepper Gray <hello@peppergray.xyz>
building using clangs warns about an unused parameter:
```
src/emu/x64int3.c:208:117: warning: data argument not used by format string [-Wformat-extra-args]
208 | snprintf(buff, 256, "%04d|%p: Calling %s(\"%s\")", tid, *(void**)(R_RSP), s, (tmp)?tmp:"(nil)", (tmp2)?tmp2:"nil");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
```
print the missing parameter
Signed-off-by: Pepper Gray <hello@peppergray.xyz>
building using clang warns about the way the signature is formated:
```
src/wrapped/wrappedvulkan_private.h:80:1: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
src/libtools/vulkanoverlay.c:133:94: note: expanded from macro 'GO_vFpff'
133 | #define GO_vFpff(A, B, N) static void my_##A##_##N(void* a, float b, float c) {F3(A, #B +2, N);}
| ~~~~~~~~~^~~~~~
src/wrapped/wrappedvulkan_private.h:80:1: note: use array indexing to silence this warning
```
follow compiler suggestion and replace `#B +2` with `&(#B)[2]`
Signed-off-by: Pepper Gray <hello@peppergray.xyz>
building using clang warns about extraneous parentheses
```
src/wrapped32/wrappeddbus.c:541:18: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
541 | if((type == (int)'s')) {
| ~~~~~^~~~~~~~~~~
src/wrapped32/wrappeddbus.c:541:18: note: remove extraneous parentheses around the comparison to silence this warning
```
Signed-off-by: Pepper Gray <hello@peppergray.xyz>
building on clang warns about type mismatch:
```
src/wrapped/wrappedgmp.c:158:38: warning: passing 'const char *' to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
158 | return my->__gmp_vasprintf(strp, fmt, VARARGS);
| ^~~
165 | return my->__gmp_vfprintf(stream, fmt, VARARGS);
| ^~~
176 | return my->__gmp_vasprintf(strp, fmt, VARARGS);
| ^~~
187 | return my->__gmp_vfprintf(stream, fmt, VARARGS);
| ^~~
```
modifiy definition to use the actual type instead of void.
Signed-off-by: Pepper Gray <hello@peppergray.xyz>
f8ca289 to
78579a9
Compare
Contributor
Author
|
I changed excess elements in initializer remove excessive argument Remove the argument, because the function doesn't take any |
2cd89f0 to
ea9033c
Compare
ptitSeb
reviewed
May 29, 2026
building using clang warns about excess elements in initalizer:
```
src/wrapped/wrappercallback.h:16:53: warning: excess elements in struct initializer [-Wexcess-initializers]
16 | static TYPENAME(LIBNAME) TYPENAME2(my_, LIBNAME) = {0};
| ^
```
remove redundant initalization of static elements
Signed-off-by: Pepper Gray <hello@peppergray.xyz>
building using clans warns about too many arguments:
```
src/wrapped32/wrappedopenal.c:104:41: warning: too many arguments in call to 'fillALProcWrapper32'
104 | fillALProcWrapper32(emu->context);
| ~~~~~~~~~~~~~~~~~~~ ^
src/wrapped32/wrappedopenal.c:104:28: warning: passing arguments to 'fillALProcWrapper32' without a prototype is deprecated in all versions of C and is not supported in C23 [-Wdeprecated-non-prototype]
104 | fillALProcWrapper32(emu->context);
| ^
```
fillALProcWrapper32 takes no arguments
Signed-off-by: Pepper Gray <hello@peppergray.xyz>
76e64b0 to
244e5f9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
building using clang causes some warnings:
check linker flags
neoverse-n1 (-DADLINK) warns about unsupported linker flags:
add check for ld.gold and only use it if available
use portable inttypes
warning about format specifier mismatch:
use inttypes format macros instead of format specifiers directly
print missing argument
warning about an unused parameter:
use array indexing
warning about the way the signature is formated:
follow compiler suggestion and replace
#B +2with&(#B)[2]use proper type in function signature
warning about type mismatch:
modifiy definition to use the actual type instead of void.
remove extraneous parentheses
warning about extraneous parentheses: