This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Indented #line directives


On Fri, May 19, 2000 at 11:09:01AM -0700, Mark Mitchell wrote:
> 
> Zack --
> 
>   The preprocessor is emitting `#' directives in non-zero columns.
> For example, this came out of a preprocessed source file:
> 
>  # 1 "/home/mitchell/dev/egcs-2/new-abi-objdir/gcc/include/limits.h" 1 3
> 
> Note that the `#' is not in the leftmost column.

Note for handling .S files where the preprocessor is run before the assembler,
there are gas ports that do not use '#' for a comment character, but they
explicitly allow '#' in column 1 just to handle preprocessor line numbers.

>   Perhaps this is because that file contains:
> 
> #ifdef _GCC_NEXT_LIMITS_H
>  #include_next <limits.h>		/* recurse down to the real one */
> #endif
> 
>   That's bogus, and I'll fix it.  Isn't the preprocessor supposed to
> reject `#' directives that don't occur in the leftmost column?

ISO C explicitly requires support of whitespace before the '#'.  Tradiational
preprocessors only looked for the '#' in column 1.  This meant you could do:

	#ifdef SHOULD_NOT_HAPPEN
	    #error "I'm sorry Dave, I can't do that"
	#endif

and it would not cause the traditional compiler to complain.

-- 
Michael Meissner, Cygnus Solutions, a Red Hat company.
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work:	  meissner@redhat.com		phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org	fax:   +1 978-692-4482

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]