Warnings during compilation, related to /G4LEPTSElossDistr. and G4LEPTSDiffXS

Hi

I compiled ROOT and std=C++14 was enabled by default, so I compiled also GEANT4 with same standard :

sudo cmake -DCMAKE_INSTALL_PREFIX=…/GEANT4.10.07.p01 -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_QT=ON -DGEANT4_USE_RAYTRACER_X11=OFF -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_GDML=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGEANT4_USE_XM=OFF -DGEANT4_ENABLE_TESTING=OFF -DGEANT4_BUILD_CXXSTD=14 -DGEANT4_USE_RAYTRACER_X11=OFF -DGEANT4_USE_SYSTEM_CLHEP=OFF -DGEANT4_USE_SYSTEM_ZLIB=OFF …/geant4.10.07.p01

During make or make install(don’t remember which one) I get these warnings :

/home/dz/products/geant4.10.07.p01/source/processes/electromagnetic/dna/models/src/G4LEPTSElossDistr.cc: In member function ‘void G4LEPTSElossDistr::ReadFile()’:
/home/dz/products/geant4.10.07.p01/source/processes/electromagnetic/dna/models/src/G4LEPTSElossDistr.cc:55:16: warning: ignoring return value of ‘int fscanf(FILE*, const char*, …)’, declared with attribute warn_unused_result [-Wunused-result]
55 | (void) fscanf(fp,"%i \n",&nEnergies);
| ^~~~~~~~~~~~~~~~~
/home/dz/products/geant4.10.07.p01/source/processes/electromagnetic/dna/models/src/G4LEPTSElossDistr.cc:58:18: warning: ignoring return value of ‘int fscanf(FILE*, const char*, …)’, declared with attribute warn_unused_result [-Wunused-result]
58 | (void) fscanf(fp,"%f \n",&energySep);
| ^~~~~~~~~~~~~~~~~
/home/dz/products/geant4.10.07.p01/source/processes/electromagnetic/dna/models/src/G4LEPTSElossDistr.cc:59:18: warning: ignoring return value of ‘int fscanf(FILE*, const char*, …)’, declared with attribute warn_unused_result [-Wunused-result]
59 | (void) fscanf(fp,"%i \n",&nAngles);
| ^~~~~~~~~~~~~~~
/home/dz/products/geant4.10.07.p01/source/processes/electromagnetic/dna/models/src/G4LEPTSElossDistr.cc:62:20: warning: ignoring return value of ‘int fscanf(FILE*, const char*, …)’, declared with attribute warn_unused_result [-Wunused-result]
62 | (void) fscanf(fp,"%f \n",&angleSep);
| ^~~~~~~~~~~~~~~~
/home/dz/products/geant4.10.07.p01/source/processes/electromagnetic/dna/models/src/G4LEPTSElossDistr.cc:69:20: warning: ignoring return value of ‘int fscanf(FILE*, const char*, …)’, declared with attribute warn_unused_result [-Wunused-result]
69 | (void) fscanf(fp,"%i \n",&nData);
| ^~~~~~~~~~~~~

/home/dz/products/geant4.10.07.p01/source/processes/electromagnetic/dna/models/src/G4LEPTSDiffXS.cc: In member function ‘void G4LEPTSDiffXS::readDXS()’:
/home/dz/products/geant4.10.07.p01/source/processes/electromagnetic/dna/models/src/G4LEPTSDiffXS.cc:71:16: warning: ignoring return value of ‘int fscanf(FILE*, const char*, …)’, declared with attribute warn_unused_result [-Wunused-result]
71 | (void) fscanf(fp, “%d %d %s”, &NumAng, &NumEn, DXSTypeName);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dz/products/geant4.10.07.p01/source/processes/electromagnetic/dna/models/src/G4LEPTSDiffXS.cc:80:18: warning: ignoring return value of ‘int fscanf(FILE*, const char*, …)’, declared with attribute warn_unused_result [-Wunused-result]
80 | (void) fscanf(fp,"%f “,&data);
| ^~~~~~~~~~
/home/dz/products/geant4.10.07.p01/source/processes/electromagnetic/dna/models/src/G4LEPTSDiffXS.cc:90:20: warning: ignoring return value of ‘int fscanf(FILE*, const char*, …)’, declared with attribute warn_unused_result [-Wunused-result]
90 | (void) fscanf(fp,”%f “,&data);
| ^~~~~~~~~~
/home/dz/products/geant4.10.07.p01/source/processes/electromagnetic/dna/models/src/G4LEPTSDiffXS.cc:93:15: warning: ignoring return value of ‘int fscanf(FILE*, const char*, …)’, declared with attribute warn_unused_result [-Wunused-result]
93 | (void) fscanf(fp,”%f %f “,&data2, &data);
| ^~~~~~~~~~~~~~~~~~~~~
/home/dz/products/geant4.10.07.p01/source/processes/electromagnetic/dna/models/src/G4LEPTSDiffXS.cc:102:15: warning: ignoring return value of ‘int fscanf(FILE*, const char*, …)’, declared with attribute warn_unused_result [-Wunused-result]
102 | (void) fscanf(fp,”%f ",&data);
| ^~~~~~~~~~

Should I worry about that ? example B1 works fine(since I’m using wsl2 and get a lot of drivers trubles)

Regards
Mehdi

Which OS/version and compiler/version is this in WSL? Generally warnings about unused result can be safely ignored.

Hi,

by default my compiler(gcc 9.3.0) uses standard 14 of C++, so I rebuild everything with -DGEANT4_BUILD_CXXSTD=11 and this error disapear. For information, that is done in windows 10 pro 21H1; wsl 2; ubuntu 20.04. It works pretty fine ! just some latence issues at high perf needed stuf like I mentioned it in another post