capstone icon indicating copy to clipboard operation
capstone copied to clipboard

Towards `-Wall,-Wpedantic,-Werror`

Open Rot127 opened this issue 2 years ago • 5 comments

We had now several times that the CI in Capstone is fine with several build warnings, but external projects are not.

For v6 or at least v7 we should be able to compile CS without any build warnings. Especially since everything is C and more strict is always better in this case.

  • [x] Builds with -Wall
    • [x] -Wenum (120 warnings)
    • [x] -Woverlength (4 warnings)
    • [x] -Wshadow (28 warnings) - https://github.com/capstone-engine/capstone/issues/2170
  • [ ] Builds with -Wpedantic (1926 warnings) in
    • [ ] ARMDisassembler.c
    • [ ] arm.h
    • [ ] ARMInstPrinter.c
    • [ ] bpf.h
    • [ ] capstone.h
    • [ ] Mapping.h
    • [ ] MCInst.h
    • [ ] mips.h
    • [ ] ppc.h
    • [ ] PPCInstPrinter.c
    • [ ] PPCInstPrinter.h
    • [ ] riscv.h
    • [ ] sh.h
    • [ ] sparc.h
    • [ ] systemz.h
    • [ ] tricore.h
    • [ ] TriCoreInstPrinter.c
    • [ ] wasm.h
    • [ ] xcore.h

Issues

https://github.com/capstone-engine/capstone/issues/2139

Rot127 avatar Jul 22 '23 14:07 Rot127

Another possible step would be also adding clang-tidy into the CI, see this for example: https://gitlab.com/OpenMW/openmw/-/merge_requests/900/diffs

XVilka avatar Jul 27 '23 05:07 XVilka

The same can be done for msvc to get more digital eyes on the code. "Werror" can be enabled as well using "/WX". There aren't that many problems when building with -Wall https://github.com/capstone-engine/capstone/commit/2d8dad66f834ecf6699e459ed7ef92d059db6b52 so maybe it's already possible for v6.

peace-maker avatar Sep 12 '23 19:09 peace-maker

Agree. There are some warnings disabled though in code with pragma. Need to remove those as well at some point.

Rot127 avatar Sep 12 '23 20:09 Rot127

Made a build with -Wall and -Wpedantic. We are not so far from passing -Wall! And Wpedantic seems mostly a problem with our header files. Added a list above.

Rot127 avatar Sep 23 '23 18:09 Rot127

@imbillow could you please check the Tricore warnings when you have time?

XVilka avatar Sep 26 '23 04:09 XVilka