But __LINE__ is wrong. Forget what I said about __C_FILE__ and
__C_LINE__, __C_LINE__ would not work for inline functions. Looks like
the best option is a combination of __BASE_FILE__ and function name.
a.h
#define BUG() \
printf("kernel BUG in func %s, file %s\n",__FUNCTION__,__BASE_FILE__);
static inline void hello(void)
{
BUG();
}
a.c
#include <stdio.h>
#include <a.h>
int main()
{
hello();
hello();
return 0;
}
# gcc -I`pwd` `pwd`/a.c -o a
# ./a
kernel BUG in func hello, file /home/kaos/a.c
kernel BUG in func hello, file /home/kaos/a.c
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/