Compilation warnings

Hello,

I am moving from SLC5 to SLC6. My software that links against ROOT gives warnings with gcc 4.4.6.

g++ -c -g  -I/opt/root/include  -Dlong32="int"  -DdatePointer="long" -I/date/rorc -I/date/runControl -I/date/readList -I/date/eventBuilder -I/date/banksManager -I/date/bufferManager -I/date/db -I/date/commonDefs -I/date/monitoring -I/date/infoLogger -I/date/logbook  -I/opt/smi/smixx -I/opt/dim/dim  -I/usr/include/mysql -I/opt/amore/include/amore -I. -pthread -m64   -fPIC -W -Wall -Wextra -Wconversion -Wdisabled-optimization -Wno-unused  -c AgentsListTree.cxx

/opt/root/include/TMathBase.h: In function ‘Short_t TMath::Abs(Short_t)’:
/opt/root/include/TMathBase.h:101: warning: conversion to ‘Short_t’ from ‘int’ may alter its value
/opt/root/include/TMathBase.h: In function ‘Short_t TMath::Sign(Short_t, Short_t)’:
/opt/root/include/TMathBase.h:121: warning: conversion to ‘Short_t’ from ‘int’ may alter its value

/opt/root/include/TString.h: In member function ‘TString& TString::Append(const char*)’:
/opt/root/include/TString.h:482: warning: conversion to ‘Ssiz_t’ from ‘long unsigned int’ may alter its value
/opt/root/include/TString.h: In member function ‘TString& TString::operator+=(const char*)’:
/opt/root/include/TString.h:494: warning: conversion to ‘Ssiz_t’ from ‘long unsigned int’ may alter its value
// Many more of in TString.h

/opt/root/include/TClass.h: In member function ‘void TClass::SetDeclFile(const char*, int)’:
/opt/root/include/TClass.h:342: warning: conversion to ‘Short_t’ from ‘int’ may alter its value

/opt/root/include/TEveBrowser.h: In member function ‘virtual Int_t TEveListTreeItem::GetTextLength() const’:
/opt/root/include/TEveBrowser.h:48: warning: conversion to ‘Int_t’ from ‘size_t’ may alter its value

There are many more from various ROOT classes.
Is it something I should worry ? Because I actually worry when I see that we convert int to short.
How can I get rid of them ? Could it be some compilation flags I use ?

Thank you

Hi again,

Could anyone confirm these warnings on SLC6 ?

Thank you
Barth

Hi,

this is hard to confirm without some basic example. If your code compiled fine before under SL5 and 32bit many of these warnings (from -Wconversion) could show up now under SL6 and 64bit since your code implicitly relied on some types having a certain size. As for the ROOT side my impression was that with the more aggressive test compiles with a number of compilers the implementation quality had improved a lot in recent years, but you might still run across some oddity.