Like any macro, you can simply use:
#undef __LINE__ #undef __FILE__
and then you can override them.
You can also pass -U macroname to undef the macro name and -D macroname=definition to specify the macro name for gcc options.
Note that, as pointed out in another answer, undefining or redefining __LINE__ or __FILE__ in C causes undefined behavior.
source share