This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: Diagnostic clean ups


Neil Booth <neil@daikokuya.demon.co.uk> writes:

| Gabriel Dos Reis wrote:-
| 
| > I'm planning to use %H to indicate location and %+ or %# are used by
| > the C++ front-end. 
| 
| What is your idea of location?  At present, it has to include a file
| and line number.

Yes, that is what I'm using currently in diagnostic.h:

    typedef struct
    {
      /* The name of the source file involved in the diagnostic.  */     
      const char *file;

      /* The line-location in the source file.  */
      int line;
    } location_t;
    
but I'd be happy to use a much more powerful machinery.  I'm currenlty
using the above because it doesn't involve dramatic code changes.

|  Ideally, it should just be a line number (as in
| line-map.c) and a column; this is what cpplib works with. 

Aha.  How do you get input-file name back then?

| The
| problem here is getting the front ends and RTL to use this form;
| just doing that is a lot of work, particularly as it involves code
| that is used by parts of the compiler other than the C front ends.

Maybe a project for 3.3 or 3.4?

[...]

| In summary, a location should be specifiable by a pointer to a
| structure (I guess) containing a line and column, and for the
| C front ends either a cpp_token ** or a size_t for indexing into
| the token array (see thread referenced below).

Hmm, IMHO that is too much for a location concept.  Why can't we reuse
the IDENTIFIER_POINTER associated with a _DECL as far as cpp_token is
concerned? 

| > | Something to consider for your file and line stuff: it should
| > | be possible to specify a location by reference to a token.
| > 
| > Like the %+ game that cc1plus plays?
| 
| I couldn't immediately see what that does.

cc1plus uses the modifier '%+' to tell the diagnostic machinery that
it should pick up location information from a tree -- yes, a hack :-)

| > I didn't follow that discussion, could you give me some references?
| 
| The sub-thread starts at around this post:
| 
| http://gcc.gnu.org/ml/gcc/2002-05/msg02144.html

Thanks, it was helpful.

-- Gaby


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