This is to propose an improvement to the #line directive of the C preprocessor, or to ask for a workaround.
Currently, it seems that the #line directive is "ignored" if it lies between a #if and a #endif directives !
I believe that in most practical cases, this behavior is undesired.
Example:
#if 0
.....
#line 10
.....
#endif
Hence, if a special purpose program adds a few lines to a C source file that happen to be enclosed by #if and #endif directives, the correction to the line numbering in the file will not take effect. Unless that special purpose program also detects the presence of the #if and #endif and adds additional #line directives. Which makes the job harder.
So the correction could like
#if 0
.....
#line 10
.....
#endif
#line 20
But things could be a lot easier if the #line directive were always processed independently of the presence or absence of #if, #ifdef, #elif, #else, and #endif directives. Indeed, why should line numbering in the file be a function of #if directives that handle compilation issues rather than file layout? Except perhaps in very unusual cases.
Does anyone know of a simple workaround?
Currently, it seems that the #line directive is "ignored" if it lies between a #if and a #endif directives !
I believe that in most practical cases, this behavior is undesired.
Example:
#if 0
.....
#line 10
.....
#endif
Hence, if a special purpose program adds a few lines to a C source file that happen to be enclosed by #if and #endif directives, the correction to the line numbering in the file will not take effect. Unless that special purpose program also detects the presence of the #if and #endif and adds additional #line directives. Which makes the job harder.
So the correction could like
#if 0
.....
#line 10
.....
#endif
#line 20
But things could be a lot easier if the #line directive were always processed independently of the presence or absence of #if, #ifdef, #elif, #else, and #endif directives. Indeed, why should line numbering in the file be a function of #if directives that handle compilation issues rather than file layout? Except perhaps in very unusual cases.
Does anyone know of a simple workaround?