proxmark3 icon indicating copy to clipboard operation
proxmark3 copied to clipboard

warnings on armsrc/bootrom code

Open doegox opened this issue 5 years ago • 13 comments

doegox avatar Apr 19 '19 12:04 doegox

We don't have that many CLANG warnings left?

iceman1001 avatar May 09 '20 08:05 iceman1001

"ARM" We only did some warnings on client so far. With mymakeclang.sh:

  • bootrom: 115 warinings
  • armsrc 2354 warnings
  • client 302 warnings

doegox avatar May 09 '20 09:05 doegox

I added stats to the script:

client:
     11 [-Wcast-align] only with clang, in src/cmdtrace.c, casts of trace
     29 [-Wswitch-enum]
     92 [-Wunused-parameter]
    165 [-Wsign-compare]

fpga_compress:

mfkey:

nonce2key:

bootrom:
      1 [-Wsign-compare]
      1 [-Wunused-parameter]
      3 [-Wshadow]
      4 [-Wmissing-prototypes]
     22 [-Wunused-command-line-argument]
     24 [-Wkeyword-macro]
     60 [-Wundef]

armsrc:
      2 [-Wmacro-redefined]
      3 [-Wshadow]
      6 [-Wgnu-include-next]
     11 [-Wswitch-enum]
     50 [-Wunused-parameter]
     57 [-Wcast-align]
     58 [-Wsign-compare]
    125 [-Wmissing-prototypes]
    140 [-Wincompatible-library-redeclaration]
    187 [-Wincompatible-pointer-types-discards-qualifiers]
    213 [-Wunknown-attributes]
    238 [-Wstrict-prototypes]
    345 [-Wkeyword-macro]
    857 [-Wundef]

hitag2crack: ?? not yet tested

BTW these warnings are mostly not clangs specific, it's just about activating class of warnings in CFLAGS

doegox avatar May 09 '20 09:05 doegox

I splitted the script into host & arm and unified warnings gcc/clang, host :

[=] LD nonce2key
g++  obj/crypto1.o obj/crapto1.o obj/bucketsort.o obj/nonce2key.o -o nonce2key 

CLANG
=====
Total: 297

client:
     11 [-Wcast-align]
     29 [-Wswitch-enum]
     92 [-Wunused-parameter]
    165 [-Wsign-compare]

fpga_compress:

mfkey:

nonce2key:

GCC
===
Total: 811

client:
      1 [-Wclobbered]
      1 [-Wold-style-declaration]
      1 [-Wunused-but-set-parameter]
     46 [-Wimplicit-fallthrough=]
     84 [-Wold-style-definition]
     92 [-Wunused-parameter]
    201 [-Wsign-compare]
    290 [-Wswitch-enum]

fpga_compress:
     12 [-Wimplicit-fallthrough=]
     83 [-Wold-style-definition]

mfkey:

nonce2key:

doegox avatar May 09 '20 13:05 doegox

Current stats (arm_warnings):

GCC
===
Total: 407

bootrom:

fullimage:
      2 [-Wold-style-declaration]
      4 [-Wredundant-decls]
     30 [-Wimplicit-fallthrough=]
     50 [-Wunused-parameter]
     57 [-Wcast-align]
     64 [-Wswitch-enum]
     83 [-Wsign-compare]
    117 [-Wold-style-definition]

Some are due to deps which are not isolated as deps in the arm, contrarily to client/deps/...

doegox avatar May 10 '20 17:05 doegox

I can't get your scripts to run. mymakewarn_arm.sh mymakewarn_host.sh

iceman1001 avatar May 19 '20 08:05 iceman1001

why so ?

doegox avatar May 19 '20 13:05 doegox

Dunno.. just doesn't wanna play nice. It breaks fast.

iceman1001 avatar May 19 '20 13:05 iceman1001

With that, a updated list on the warnings, please ;)

iceman1001 avatar May 19 '20 13:05 iceman1001

client:

CLANG
=====
Total: 257

client:
     89 [-Wunused-parameter]
    165 [-Wsign-compare]

fpga_compress:

mfkey:

nonce2key:

mf_nonce_brute:
      3 [-Wsign-compare]

GCC 10
===
Total: 329

client:
      1 [-Wclobbered]
      1 [-Wold-style-declaration]
     34 [-Wimplicit-fallthrough=]
     89 [-Wunused-parameter]
    201 [-Wsign-compare]

fpga_compress:

mfkey:

nonce2key:

mf_nonce_brute:
      3 [-Wsign-compare]

doegox avatar May 19 '20 16:05 doegox

ARM:

GCC 8
===
Total: 324

bootrom:

fullimage:
      2 [-Wold-style-declaration]
      4 [-Wredundant-decls]
     18 [-Wimplicit-fallthrough=]
     33 [-Wold-style-definition]
     50 [-Wunused-parameter]
     57 [-Wcast-align]
     77 [-Wswitch-enum]
     83 [-Wsign-compare]

doegox avatar May 19 '20 16:05 doegox

You'll be happy, a colleague told me about this wonderful -Wconversion that can unveil weird problems...

Client:

CLANG
=====
Total: 3180

client:
     21 [-Wfloat-conversion]
     36 [-Wimplicit-float-conversion]
     89 [-Wunused-parameter]
    161 [-Wsign-compare]
    357 [-Wshorten-64-to-32]
    850 [-Wimplicit-int-conversion]
   1354 [-Wsign-conversion]

fpga_compress:
      5 [-Wimplicit-int-conversion]
      9 [-Wshorten-64-to-32]
     21 [-Wsign-conversion]

mfkey:
      1 [-Wshorten-64-to-32]
      3 [-Wimplicit-int-conversion]
     85 [-Wsign-conversion]

nonce2key:
      3 [-Wimplicit-int-conversion]
     86 [-Wsign-conversion]

mf_nonce_brute:
      3 [-Wsign-compare]
      9 [-Wimplicit-int-conversion]
     87 [-Wsign-conversion]

GCC
===
Total: 3621

client:
      1 [-Wclobbered]
      1 [-Wold-style-declaration]
     34 [-Wimplicit-fallthrough=]
     57 [-Wfloat-conversion]
     89 [-Wunused-parameter]
    197 [-Wsign-compare]
   1293 [-Wsign-conversion]
   1673 [-Wconversion]

fpga_compress:
     25 [-Wsign-conversion]
     61 [-Wconversion]

mfkey:
     23 [-Wconversion]
     30 [-Wsign-conversion]

nonce2key:
     22 [-Wconversion]
     30 [-Wsign-conversion]

mf_nonce_brute:
      3 [-Wsign-compare]
     34 [-Wsign-conversion]
     48 [-Wconversion]

ARM:

GCC
===
Total: 2280

bootrom:
     15 [-Wconversion]
     18 [-Wsign-conversion]

fullimage:
      2 [-Wold-style-declaration]
      4 [-Wredundant-decls]
     18 [-Wimplicit-fallthrough=]
     33 [-Wold-style-definition]
     50 [-Wunused-parameter]
     57 [-Wcast-align]
     77 [-Wswitch-enum]
     83 [-Wsign-compare]
    823 [-Wsign-conversion]
   1100 [-Wconversion]

doegox avatar May 20 '20 20:05 doegox

No, you really don't know how to make me happy. not like this

iceman1001 avatar May 20 '20 20:05 iceman1001