#156 g++ 4.2 compile warnings cleanup

open
None
2
2010-03-04
2007-10-28
Hypo Stases
No

OS: linux, Debian,
Compiler. g++, g++ -v
Using built-in specs.
Target: i486-linux-gnu
gcc version 4.2.1 (Debian 4.2.1-3)

Aspell: aspell-0.61-20071019.tar.gz

Aspell configured by:
./configure --prefix=$(BUILD) \ --enable-static=yes \ --enable-shared=no \ CXXFLAGS="-g -W -Wall -Wpointer-arith -pipe -$(OPT_FLAFS)"

where
OPT_FLAGS:= -O3 -ffast-math \ -finline-functions -funroll-all-loops \ -finline-limit=1000 \ -mmmx -msse -foptimize-sibling-calls

The following warnings cared by the attached patch
1) g++ -DHAVE_CONFIG_H -I. -I./gen -I./gen -I./common -I./interfaces/cc/ -I./modules/speller/default/ -DLOCALEDIR=/home/robert/rcontext/build/share/locale -W -Wall -Wpointer-arith -pipe -g -mtune=pentium4 -mcpu=pentium4 -MT modules/filter/texinfo.lo -MD -MP -MF modules/filter/.deps/texinfo.Tpo -c modules/filter/texinfo.cpp -o modules/filter/texinfo.o
In file included from ./common/posib_err.hpp:10,
from ./common/config.hpp:12,
from modules/filter/texinfo.cpp:8:
./common/string.hpp: In copy constructor 'aspell::String::String(const aspell::String&)':
./common/string.hpp:148: warning: base class 'class aspell::OStream' should be explicitly initialized in the copy constructorIn file included from modules/filter/texinfo.cpp:11:
./common/string_map.hpp: In copy constructor 'aspell::StringMap::StringMap(const aspell::StringMap&)':
./common/string_map.hpp:49: warning: base class 'class aspell::MutableContainer' should be explicitly initialized in the copy constructor

2. g++ -DHAVE_CONFIG_H -I. -I./gen -I./gen -I./common -I./interfaces/cc/ -I./modules/speller/default/ -DLOCALEDIR=/home/robert/rcontext/build/share/locale -W -Wall -Wpointer-arith -pipe -g -mtune=pentium4 -mcpu=pentium4 -MT common/string_list.lo -MD -MP -MF common/.deps/string_list.Tpo -c common/string_list.cpp -o common/string_list.o
In file included from common/string_list.hpp:9,
from common/string_list.cpp:7:
common/string.hpp: In copy constructor 'aspell::String::String(const aspell::String&)':
common/string.hpp:148: warning: base class 'class aspell::OStream' should be explicitly initialized in the copy constructor
In file included from common/string_list.cpp:7:
common/string_list.hpp: In copy constructor 'aspell::StringList::StringList(const aspell::StringList&)':
common/string_list.hpp:64: warning: base class 'class aspell::MutableContainer' should be explicitly initialized in the copy constructor

3. g++ -DHAVE_CONFIG_H -I. -I./gen -I./gen -I./common -I./interfaces/cc/ -I./modules/speller/default/ -DLOCALEDIR="/home/robert/rcontext/build/share/locale" -W -Wall -Wpointer-arith -pipe -g -mtune=pentium4 -mcpu=pentium4 -MT prog/aspell.o -MD -MP -MF $depbase.Tpo -c -o prog/aspell.o prog/aspell.cpp &&\ mv -f $depbase.Tpo $depbase.Po
In file included from ./common/file_util.hpp:14,
from prog/aspell.cpp:37:
./common/string.hpp: In copy constructor 'aspell::String::String(const aspell::String&)':
./common/string.hpp:148: warning: base class 'class aspell::OStream' should be explicitly initialized in the copy constructorIn file included from prog/aspell.cpp:42

3 and 4. g++ -DHAVE_CONFIG_H -I. -I./gen -I./gen -I./common -I./interfaces/cc/ -I./modules/speller/default/ -DLOCALEDIR="/home/robert/rcontext/build/share/locale" -W -Wall -Wpointer-arith -pipe -g -mtune=pentium4 -mcpu=pentium4 -MT prog/aspell.o -MD -MP -MF $depbase.Tpo -c -o prog/aspell.o prog/aspell.cpp &&\ mv -f $depbase.Tpo $depbase.Po
In file included from ./common/file_util.hpp:14,
from prog/aspell.cpp:37:
./common/string.hpp: In copy constructor 'aspell::String::String(const aspell::String&)':
./common/string.hpp:148: warning: base class 'class aspell::OStream' should be explicitly initialized in the copy constructorIn file included from prog/aspell.cpp:42:
./common/convert.hpp: At global scope:
./common/convert.hpp:36: warning: unused parameter 'code'
In file included from prog/aspell.cpp:52:
./common/string_map.hpp: In copy constructor 'aspell::StringMap::StringMap(const aspell::StringMap&)':
./common/string_map.hpp:49: warning: base class 'class aspell::MutableContainer' should be explicitly initialized in the copy constructor
In file included from prog/aspell.cpp:55:
./common/string_list.hpp: In copy constructor 'aspell::StringList::StringList(const aspell::StringList&)':
./common/string_list.hpp:64: warning: base class 'class aspell::MutableContainer' should be explicitly initialized in the copy constructor
In file included from ./modules/speller/default/data.hpp:10,
from ./modules/speller/default/speller_impl.hpp:9,
from prog/aspell.cpp:56:
./modules/speller/default/lang_impl.hpp: At global scope:
./modules/speller/default/lang_impl.hpp:248: warning: unused parameter 'wi'

Discussion

  • Hypo Stases
    Hypo Stases
    2007-10-28

    Patch to cleanup warnings

     
  • Kevin Atkinson
    Kevin Atkinson
    2007-11-28

    • priority: 5 --> 1
     
  • Kevin Atkinson
    Kevin Atkinson
    2007-11-28

    Logged In: YES
    user_id=6591
    Originator: NO

    You are compiling with -W. Which according to the gcc manual:

    The following `-W...' options are not implied by `-Wall'. Some of
    them warn about constructions that users generally do not consider
    questionable, but which occasionally you might wish to check for;
    others warn about constructions that are necessary or hard to avoid in
    some cases, and there is no simple way to modify the code to suppress
    the warning.

    Thus I do not thing it is necessary to fix these these errors.

    I need to review each case and see if it is really fixing or bug, and more importantly if it is correct to initialize the copy constructor.

     
  • Kevin Atkinson
    Kevin Atkinson
    2007-11-28

    • priority: 1 --> 2
     
  • Kevin Atkinson
    Kevin Atkinson
    2007-11-28

    Logged In: YES
    user_id=6591
    Originator: NO

    I will clean up the unused parameters warnings since fixing them is safe. However, to fix:
    int foo (int x, int y) {return x;}
    use
    int foo (int x, int) {return x;}
    not
    int foo (int x, int y) {(void)y; return x;}
    as you have.

    So if you could attach a separate patch for that I would appreciate it.

    Thanks in advance.

     
  • Kevin Atkinson
    Kevin Atkinson
    2010-03-04

    • labels: 444567 -->