[mpich-discuss] GCC Compiler Warnings in mpicxx.h when compiling with -Wcast-qual
Jeff Hammond
jeff.science at gmail.com
Sun Oct 22 11:50:41 CDT 2017
MPI-3 added const in a bunch of places while also deleting the C++ bindings
so these issues are not surprising. They’re also innocuous and should be
ignored. If they bother you too much, they are very easy to fix and I’m
sure a patch would be appreciated.
Jeff
On Sun, Oct 22, 2017 at 7:39 AM Vincent Bode <vincent at jd-bode.de> wrote:
> Dear MPICH Discuss,
>
>
>
> When compiling a program that includes the header mpi.h with the GCC
> Compiler option –Wcast-qual several compiler warnings occur in mpicxx.h:
>
>
>
> In file included from /usr/include/mpich/mpi.h:2231:0,
>
> /usr/include/mpich/mpicxx.h: In member function ‘virtual void
> MPI::Datatype::Set_attr(int, const void*)’:
>
> /usr/include/mpich/mpicxx.h:335:90: warning: cast from type ‘const
> void*’ to type ‘void*’ casts away qualifiers [-Wcast-qual]
>
> MPIX_CALLWORLD( MPI_Type_set_attr( (MPI_Datatype)
> the_real_datatype, v2, (void *)v3 ));
>
>
> ^
>
> /usr/include/mpich/mpicxx.h:87:17: note: in definition of macro
> ‘MPIX_CALLWORLD’
>
> { int err = fnc ; if (err) MPIR_Call_world_errhand( err ); }
>
> ^
>
>
>
> There appear to be 17 compiler warnings of this type:
>
>
>
> mpicxx.h:335, GNU C Compiler 4 (gcc), Priority: Normal
>
> cast from type ‘const void*’ to type ‘void*’ casts away qualifiers
> [-Wcast-qual]
>
>
>
> mpicxx.h:633, GNU C Compiler 4 (gcc), Priority: Normal
>
> cast from type ‘const int (*)[3]’ to type ‘int (*)[3]’ casts away
> qualifiers [-Wcast-qual]
>
>
>
> mpicxx.h:639, GNU C Compiler 4 (gcc), Priority: Normal
>
> cast from type ‘const int (*)[3]’ to type ‘int (*)[3]’ casts away
> qualifiers [-Wcast-qual]
>
>
>
> mpicxx.h:1087, GNU C Compiler 4 (gcc), Priority: Normal
>
> cast from type ‘const MPI_Request* {aka const int*}’ to type ‘MPI_Request*
> {aka int*}’ casts away qualifiers [-Wcast-qual]
>
>
>
> mpicxx.h:1412, GNU C Compiler 4 (gcc), Priority: Normal
>
> cast from type ‘const void*’ to type ‘void*’ casts away qualifiers
> [-Wcast-qual]
>
>
>
> mpicxx.h:1690, GNU C Compiler 4 (gcc), Priority: Normal
>
> cast from type ‘const char*’ to type ‘char*’ casts away qualifiers
> [-Wcast-qual]
>
>
>
> mpicxx.h:1691, GNU C Compiler 4 (gcc), Priority: Normal
>
> cast from type ‘const char**’ to type ‘char**’ casts away qualifiers
> [-Wcast-qual]
>
>
>
> mpicxx.h:1698, GNU C Compiler 4 (gcc), Priority: Normal
>
> cast from type ‘const char*’ to type ‘char*’ casts away qualifiers
> [-Wcast-qual]
>
>
>
> mpicxx.h:1699, GNU C Compiler 4 (gcc), Priority: Normal
>
> cast from type ‘const char**’ to type ‘char**’ casts away qualifiers
> [-Wcast-qual]
>
>
>
> mpicxx.h:1712, GNU C Compiler 4 (gcc), Priority: Normal
>
> cast from type ‘const char**’ to type ‘char**’ casts away qualifiers
> [-Wcast-qual]
>
>
>
> mpicxx.h:1713, GNU C Compiler 4 (gcc), Priority: Normal
>
> cast from type ‘const char***’ to type ‘char***’ casts away qualifiers
> [-Wcast-qual]
>
>
>
> mpicxx.h:1713, GNU C Compiler 4 (gcc), Priority: Normal
>
> cast from type ‘const int*’ to type ‘int*’ casts away qualifiers
> [-Wcast-qual]
>
>
>
> mpicxx.h:1727, GNU C Compiler 4 (gcc), Priority: Normal
>
> cast from type ‘const char**’ to type ‘char**’ casts away qualifiers
> [-Wcast-qual]
>
>
>
> mpicxx.h:1728, GNU C Compiler 4 (gcc), Priority: Normal
>
> cast from type ‘const char***’ to type ‘char***’ casts away qualifiers
> [-Wcast-qual]
>
> mpicxx.h:1728, GNU C Compiler 4 (gcc), Priority: Normal
>
> cast from type ‘const int*’ to type ‘int*’ casts away qualifiers
> [-Wcast-qual]
>
>
>
> mpicxx.h:1851, GNU C Compiler 4 (gcc), Priority: Normal
>
> cast from type ‘const void*’ to type ‘void*’ casts away qualifiers
> [-Wcast-qual]
>
>
>
> mpicxx.h:1872, GNU C Compiler 4 (gcc), Priority: Normal
>
> cast from type ‘const void*’ to type ‘void*’ casts away qualifiers
> [-Wcast-qual]
>
>
>
> A minimum working example of just translating the MPICH mpi.h header using
>
>
>
> mpicxx.mpich -o /tmp/test.o -c -fPIC -O3 -g -cxx=g++ -Wall -Wextra
> -Wcast-qual -Wconversion -Wformat=2 -Wformat-nonliteral -Wformat-security
> -Winit-self -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked
> -Wunreachable-code -Wunused -Wno-unused-parameter -Wswitch-enum
> -Wredundant-decls -pedantic -Wswitch-default -fno-strict-aliasing
> -funroll-loops -mfpmath=sse -fopenmp -fno-omit-frame-pointer -msse3 -fPIC
> -std=c++11 /usr/include/mpich/mpi.h
>
>
>
> produces the same compiler warnings on the following environment (mpich
> packages from the debian repository):
>
>
>
> debian at debian:~$ mpicxx.mpich -v
>
> mpicxx for MPICH version 3.2
>
> Using built-in specs.
>
> COLLECT_GCC=g++
>
> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper
>
> Target: x86_64-linux-gnu
>
> Configured with: ../src/configure -v --with-pkgversion='Debian 6.3.0-18'
> --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs
> --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
> --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --enable-shared
> --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext
> --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/
> --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes
> --with-default-libstdcxx-abi=new --enable-gnu-unique-object
> --disable-vtable-verify --enable-libmpx --enable-plugin
> --enable-default-pie --with-system-zlib --disable-browser-plugin
> --enable-java-awt=gtk --enable-gtk-cairo
> --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home
> --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64
> --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64
> --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
> --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch
> --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
> --enable-multilib --with-tune=generic --enable-checking=release
> --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
>
> Thread model: posix
>
> gcc version 6.3.0 20170516 (Debian 6.3.0-18)
>
>
>
> Sincerely,
>
> Vincent
>
>
>
>
> _______________________________________________
> discuss mailing list discuss at mpich.org
> To manage subscription options or unsubscribe:
> https://lists.mpich.org/mailman/listinfo/discuss
--
Jeff Hammond
jeff.science at gmail.com
http://jeffhammond.github.io/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpich.org/pipermail/discuss/attachments/20171022/501b02b7/attachment.html>
-------------- next part --------------
_______________________________________________
discuss mailing list discuss at mpich.org
To manage subscription options or unsubscribe:
https://lists.mpich.org/mailman/listinfo/discuss
More information about the discuss
mailing list