Algebraic-Programming / LPF

A minimal communication layer for the implementation of immortal algorithms and for facilitating their broad use.
Apache License 2.0
5 stars 1 forks source link

Under GCC 11.4, new warning is raised (-Wodr) #34

Open anyzelman opened 1 day ago

anyzelman commented 1 day ago

This seems due to the "double-include trick" used by the hybrid backend:

/home/yzelman/lpf.github/src/MPI/ibverbs.hpp:48:21: warning: type ‘struct IBVerbs’ violates the C++ One Definition Rule [-Wodr]
   48 | class _LPFLIB_LOCAL IBVerbs
      |                     ^
/home/yzelman/lpf.github/src/MPI/ibverbs.hpp:48:21: note: a different type is defined in another translation unit
   48 | class _LPFLIB_LOCAL IBVerbs
      |                     ^
/home/yzelman/lpf.github/src/MPI/ibverbs.hpp:128:34: note: the first difference of corresponding definitions is field ‘m_activePeers’
  128 |     SparseSet< pid_t >           m_activePeers; //
      |                                  ^
/home/yzelman/lpf.github/src/MPI/ibverbs.hpp:128:34: note: a field of same name but different type is defined in another translation unit
  128 |     SparseSet< pid_t >           m_activePeers; //
      |                                  ^
/home/yzelman/lpf.github/src/common/sparseset.hpp:35:7: note: type name ‘lpf::SparseSet<int>’ should match type name ‘lpf::SparseSet<unsigned int>’
   35 | class SparseSet
      |       ^
/home/yzelman/lpf.github/src/MPI/mesgqueue.hpp:42:21: warning: type ‘struct MessageQueue’ violates the C++ One Definition Rule [-Wodr]
   42 | class _LPFLIB_LOCAL MessageQueue
      |                     ^
/home/yzelman/lpf.github/src/MPI/mesgqueue.hpp:42:21: note: a different type is defined in another translation unit
   42 | class _LPFLIB_LOCAL MessageQueue
      |                     ^
/home/yzelman/lpf.github/src/MPI/mesgqueue.hpp:136:18: note: the first difference of corresponding definitions is field ‘m_ibverbs’
  136 |     mpi::IBVerbs m_ibverbs;
      |                  ^
/home/yzelman/lpf.github/src/MPI/mesgqueue.hpp:136:18: note: a field of same name but different type is defined in another translation unit
  136 |     mpi::IBVerbs m_ibverbs;
      |                  ^
/home/yzelman/lpf.github/src/MPI/ibverbs.hpp:48:21: note: type ‘struct IBVerbs’ itself violates the C++ One Definition Rule
   48 | class _LPFLIB_LOCAL IBVerbs
      |                     ^
/home/yzelman/lpf.github/src/MPI/ibverbs.hpp:48:21: warning: type ‘struct IBVerbs’ violates the C++ One Definition Rule [-Wodr]
   48 | class _LPFLIB_LOCAL IBVerbs
      |                     ^
/home/yzelman/lpf.github/src/MPI/ibverbs.hpp:48:21: note: a different type is defined in another translation unit
   48 | class _LPFLIB_LOCAL IBVerbs
      |                     ^
/home/yzelman/lpf.github/src/MPI/ibverbs.hpp:128:34: note: the first difference of corresponding definitions is field ‘m_activePeers’
  128 |     SparseSet< pid_t >           m_activePeers; //
      |                                  ^
/home/yzelman/lpf.github/src/MPI/ibverbs.hpp:128:34: note: a field of same name but different type is defined in another translation unit
  128 |     SparseSet< pid_t >           m_activePeers; //
      |                                  ^
/home/yzelman/lpf.github/src/common/sparseset.hpp:35:7: note: type name ‘lpf::SparseSet<int>’ should match type name ‘lpf::SparseSet<unsigned int>’
   35 | class SparseSet
      |       ^
/home/yzelman/lpf.github/src/MPI/mesgqueue.hpp:42:21: warning: type ‘struct MessageQueue’ violates the C++ One Definition Rule [-Wodr]
   42 | class _LPFLIB_LOCAL MessageQueue
      |                     ^
/home/yzelman/lpf.github/src/MPI/mesgqueue.hpp:42:21: note: a different type is defined in another translation unit

We should probably look into how to name them differently and thus avoid this warning.

anyzelman commented 1 day ago

Actually scratch the above intuition: this warning appears when linking

  1. liblpf_core_univ_ibverbs_Release
  2. liblpf_core_spec_ibverbs_Release
  3. liblpf_core_univ_hybrid_Release
  4. liblpf_core_spec_hybrid_Release

It seems hence related to the ibverbs engine specifically.