mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
messageStream, error: Add new versions of message and error macros
which use the __PRETTY_FUNCTION__ constant string to provide the function name
This commit is contained in:
@ -315,12 +315,23 @@ extern IOerror FatalIOError;
|
||||
#define FatalErrorIn(functionName) \
|
||||
::Foam::FatalError((functionName), __FILE__, __LINE__)
|
||||
|
||||
//- Report an error message using Foam::FatalError
|
||||
// for FUNCTION_NAME in file __FILE__ at line __LINE__
|
||||
#define FatalErrorInFunction FatalErrorIn(FUNCTION_NAME)
|
||||
|
||||
|
||||
//- Report an error message using Foam::FatalIOError
|
||||
// for functionName in file __FILE__ at line __LINE__
|
||||
// for a particular IOstream
|
||||
#define FatalIOErrorIn(functionName, ios) \
|
||||
::Foam::FatalIOError((functionName), __FILE__, __LINE__, (ios))
|
||||
|
||||
//- Report an error message using Foam::FatalIOError
|
||||
// for FUNCTION_NAME in file __FILE__ at line __LINE__
|
||||
// for a particular IOstream
|
||||
#define FatalIOErrorInFunction(ios) FatalIOErrorIn(FUNCTION_NAME, ios)
|
||||
|
||||
|
||||
//- Report an error message using Foam::FatalIOError
|
||||
// (or cerr if FatalIOError not yet constructed)
|
||||
// for functionName in file __FILE__ at line __LINE__
|
||||
@ -329,6 +340,14 @@ extern IOerror FatalIOError;
|
||||
::Foam::IOerror::SafeFatalIOError \
|
||||
((functionName), __FILE__, __LINE__, (ios), (msg))
|
||||
|
||||
//- Report an error message using Foam::FatalIOError
|
||||
// (or cerr if FatalIOError not yet constructed)
|
||||
// for functionName in file __FILE__ at line __LINE__
|
||||
// for a particular IOstream
|
||||
#define SafeFatalIOErrorInFunction(ios, msg) \
|
||||
SafeFatalIOErrorIn(FUNCTION_NAME, ios, msg)
|
||||
|
||||
|
||||
//- Issue a FatalErrorIn for a function not currently implemented.
|
||||
// The functionName is printed and then abort is called.
|
||||
//
|
||||
@ -340,10 +359,12 @@ extern IOerror FatalIOError;
|
||||
<< "Not implemented" << ::Foam::abort(FatalError);
|
||||
|
||||
//- Issue a FatalErrorIn for a function not currently implemented.
|
||||
// The compiler generated function name string is printed and then
|
||||
// abort is called.
|
||||
#define NotImplemented \
|
||||
notImplemented(__PRETTY_FUNCTION__)
|
||||
// The FUNCTION_NAME is printed and then abort is called.
|
||||
//
|
||||
// This macro can be particularly useful when methods must be defined to
|
||||
// complete the interface of a derived class even if they should never be
|
||||
// called for this derived class.
|
||||
#define NotImplemented notImplemented(FUNCTION_NAME)
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -218,39 +218,82 @@ extern messageStream Info;
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Convenience macros to add the file name and line number to the function name
|
||||
|
||||
// Compiler provided function name string:
|
||||
// for gcc-compatible compilers use __PRETTY_FUNCTION__
|
||||
// otherwise use the standard __func__
|
||||
#ifdef __GNUC__
|
||||
#define FUNCTION_NAME __PRETTY_FUNCTION__
|
||||
#else
|
||||
#define FUNCTION_NAME __func__
|
||||
#endif
|
||||
|
||||
|
||||
//- Report an error message using Foam::SeriousError
|
||||
// for functionName in file __FILE__ at line __LINE__
|
||||
#define SeriousErrorIn(fn) \
|
||||
::Foam::SeriousError((fn), __FILE__, __LINE__)
|
||||
|
||||
//- Report an error message using Foam::SeriousError
|
||||
// for FUNCTION_NAME in file __FILE__ at line __LINE__
|
||||
#define SeriousErrorInFunction(fn) SeriousErrorIn(FUNCTION_NAME)
|
||||
|
||||
|
||||
//- Report an IO error message using Foam::SeriousError
|
||||
// for functionName in file __FILE__ at line __LINE__
|
||||
// for a particular IOstream
|
||||
#define SeriousIOErrorIn(fn, ios) \
|
||||
::Foam::SeriousError((fn), __FILE__, __LINE__, ios)
|
||||
|
||||
//- Report an IO error message using Foam::SeriousError
|
||||
// for FUNCTION_NAME in file __FILE__ at line __LINE__
|
||||
// for a particular IOstream
|
||||
#define SeriousIOErrorInFunction(ios) SeriousIOErrorIn(FUNCTION_NAME, ios)
|
||||
|
||||
|
||||
//- Report a warning using Foam::Warning
|
||||
// for functionName in file __FILE__ at line __LINE__
|
||||
#define WarningIn(fn) \
|
||||
::Foam::Warning((fn), __FILE__, __LINE__)
|
||||
|
||||
//- Report a warning using Foam::Warning
|
||||
// for FUNCTION_NAME in file __FILE__ at line __LINE__
|
||||
#define WarningInFunction WarningIn(FUNCTION_NAME)
|
||||
|
||||
|
||||
//- Report an IO warning using Foam::Warning
|
||||
// for functionName in file __FILE__ at line __LINE__
|
||||
// for a particular IOstream
|
||||
#define IOWarningIn(fn, ios) \
|
||||
::Foam::Warning((fn), __FILE__, __LINE__, (ios))
|
||||
|
||||
//- Report an IO warning using Foam::Warning
|
||||
// for FUNCTION_NAME in file __FILE__ at line __LINE__
|
||||
// for a particular IOstream
|
||||
#define IOWarningInFunction(ios) IOWarningIn(FUNCTION_NAME, ios)
|
||||
|
||||
|
||||
//- Report a information message using Foam::Info
|
||||
// for functionName in file __FILE__ at line __LINE__
|
||||
#define InfoIn(fn) \
|
||||
::Foam::Info((fn), __FILE__, __LINE__)
|
||||
|
||||
//- Report a information message using Foam::Info
|
||||
// for FUNCTION_NAME in file __FILE__ at line __LINE__
|
||||
#define InfoInFunction InfoIn(FUNCTION_NAME)
|
||||
|
||||
|
||||
//- Report an IO information message using Foam::Info
|
||||
// for functionName in file __FILE__ at line __LINE__
|
||||
// for a particular IOstream
|
||||
#define IOInfoIn(fn, ios) \
|
||||
::Foam::Info((fn), __FILE__, __LINE__, (ios))
|
||||
|
||||
//- Report an IO information message using Foam::Info
|
||||
// for FUNCTION_NAME in file __FILE__ at line __LINE__
|
||||
// for a particular IOstream
|
||||
#define IOInfoInFunction(ios) IOInfoIn(FUNCTION_NAME, ios)
|
||||
|
||||
|
||||
//- Report a variable name and value
|
||||
// using Foam::Pout in file __FILE__ at line __LINE__
|
||||
#define Debug(var) \
|
||||
|
||||
Reference in New Issue
Block a user