Add CCTK_BUILTIN_TRAP

Issue #1941 closed
Erik Schnetter created an issue

Comments (4)

  1. Roland Haas
    • changed status to open
    • removed comment

    I have to admit I am not sure I see the need for these functions. On current compilers CCTK_Abort is already declared to have the noreturn attribute so the optimizer knows that it does not have to optimize the code branch that leads to it. In addition CCTK_Abort performs useful cleanup (it call MPI_Abort and can be overloaded by the driver which is not the case when calling a trap.

    Maybe the better comparison is really to assert(0) instead? In this case the advantage of the trap is that it cannot be made a no-op by defining NDEBUG.

    So I would only want to advertise using the trap for debugging and not in place of CCTK_Abort which provides a fairly "clean" abort route.

  2. Log in to comment