Description
From #6120, @gpaulsen noticed that both v4.0.x and master only use the compiler "deprecated" attribute to mark removed MPI functions. Take the following example program:
#include <mpi.h>
int main(int argc, char** argv[])
{
int a;
void *address;
MPI_Address(&a, &address);
return 0;
}
Case 1: master, with MPI-1 compatibility disabled.
- Functions like
MPI_Address
are marked with the__deprecated__
compiler attribute. - Functions like
MPI_Address
are not included in the MPI library.
Meaning:
- The deprecating warning will be emitted
- Including the word "deprecated", which may be a bit confusing (because
MPI_Address
is not deprecated -- it's removed)
- Including the word "deprecated", which may be a bit confusing (because
- The example program will compile successfully
- But it will fail to link
I think it is anti-social to allow the compile to succeed when we know that the link will fail. I think we should somehow make the compile fail (see below).
Case 2: v4.0.x, with MPI-1 compatibility disabled
- Functions like
MPI_Address
are marked with the__deprecated__
compiler attribute. - Functions like
MPI_Address
are included in the MPI library.
Meaning:
- The deprecating warning will be emitted
- Including the word "deprecated", which may be a bit confusing (because
MPI_Address
is not deprecated -- it's removed)
- Including the word "deprecated", which may be a bit confusing (because
- The example program will compile successfully
- The example program will also link successfully.
I'm not sure that this is the message that we want to convey to the community (i.e., that it's still ok to use the removed symbols -- i.e., if it's just a compiler warning, people will ignore it). I thought our intent was to raise the pain level (just a little) so that the greater MPI application community became aware of this issue. As such, my gut reaction is that we should make the compile fail.
Applications that were compiled against v3.0.x or v3.1.x (or even v4.0.x) with MPI_Address
(etc.) will still work because MPI_Address
(etc.) are still in the MPI library. -- which is desirable.
How to make the compile fail?
If we elect to make the compile fail, it's an open question on how to do this.
- The
__deprecated___
function attribute is just a warning. - @gpaulsen and I played with several ways to try to make a compile fail, but yet also still give a helpful error message (e.g., "Stop using MPI_Address. Use MPI_Get_address instead" yadda yadda yadda). This is surprisingly difficult. The only real way to make this happen is to introduce a syntax error somehow (e.g., via
#define MPI_Address(a,b) some kind of syntax error containing the helpful message
, but that's... tricky).
Are these cases really what we want?
- On master: I think it's anti-social to allow the compile to succeed when we know the link will fail.
- On v4.0.x: it's different there, because we know the link will succeed. ...but do we really want the compile to succeed?