Pergunta

Is it possible to tell GCC to compile the source code, and ignore macros like __FILE__, __LINE__ , etc, etc, or redefine them to expand into let's say - an empty string?

Foi útil?

Solução

As with any macro you can just use:

#undef __LINE__
#undef __FILE__

and then you can redefine them.

You can also pass -U macroname to undef a macro name and -D macroname=definition to define a macro name to the gcc options.

Note that, as indicated in another answer, undefining or redefining __LINE__ or __FILE__ in C invokes undefined behavior.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top