This is the mail archive of the gcc@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: Identifying source file locations.


Kenneth Almquist wrote:-

> In verbose mode, we show the preprocessor expansion of ARRAY_SIZE
> and the point to the error location within the expansion.
> 
>   Compiling:  tte4.c
> 
>        9.     array = malloc(ARRAY_SIZE);
>                              |
>                              (32 ** sizeof(int))
>                                   |
>           >>> invalid type argument of `unary *'
> 
> To print this error message, we use the column field as an index
> into a data object representing the second "*" token.  This
> object points to a second object containing a list of all the
> tokens resulting from expanding ARRAY_SIZE, as well as the
> number of the column where ARRAY_SIZE appears.

Hmm.  This would be very nice, but I'm not sure it's practical.  We
don't necessarily want to be keeping around the expansion of a macro;
they can be enormous.  Do you go up to the nearest enclosing macro
expansion, or the outermost?  Other things that need thinking about
are what happens if the ARRAY_SIZE token crosses more than one line,
and what do we show if its expansion is very long.

Keeping all the information this would seem to require could be quite
a memory hog, too.

Neil.


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