gnudatalanguage / gdl

GDL - GNU Data Language
GNU General Public License v2.0
274 stars 61 forks source link

cleanup switch in hdf5_fun.cpp #1222

Open alaingdl opened 2 years ago

alaingdl commented 2 years ago

Hi. Not urgent, not critical ... Could someone (@ogressel ?) takes the time to help Clang on that :

[ 16%] Building CXX object src/CMakeFiles/gdl.dir/hdf5_fun.cpp.o
/Users/alaingdl/GDL/last-gdl/src/hdf5_fun.cpp:407:13: warning: 16 enumeration values not handled in switch: 'H5I_UNINIT', 'H5I_BADID', 'H5I_FILE'... [-Wswitch]
    switch( H5Iget_type(loc_id) ) {
            ^
/Users/alaingdl/GDL/last-gdl/src/hdf5_fun.cpp:407:13: note: add missing switch cases
    switch( H5Iget_type(loc_id) ) {
            ^
1 warning generated.

Thanks !

A.

ogressel commented 2 years ago

Amazing how pedantic compilers can be. Maybe I'll just use if/else instead, lol. Only the tested values are possible here since this gets called manually. Will fix it when I get a chance...

alaingdl commented 2 years ago

Clang is especially pedantic ! Conversely, some pedantry could help the code to survive when we do forget a case ... (we did have some case we just forgot to test null, and on some cases null is not null, and other cases null is null ... ) ((-DCMAKE_CXX_FLAGS="-fsanitize=null"))

Take your time, good tests are way more critical.