Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#417 many compile warnings (-Wall) as of cvs 2011-08-11

open
nobody
None
1
2011-08-26
2011-08-12
Boud Roukema
No

PROBLEM: GDL as of the cvs 2011-08-11 gives many warnings when
compiled with -Wall. i'm not a highly experienced C/C++ programmer,
but AFAIK it's best programming practice to clean these up: they
could indicate subtle errors or lead to errors in the future.

ATTACHED FILES:
compilation output on system1 and system2
-rw-r--r-- 1 user group 22680 2011-08-11 15:13 system1.make_stderr.log.bz2
-rw-r--r-- 1 user group 4332 2011-08-11 15:13 system1.make_stdout.log.bz2
-rw-r--r-- 1 user group 24904 2011-08-11 15:13 system2.make_stderr.log.bz2
-rw-r--r-- 1 user group 4304 2011-08-11 15:13 system2.make_stdout.log.bz2

ANALYSIS:

SYSTEM1

uname -a
Linux <hostname> 2.6.32-31-generic #61-Ubuntu SMP Fri Apr 8 18:25:51 UTC 2011 x86_64 GNU/Linux

dpkg -l |egrep "gcc" |grep -v doc
ii gcc 4:4.4.3-1ubuntu1 The GNU C compiler
ii gcc-4.3 4.3.4-10ubuntu1 The GNU C compiler
ii gcc-4.3-base 4.3.4-10ubuntu1 The GNU Compiler Collection (base package)
ii gcc-4.4 4.4.3-4ubuntu5 The GNU C compiler
ii gcc-4.4-base 4.4.3-4ubuntu5 The GNU Compiler Collection (base package)
ii lib32gcc1 1:4.4.3-4ubuntu5 GCC support library (32 bit Version)
ii libgcc1 1:4.4.3-4ubuntu5 GCC support library

gcc --version
gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3

TZ=GMT LC_ALL=C date
Thu Aug 11 12:49:42 GMT 2011

cvs -z3 -d:pserver:anonymous@gnudatalanguage.cvs.sourceforge.net:/cvsroot/gnudatalanguage co -P gdl

cd gdl
CFLAGS="-O0 -Wall" CXXFLAGS="-O0 -Wall" ./configure --with-hdf=no --with-python=no --with-wxWidgets=no
nice -n 19 make > make_stdout.log 2> make_stderr.log &

head -n 20 make_stderr.log
In file included from dimension.hpp:23,
from basegdl.hpp:27,
from typetraits.hpp:26,
from assocdata.hpp:21,
from assocdata.cpp:20:
typedefs.hpp: In member function 'GDLArray<T>& GDLArray<T>::operator=(const GDLArray<T>&)':
typedefs.hpp:353: warning: suggest explicit braces to avoid ambiguous 'else'
In file included from basegdl.hpp:27,
from typetraits.hpp:26,
from assocdata.hpp:21,
from assocdata.cpp:20:
dimension.hpp: In copy constructor 'dimension::dimension(const dimension&)':
dimension.hpp:49: warning: comparison between signed and unsigned integer expressions
dimension.hpp: In constructor 'dimension::dimension(const SizeT*, SizeT)':
dimension.hpp:57: warning: comparison between signed and unsigned integer expressions
dimension.hpp: In constructor 'dimension::dimension(const DLong*, SizeT)':
dimension.hpp:64: warning: comparison between signed and unsigned integer expressions
dimension.hpp: In member function 'dimension& dimension::operator=(const dimension&)':
dimension.hpp:104: warning: comparison between signed and unsigned integer expressions
dimension.hpp: In member function 'void dimension::operator<<(const dimension&)':

SYSTEM2

uname -a
Linux <hostname> 2.6.26-2-amd64 #1 SMP Mon Jun 13 16:29:33 UTC 2011 x86_64 GNU/Linux

dpkg -l |egrep "gcc" |grep -v doc
ii gcc 4:4.3.2-2 The GNU C compiler
ii gcc-4.1 4.1.2-25 The GNU C compiler
ii gcc-4.1-base 4.1.2-25 The GNU Compiler Collection (base package)
ii gcc-4.2-base 4.2.4-6 The GNU Compiler Collection (base package)
ii gcc-4.3 4.3.2-1.1 The GNU C compiler
ii gcc-4.3-base 4.3.2-1.1 The GNU Compiler Collection (base package)
ii libgcc1 1:4.3.2-1.1 GCC support library

gcc --version
gcc (Debian 4.3.2-1.1) 4.3.2

TZ=GMT LC_ALL=C date
Thu Aug 11 12:49:14 GMT 2011

cvs -z3 -d:pserver:anonymous@gnudatalanguage.cvs.sourceforge.net:/cvsroot/gnudatalanguage co -P gdl

cd gdl
CFLAGS="-O0 -Wall" CXXFLAGS="-O0 -Wall" ./configure --with-hdf=no --with-python=no --with-wxWidgets=no
nice -n 19 make > make_stdout.log 2> make_stderr.log &

head -n 20 make_stderr.log
In file included from dimension.hpp:23,
from basegdl.hpp:27,
from typetraits.hpp:26,
from assocdata.hpp:21,
from assocdata.cpp:20:
typedefs.hpp: In member function 'GDLArray<T>& GDLArray<T>::operator=(const GDLArray<T>&)':
typedefs.hpp:353: warning: suggest explicit braces to avoid ambiguous 'else'
In file included from basegdl.hpp:27,
from typetraits.hpp:26,
from assocdata.hpp:21,
from assocdata.cpp:20:
dimension.hpp: In copy constructor 'dimension::dimension(const dimension&)':
dimension.hpp:49: warning: comparison between signed and unsigned integer expressions
dimension.hpp: In constructor 'dimension::dimension(const SizeT*, SizeT)':
dimension.hpp:57: warning: comparison between signed and unsigned integer expressions
dimension.hpp: In constructor 'dimension::dimension(const DLong*, SizeT)':
dimension.hpp:64: warning: comparison between signed and unsigned integer expressions
dimension.hpp: In member function 'dimension& dimension::operator=(const dimension&)':
dimension.hpp:104: warning: comparison between signed and unsigned integer expressions
dimension.hpp: In member function 'void dimension::operator<<(const dimension&)':

Discussion

  • Boud Roukema
    Boud Roukema
    2011-08-12

    four log files of output from make

     
    Attachments
  • Marc Schellens
    Marc Schellens
    2011-08-26

    • priority: 5 --> 1
     
  • Marc Schellens
    Marc Schellens
    2011-08-26

    Warnings are warnings. I think they are not even defined in the C++ standard. So it depends on the compiler. The few code examples I looked at are ok, so probably all are ok. Note that most of the messages are repetitive as they appear in some header files which are used everywhere. Avoiding harmless warnings is a good idea in order not to oversee important messages. Supressing a warning is only a good idea if it never will be serious in the given context.