Skip to content

Avoid error when MPI's atexit is redefined via a macro

James Willenbring requested to merge jbakosi:atexit into develop

Created by: jbakosi

When compiled using Charm++'s Adaptive MPI, MPI's atexit is redfined via a macro, in AMPI's mpi.h at

https://github.com/UIUC-PPL/charm/blob/charm/src/libs/ck-libs/ampi/ampi.h#L46.

This commit prevents the following error:

<trilinos>/packages/teuchos/comm/src/Teuchos_PerformanceMonitorBase.hpp: In static membe
r function ‘static Teuchos::TableFormat& Teuchos::PerformanceMonitorBase<T>::format()’:
<ampi>/charm/bin/../include/mpi.h:34:21: error: expected primary-expression before ‘do’
 #define atexit(...) do {atexit(__VA_ARGS__); atexit((void (*)())ampiMarkAtexit);} while(0)
                     ^
<trilinos>/packages/teuchos/comm/src/Teuchos_PerformanceMonitorBase.hpp:225:16: note: in
 expansion of macro ‘atexit’
         (void) atexit(freeTableFormat);
                ^~~~~~
<trilinos>/packages/teuchos/comm/src/Teuchos_PerformanceMonitorBase.hpp: In static membe
r function ‘static std::map<std::__cxx11::basic_string<char>, Teuchos::RCP<T1> >& Teuchos::PerformanceMonitorBase<T>::co
unters()’:
<ampi>/charm/bin/../include/mpi.h:34:21: error: expected primary-expression before ‘do’
 #define atexit(...) do {atexit(__VA_ARGS__); atexit((void (*)())ampiMarkAtexit);} while(0)
                     ^
<trilinos>/packages/teuchos/comm/src/Teuchos_PerformanceMonitorBase.hpp:308:16: note: in
 expansion of macro ‘atexit’
         (void) atexit(freeCounters);
                ^~~~~~
Fatal Error by charmc in directory <ampi-build>/trilinos-build/packages/tpetra/core/src

@trilinos/

Description

Motivation and Context

How Has This Been Tested?

Checklist

  • My commit messages mention the appropriate GitHub issue numbers.
  • My code follows the code style of the affected package(s).
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the code contribution guidelines for this project.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • No new compiler warnings were introduced.
  • These changes break backwards compatibility.

This change is Reviewable

Merge request reports