Skip to content

Commit

Permalink
Merge branch 'knepley/remove-petscsyshh'
Browse files Browse the repository at this point in the history
* knepley/remove-petscsyshh:
  Sys: Added missing header - The C++ Saga continues
  Sys: God let this be the last checkin
  Sys: Wherein Matt gives up on C++, and eradicates it from error handling
  Sys: Removed ref to PETSc::Exception
  Sys: Fixed missing include
  Sys: Removed petscsys.hh
  • Loading branch information
knepley committed Jan 8, 2014
2 parents 08ddf12 + 4c94c28 commit 0db60cd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 118 deletions.
5 changes: 0 additions & 5 deletions include/petscsys.h
Expand Up @@ -2230,11 +2230,6 @@ PETSC_STATIC_INLINE PetscErrorCode PetscMPIIntCast(PetscInt a,PetscMPIInt *b)
# define PETSC_MAX_PATH_LEN 4096
#endif

/* Special support for C++ */
#if defined(PETSC_CLANGUAGE_CXX) && defined(__cplusplus)
#include <petscsys.hh>
#endif

/*MC
UsingFortran - Fortran can be used with PETSc in four distinct approaches
Expand Down
112 changes: 0 additions & 112 deletions include/petscsys.hh

This file was deleted.

8 changes: 7 additions & 1 deletion src/sys/error/err.c
Expand Up @@ -297,7 +297,13 @@ PetscErrorCode PetscErrorMessage(int errnum,const char *text[],char **specific)
*
* in "C++ Coding Standards" by Sutter and Alexandrescu. (This accounts for part of the ongoing C++ binary interface
* instability.) Having PETSc raise errors as C++ exceptions was probably misguided and should eventually be removed.
*
* Here is the problem: You have a C++ function call a PETSc function, and you would like to maintain the error message
* and stack information from the PETSc error. You could make everyone write exactly this code in their C++, but that
* seems crazy to me.
*/
#include <sstream>
#include <stdexcept>
static void PetscCxxErrorThrow() {
const char *str;
if (eh && eh->ctx) {
Expand All @@ -306,7 +312,7 @@ static void PetscCxxErrorThrow() {
str = msg->str().c_str();
} else str = "Error detected in C PETSc";

throw PETSc::Exception(str);
throw std::runtime_error(str);
}
#endif

Expand Down

0 comments on commit 0db60cd

Please sign in to comment.