disberd / gnuplot-cpp

Automatically exported from code.google.com/p/gnuplot-cpp
0 stars 0 forks source link

Multiple warnings issued by g++ and clang++ compilers #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. compile with -ansi -pedantic -Wall using clang++ 
2. compile with -ansi -pedantic -Wall using g++ 
3.

What is the expected output? What do you see instead?

Expected output is to have no warnings or errors. Instead, I see:

$ clang++ -ansi -pedantic -Wall example.cc
In file included from example.cc:10:
./gnuplot_i.hpp:259:64: warning: extra ';' inside a class [-pedantic]
    inline Gnuplot& unset_smooth(){ smooth = ""; return *this;}; 
                                                               ^
./gnuplot_i.hpp:266:63: warning: extra ';' inside a class [-pedantic]
    inline Gnuplot& set_grid()  {cmd("set grid");return *this;};
                                                               ^
./gnuplot_i.hpp:268:66: warning: extra ';' inside a class [-pedantic]
    inline Gnuplot& unset_grid(){cmd("unset grid");return *this;}; 
                                                                 ^
./gnuplot_i.hpp:277:73: warning: extra ';' inside a class [-pedantic]
    inline Gnuplot& set_multiplot(){cmd("set multiplot") ;return *this;};
                                                                        ^
./gnuplot_i.hpp:286:76: warning: extra ';' inside a class [-pedantic]
    inline Gnuplot& unset_multiplot(){cmd("unset multiplot");return *this;};
                                                                           ^
./gnuplot_i.hpp:302:63: warning: extra ';' inside a class [-pedantic]
    Gnuplot& set_hidden3d(){cmd("set hidden3d");return *this;};
                                                              ^
./gnuplot_i.hpp:311:75: warning: extra ';' inside a class [-pedantic]
    inline Gnuplot& unset_hidden3d(){cmd("unset hidden3d"); return *this;}; 
                                                                          ^
./gnuplot_i.hpp:323:72: warning: extra ';' inside a class [-pedantic]
    inline Gnuplot& unset_contour(){cmd("unset contour");return *this;};
                                                                       ^
./gnuplot_i.hpp:332:68: warning: extra ';' inside a class [-pedantic]
    inline Gnuplot& set_surface(){cmd("set surface");return *this;}; 
                                                                   ^
./gnuplot_i.hpp:409:101: warning: extra ';' inside a class [-pedantic]
  ...xrange restore");cmd("set autoscale x");return *this;};
                                                           ^
./gnuplot_i.hpp:418:101: warning: extra ';' inside a class [-pedantic]
  ...yrange restore");cmd("set autoscale y");return *this;};
                                                           ^
./gnuplot_i.hpp:427:101: warning: extra ';' inside a class [-pedantic]
  ...zrange restore");cmd("set autoscale z");return *this;};
                                                           ^
./gnuplot_i.hpp:444:78: warning: extra ';' inside a class [-pedantic]
    inline Gnuplot& unset_xlogscale(){cmd("unset logscale x"); return *this;};
                                                                             ^
./gnuplot_i.hpp:453:78: warning: extra ';' inside a class [-pedantic]
    inline Gnuplot& unset_ylogscale(){cmd("unset logscale y"); return *this;};
                                                                             ^
./gnuplot_i.hpp:462:78: warning: extra ';' inside a class [-pedantic]
    inline Gnuplot& unset_zlogscale(){cmd("unset logscale z"); return *this;};
                                                                             ^
./gnuplot_i.hpp:563:78: warning: extra ';' inside a class [-pedantic]
    inline Gnuplot& replot(void){if (nplots > 0) cmd("replot");return *this;};
                                                                             ^
./gnuplot_i.hpp:582:43: warning: extra ';' inside a class [-pedantic]
    inline bool is_valid(){return(valid);};
                                          ^
./gnuplot_i.hpp:1874:1: warning: control may reach end of non-void function
      [-Wreturn-type]
}
^
18 warnings generated.

g++ also generates warnings, but not as many:

$ g++ -ansi -pedantic -Wall example.cc
In file included from example.cc:10:
gnuplot_i.hpp: In member function ‘Gnuplot& Gnuplot::plot_image(const 
unsigned char*, unsigned int, unsigned int, const std::string&)’:
gnuplot_i.hpp:1600: warning: comparison between signed and unsigned integer 
expressions
gnuplot_i.hpp:1602: warning: comparison between signed and unsigned integer 
expressions
gnuplot_i.hpp: In member function ‘bool Gnuplot::file_available(const 
std::string&)’:
gnuplot_i.hpp:1874: warning: control reaches end of non-void function
[kmess@bellagio gnuplot-cpp]$

What version of the product are you using? On what operating system?
version 3, dated 10/03/08

$ uname -a
Linux bellagio 2.6.32-358.6.2.el6.centos.plus.i686 #1 SMP Thu May 16 17:02:17 
UTC 2013 i686 i686 i386 GNU/Linux
$ g++ --version
g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ clang++ --version
clang version 2.8 (branches/release_28)
Target: i386-redhat-linux-gnu
Thread model: posix

Please provide any additional information below.

Original issue reported on code.google.com by kevin.m...@gmail.com on 30 May 2013 at 6:25

GoogleCodeExporter commented 9 years ago
The current svn-head does not show the mentioned problems.

Here the output of gcc:

$ g++ -ansi -pedantic -Wall example.cc && gcc -v 
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.7/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 
4.7.3-1ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs 
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr 
--program-suffix=-4.7 --enable-shared --enable-linker-build-id 
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix 
--with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls 
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug 
--enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin 
--with-system-zlib --enable-objc-gc --enable-targets=all --with-cloog 
--enable-cloog-backend=ppl --disable-cloog-version-check 
--disable-ppl-version-check --enable-multiarch --disable-werror 
--with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --with-tune=generic 
--enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu 
--target=i686-linux-gnu
Thread model: posix
gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1) 

Here the output of clang++:
$ clang++ -pedantic -Wall example.cc && gcc -v 
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.7/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 
4.7.3-1ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs 
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr 
--program-suffix=-4.7 --enable-shared --enable-linker-build-id 
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix 
--with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls 
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug 
--enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin 
--with-system-zlib --enable-objc-gc --enable-targets=all --with-cloog 
--enable-cloog-backend=ppl --disable-cloog-version-check 
--disable-ppl-version-check --enable-multiarch --disable-werror 
--with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --with-tune=generic 
--enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu 
--target=i686-linux-gnu
Thread model: posix
gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1)

Original comment by ettl.mar...@gmail.com on 2 Nov 2013 at 6:47