Skip to content
Snippets Groups Projects
Commit 87a07e32 authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Small fix in Exception to show function name

parent be9e2028
No related branches found
No related tags found
No related merge requests found
...@@ -256,9 +256,12 @@ public: ...@@ -256,9 +256,12 @@ public:
} }
}; };
#ifdef __GNUG__
// With GNU compiler, we can use __PRETTY_FUNCTION__ to get the function name // With GNU compiler, we can use __PRETTY_FUNCTION__ to get the function name
#if !defined(__PRETTY_FUNCTION__) #define __PLUMED_FUNCNAME __PRETTY_FUNCTION__
#define __PRETTY_FUNCTION__ "" #else
// Otherwise, we use the standard C++11 variable
#define __PLUMED_FUNCNAME __func__
#endif #endif
/// \relates PLMD::Exception /// \relates PLMD::Exception
...@@ -266,7 +269,7 @@ public: ...@@ -266,7 +269,7 @@ public:
/// Might be useful if we want to use derived exceptions that could /// Might be useful if we want to use derived exceptions that could
/// be thrown using `throw DerivedException()<<plumed_here<<" "<<other stuff"`. /// be thrown using `throw DerivedException()<<plumed_here<<" "<<other stuff"`.
/// It is used in the macros below to throw PLMD::Exception. /// It is used in the macros below to throw PLMD::Exception.
#define plumed_here PLMD::Exception::Location(__FILE__,__LINE__,__PRETTY_FUNCTION__) #define plumed_here PLMD::Exception::Location(__FILE__,__LINE__,__PLUMED_FUNCNAME)
/// \relates PLMD::Exception /// \relates PLMD::Exception
/// Throw an exception with information about the position in the file. /// Throw an exception with information about the position in the file.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment