diff --git a/src/libCom/osi/compiler/clang/compilerSpecific.h b/src/libCom/osi/compiler/clang/compilerSpecific.h index 9871fcf7d..2053227e7 100644 --- a/src/libCom/osi/compiler/clang/compilerSpecific.h +++ b/src/libCom/osi/compiler/clang/compilerSpecific.h @@ -26,6 +26,9 @@ #define EPICS_ALWAYS_INLINE __inline__ #endif +/* Expands to a 'const char*' which describes the name of the current function scope */ +#define EPICS_FUNCTION __PRETTY_FUNCTION__ + #ifdef __cplusplus /* diff --git a/src/libCom/osi/compiler/gcc/compilerSpecific.h b/src/libCom/osi/compiler/gcc/compilerSpecific.h index ca46a9348..13d91193c 100644 --- a/src/libCom/osi/compiler/gcc/compilerSpecific.h +++ b/src/libCom/osi/compiler/gcc/compilerSpecific.h @@ -29,6 +29,9 @@ #else # define EPICS_ALWAYS_INLINE __inline__ #endif + +/* Expands to a 'const char*' which describes the name of the current function scope */ +#define EPICS_FUNCTION __PRETTY_FUNCTION__ #ifdef __cplusplus diff --git a/src/libCom/osi/compiler/msvc/compilerSpecific.h b/src/libCom/osi/compiler/msvc/compilerSpecific.h index 49cf266ae..75bfa83fb 100644 --- a/src/libCom/osi/compiler/msvc/compilerSpecific.h +++ b/src/libCom/osi/compiler/msvc/compilerSpecific.h @@ -26,6 +26,9 @@ #define EPICS_ALWAYS_INLINE __inline #endif +/* Expands to a 'const char*' which describes the name of the current function scope */ +#define EPICS_FUNCTION __FUNCTION__ + #ifdef __cplusplus /* diff --git a/src/libCom/osi/compilerDependencies.h b/src/libCom/osi/compilerDependencies.h index bb077fbf0..3bd835c91 100644 --- a/src/libCom/osi/compilerDependencies.h +++ b/src/libCom/osi/compilerDependencies.h @@ -62,4 +62,13 @@ # define EPICS_UNUSED #endif +#ifndef EPICS_FUNCTION +#if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)) || (defined(__cplusplus) && __cplusplus>=201103L) +# define EPICS_FUNCTION __func__ +#else +/* Expands to a 'const char*' which describes the name of the current function scope */ +# define EPICS_FUNCTION ("") +#endif +#endif + #endif /* ifndef compilerDependencies_h */ diff --git a/src/libCom/test/epicsAtomicTest.cpp b/src/libCom/test/epicsAtomicTest.cpp index 2d7c81bb9..fd9fc2e6b 100644 --- a/src/libCom/test/epicsAtomicTest.cpp +++ b/src/libCom/test/epicsAtomicTest.cpp @@ -406,6 +406,7 @@ MAIN ( epicsAtomicTest ) { testPlan ( 50 ); + testDiag("In %s", EPICS_FUNCTION); testClassify (); testBasic(); #if defined(__rtems__)