[Lemon-commits] Akos Ladanyi: Improved LEMON_FUNCTION_NAME macro.

Lemon HG hg at lemon.cs.elte.hu
Tue Apr 22 18:59:40 CEST 2008


details:   http://lemon.cs.elte.hu/hg/lemon/rev/8b703d177341
changeset: 142:8b703d177341
user:      Akos Ladanyi <ladanyi [at] tmit.bme.hu>
date:      Sun Apr 13 20:15:45 2008 +0200
description:
	Improved LEMON_FUNCTION_NAME macro. It should work fine with GCC and
	the MS C++ compilers. Otherwise it reverts to using the __func__
	variable which is C99, but I couldn't find a better alternative.

diffstat:

1 file changed, 7 insertions(+), 1 deletion(-)
lemon/assert.h |    8 +++++++-

diffs (18 lines):

diff -r 96f81c791f0c -r 8b703d177341 lemon/assert.h
--- a/lemon/assert.h	Sun Apr 13 13:22:52 2008 +0200
+++ b/lemon/assert.h	Sun Apr 13 20:15:45 2008 +0200
@@ -103,7 +103,13 @@
 #endif
 
 #ifndef LEMON_FUNCTION_NAME
-#  define LEMON_FUNCTION_NAME (__PRETTY_FUNCTION__)
+#  if defined __GNUC__
+#    define LEMON_FUNCTION_NAME (__PRETTY_FUNCTION__)
+#  elif defined _MSC_VER
+#    define LEMON_FUNCTION_NAME (__FUNCSIG__)
+#  else
+#    define LEMON_FUNCTION_NAME (__func__)
+#  endif
 #endif
 
 #ifdef DOXYGEN



More information about the Lemon-commits mailing list