Note that __FUNCTION__ (or whatever it's call) in C99 is not, strictly speaking, a preprocessor macro. Basically, it's a funny way of writing a context-dependent string literal. It's not even clear whether it should "foobar/#" or {foobar,#} in Erlang. Possibly the simplest way to hack it would be to write a parse transform.