pdewacht / oberon-risc-emu

Emulator for the Oberon RISC machine
273 stars 51 forks source link

Switches without default case (Clang static analizer) #5

Closed blinkkin closed 10 years ago

blinkkin commented 10 years ago

I used static analyzer provided by Clang/LLVM to build emulator. There are two complains about switches without default cases which could lead to usage of uninitialized variables. Probably not a real issues, since I guess those switches can't test against values other than those already specified. Bellow is a link to output from Clang:

http://blinkkin.piasta.pl/share/scanbuild/index.html

pdewacht commented 10 years ago

In both cases it's a switch on a 4 bit value and all possible cases are provided, so these are false alerts.

I guess I could add "default: assert(false)"...

blinkkin commented 10 years ago

Not sure if it is worth it, beside silencing false positive warnings... so none stumbles upon it again.