Skip to content

warning: use of old-style cast to ‘void*’ [-Wold-style-cast] #6316

@visiblehawk

Description

@visiblehawk

Thank you for taking the time to submit an issue!

Background information

What version of Open MPI are you using? (e.g., v1.10.3, v2.1.0, git branch name and hash, etc.)

openmpi-4.0.0

Describe how Open MPI was installed (e.g., from a source/distribution tarball, from a git clone, from an operating system distribution package, etc.)

Compiled from a source/distribution tarball.

Please describe the system on which you are running

  • Operating system/version: Ubuntu 18.10
  • Computer hardware: x86_64 arch
  • Network type:

Details of the problem

This macro in mpi.h produces so many warnings about old-style-cast in any code using OpenMPI, e.g. OpenFOAM opensource package.

#if !OMPI_BUILDING
#define OMPI_PREDEFINED_GLOBAL(type, global) ((type) ((void *) &(global)))
#else
#define OMPI_PREDEFINED_GLOBAL(type, global) ((type) &(global))
#endif

the warnings:

In file included from db/IOstreams/Pstreams/OPwrite.C:29:
db/IOstreams/Pstreams/OPwrite.C: In static member function ‘static bool Foam::OPstream::write(Foam::Pstream::commsTypes, int, const char*, std::streamsize, int, Foam::label)’:
/home/shadowfax/foam/foam-extend-4.1/ThirdParty/packages/openmpi-4.0.0/platforms/linux64GccDPOpt/include/mpi.h:329:72: warning: use of old-style cast to ‘void*’ [-Wold-style-cast]
#define OMPI_PREDEFINED_GLOBAL(type, global) ((type) ((void *) &(global)))
                                                                    ^
/home/shadowfax/foam/foam-extend-4.1/ThirdParty/packages/openmpi-4.0.0/platforms/linux64GccDPOpt/include/mpi.h:1049:18: note: in expansion of macro ‘OMPI_PREDEFINED_GLOBAL’
#define MPI_BYTE OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_byte)
              ^~~~~~~~~~~~~~~~~~~~~~
db/IOstreams/Pstreams/OPwrite.C:101:13: note: in expansion of macro ‘MPI_BYTE’
         MPI_BYTE,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions