-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[next] SH: Use bitwise OR with mask for sign extension #2389
[next] SH: Use bitwise OR with mask for sign extension #2389
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though SH disassembler generates clang-tidy warnings:
/home/runner/work/capstone/capstone/arch/SH/SHDisassembler.c:102:9: warning: va_arg() is called on an uninitialized va_list [clang-analyzer-valist.Uninitialized]
grp = va_arg(g, sh_insn_group);
^
/usr/lib/llvm-14/lib/clang/14.0.0/include/stdarg.h:19:29: note: expanded from macro 'va_arg'
#define va_arg(ap, type) __builtin_va_arg(ap, type)
^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/capstone/capstone/arch/SH/SHDisassembler.c:100:9: note: Assuming 'n' is > 0
while (n > 0) {
^~~~~
/home/runner/work/capstone/capstone/arch/SH/SHDisassembler.c:100:2: note: Loop condition is true. Entering loop body
while (n > 0) {
^
/home/runner/work/capstone/capstone/arch/SH/SHDisassembler.c:102:9: note: va_arg() is called on an uninitialized va_list
grp = va_arg(g, sh_insn_group);
^
/usr/lib/llvm-14/lib/clang/14.0.0/include/stdarg.h:19:29: note: expanded from macro 'va_arg'
#define va_arg(ap, type) __builtin_va_arg(ap, type)
^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/capstone/capstone/arch/SH/SHDisassembler.c:937:4: warning: Value stored to 'insn' is never read [clang-analyzer-deadcode.DeadStores]
insn = SH_INS_JMP;
^ ~~~~~~~~~~
/home/runner/work/capstone/capstone/arch/SH/SHDisassembler.c:937:4: note: Value stored to 'insn' is never read
insn = SH_INS_JMP;
^ ~~~~~~~~~~
cc @Rot127
@lhsazevedo Please test it with |
@Rot127 clang-tidy 18 also warns about uninitialized va_args. Perhaps it is a bug in clang-tidy?
There are more warnings for SHDisassembler, but they all seem to be unrelated to this change |
Sorry, those AArch64 ones can be ignored. I fixed them in the AArch64 update. Just check the SH one please. |
@Rot127, I haven't had time to check the SH disassembler yet as the warnings are from a different part of the code. I'll get on it as soon as I can. Thanks for your patience! |
Little reminder :) |
Sign extend using bitwise OR with mask, instead of unary minus. Fixes error when building for UWP with Security Development Lifecycle (SDL). See https://learn.microsoft.com/en-us/cpp/build/reference/sdl-enable-additional-security-checks?view=msvc-170
Remove unused store caught by clang-tidy.
Ignore an unitialized va_list false positive emitted by clang-tidy
efd4047
to
d215091
Compare
@Rot127 Done! Sorry for the delay. There were just two warnings, and one turned out to be a false positive. P.S.: I noticed SH isn't listed in the |
SH is not supported by LLVM. And Auto-Sync works exclusively on LLVM. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lhsazevedo Ok, so @kabeor and me decided to suppress the warnings. Sorry for the unclear requests. Could you please reset to the previous commit and force push. |
Of course, sure |
161471d
to
d215091
Compare
Mh, ok. So I think with the update clang-format-18 we get now some new stuff:
I am sorry this PR takes so much longer although it is so simple. We try to improve code quality overall. If you could fix this issues there (multiple occurrences of casting an instr. enum to a type enum? No idea why, probably typos no one saw) I would really appreciate it. |
@lhsazevedo Ignore my comment above. I'll fix the issues in #2469 |
Ok! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contributions!
Cherry pick of #2371 to next branch