radareorg / radare2

UNIX-like reverse engineering framework and command-line toolset
https://www.radare.org/
GNU Lesser General Public License v3.0
20.2k stars 2.96k forks source link

missing braces #19976

Closed trufae closed 2 years ago

trufae commented 2 years ago

from https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true

-line-argument]
[705](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:705)
sdb.c:738:15: warning: suggest braces around initialization of subobject [-Wmissing-braces]
[706](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:706)
        SdbKv tkv = {0};
[707](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:707)
                     ^
[708](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:708)
                     {}
[709](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:709)
CC match.c
p/crypto_aes_algo.c
[764](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:764)
SDB ios-x86-32.sdb.txt
[765](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:765)
[flag 321] CC zones.c
[766](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:766)
p/crypto_aes_algo.c:122:28: warning: suggest braces around initialization of subobject [-Wmissing-braces]
[767](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:767)
        RCryptoAESExponent exp = {0};
[768](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:768)
                                  ^
[769](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:769)
                                  {}
[770](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:770)
p/crypto_aes_algo.c:122:28: warning: suggest braces around initialization of subobject [-Wmissing-braces]
[771](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:771)
        RCryptoAESExponent exp = {0};
[772](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:772)
                                  ^
[773](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:773)
                                  {}
[774](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:774)
p/crypto_aes_algo.c:200:28: warning: suggest braces around initialization of subobject [-Wmissing-braces]
[775](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:775)
        RCryptoAESExponent exp = {0};
[776](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:776)
                                  ^
[777](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:777)
                                  {}
[778](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:778)
p/crypto_aes_algo.c:200:28: warning: suggest braces around initialization of subobject [-Wmissing-braces]
[779](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:779)
        RCryptoAESExponent exp = {0};
[780](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:780)
                                  ^
[781](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:781)
                                  {}
[782](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:782)
4 warnings generated.
704
[cons 283] CC cutf8.c
[705](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:705)
[bp 286] CC bp_watch.c
[706](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:706)
ssdeep.c:85:13: warning: suggest braces around initialization of subobject [-Wmissing-braces]
[707](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:707)
        State s = {0};
[708](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:708)
                   ^
[709](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:709)
                   {}
[710](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:710)
1 warning generated.
[io 25] CC ptrace_wrap.c
[899](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:899)
io_bank.c:394:23: warning: suggest braces around initialization of subobject [-Wmissing-braces]
[900](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:900)
        RIOSubMap fake_sm = {0};
[901](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:901)
                             ^
[902](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:902)
                             {}
[903](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:903)
io_bank.c:759:23: warning: suggest braces around initialization of subobject [-Wmissing-braces]
[904](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:904)
        RIOSubMap fake_sm = {0};
[905](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:905)
                             ^
[906](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:906)
                             {}
[907](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:907)
io_bank.c:801:23: warning: suggest braces around initialization of subobject [-Wmissing-braces]
[908](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:908)
        RIOSubMap fake_sm = {0};
[909](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:909)
                             ^
[910](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:910)
                             {}
[911](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:911)
3 warnings generated.
[912](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:912)
LD libr_io.so
CC      arch/TMS320C64x/TMS320C64xDisassembler.o
[1041](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1041)
arch/X86/X86DisassemblerDecoder.c:163:55: warning: suggest braces around initialization of subobject [-Wmissing-braces]
[1042](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1042)
        static const struct OpcodeDecision emptyDecision = { 0 };
[1043](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1043)
                                                             ^
[1044](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1044)
                                                             {}
[1045](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1045)
  CC      arch/TMS320C64x/TMS320C64xModule.o
[1046](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1046)
  CC      arch/TMS320C64x/TMS320C64xMapping.o
[1047](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1047)
  CC      arch/TMS320C64
p.c
[1389](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1389)
[io 25] CC ptrace_wrap.c
[1390](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1390)
io_bank.c:394:23: warning: suggest braces around initialization of subobject [-Wmissing-braces]
[1391](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1391)
        RIOSubMap fake_sm = {0};
[1392](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1392)
                             ^
[1393](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1393)
                             {}
[1394](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1394)
io_bank.c:759:23: warning: suggest braces around initialization of subobject [-Wmissing-braces]
[1395](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1395)
        RIOSubMap fake_sm = {0};
[1396](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1396)
                             ^
[1397](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1397)
                             {}
[1398](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1398)
io_bank.c:801:23: warning: suggest braces around initialization of subobject [-Wmissing-braces]
[1399](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1399)
        RIOSubMap fake_sm = {0};
[1400](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1400)
                             ^
[1401](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1401)
                             {}
[1402](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1402)
3 warnings generated.
[1403](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1403)
LD libr_io.so
[1404](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1404)
DIR fs
dare2/libr/..//libr/bin/p/bin_pyc.c
[1522](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1522)
/home/runner/work/radare2/radare2/libr/..//libr/bin/p/bin_psxexe.c:24:29: warning: suggest braces around initialization of subobject [-Wmissing-braces]
[1523](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1523)
        psxexe_header psxheader = {0};
[1524](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1524)
                                   ^
[1525](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1525)
                                   {}
[1526](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1526)
/home/runner/work/radare2/radare2/libr/..//libr/bin/p/bin_psxexe.c:48:29: warning: suggest braces around initialization of subobject [-Wmissing-braces]
[1527](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1527)
        psxexe_header psxheader = {0};
[1528](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1528)
                                   ^
[1529](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1529)
                                   {}
[1530](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1530)
2 warnings generated.

rk/radare2/radare2/libr/..//libr/anal/p/anal_xtensa.c
[1707](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1707)
/home/runner/work/radare2/radare2/libr/..//libr/anal/p/anal_x86_cs.c:3505:30: warning: suggest braces around initialization of subobject [-Wmissing-braces]
[1708](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1708)
        cs_detail insnack_detail = {0};
[1709](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1709)
                                    ^
[1710](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1710)
                                    {}
[1711](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1711)
[anal 257] CC /home/runner/work/radare2/radare2/libr/..//libr/anal/p/anal_z80.c
[1712](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1712)
1 warning generated.
[1713](https://github.com/radareorg/radare2/runs/6069734630?check_suite_focus=true#step:4:1713)
[anal 258] CC
alex-bender commented 2 years ago

should it really be changed? I saw some mentions that this warning could be safely ignored if -Wmissing-field-initializers is on.

Clang 6.0 suppresses the warning about missing braces. The svn log says:

Suppress -Wmissing-braces warning when aggregate-initializing a struct with a single field that is itself an aggregate. In C++, such initialization of std::array types is guaranteed to work by the standard, is completely idiomatic, and the "suggested" alternative from Clang was technically invalid.

https://stackoverflow.com/questions/13905200/is-it-wise-to-ignore-gcc-clangs-wmissing-braces-warning

trufae commented 2 years ago

some compilers still complain about this, despite the behaviour is correct i always though that was intended. but r2 should build fine with no warnings withuot the need to pass extra compilation flags

alex-bender commented 2 years ago

ok, will add braces