Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Help with Indexer Bug




On Fri, Sep 20, 2013 at 12:44 PM, Joseph Henry <Joseph.Henry@xxxxxxx> wrote:

Honestly I am not really sure.

 

This is what I saw when stepping though the code in the debugger.

 

File stddef.h has this structure:

 

#pragma once

#ifndef __STD

#define __STD

 

…..

 

#endif

 

I have a File with the following structure:

a.c
     |_ stddef.h
     |_ header.h
         |_ stddef.h  

 

and there is another File with the following structure:



    b.c
     |_ header.h
     |    |_ stddef.h

 

 

Now this is what I know happens:

 

When b.c is parsed, it finds the #include “header.h” and executes that statement.

When it looks for header.h it finds it, and its location is in the index.

Now header.h is included from the index, but it does not contain any instance of stddef.h.


A header stored in the index never contains content from another header. Each header is stored separately. When CPreprocessor encounters #include "header.h" in b.c it should include content from both, header.h and stddef.h. header.h may be included from the index or as a source. This depends on significant macros of header.h.

-sergey

 

What I don’t understand is why (or where) header.h is stored in the index without any instance of stddef.h. It seems like a #pragma once should be treated just like a #ifndef #define #endif block. So from b.c since this file has not been encountered, it should be included.

 

From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Sergey Prigogin
Sent: Friday, September 20, 2013 3:12 PM


To: CDT General developers list.
Subject: Re: [cdt-dev] Help with Indexer Bug

 

 

 

On Fri, Sep 20, 2013 at 11:22 AM, Joseph Henry <Joseph.Henry@xxxxxxx> wrote:

Ok,

 

After further looking into this, is seems that these are 2 separate issues. If you look at https://bugs.eclipse.org/bugs/show_bug.cgi?id=413768#c2 it shows a use case that supposedly should work, but that is the exact use case that is broken for me (with one minor change). I will explain.

 

Basically I have this situation:

 

    a.c

     |_ stddef.h  (version S1)

     |_ header.h

         |_ stddef.h  (version S2)

         |_ use declaration found in S1

 

And these another source file that contains header.h

 

    b.c

     |_ header.h

     |    |_ stddef.h  (version S1)

     |_ use declaration found in S1

 

 

The problem comes into play where stddef.h has a #pragma once in it at the top of the file like:

 

If stddef.h had #pragma once, there would not be S2, would it?

 

Did you mean something like 

 

a.c
     |_ stddef.h  (version S1)
     |_ header.h
         |_ stddef.h  (version S1)
         |_ use declaration found in S1

    b.c
     |_ header.h
     |    |_ stddef.h  (version S2)
     |_ use declaration found in S2

 

?

 

#pragma once

#ifndef __STDDEF__

#define __STDDEF__

 

…….

#define NULL 0

……

 

#endif

 

The #pragma once is what is causing the problem. Since it is outside of the #ifndef block, it seems like the version of stddef.h that is included in header.h is just simply not put in the index. So from b.c, the definition of NULL cannot be found.

 

Maybe this explains my problem a bit more.

 

Any help would be great.

 

Thanks,

Joseph Henry.

 

-sergey 

 

From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Sergey Prigogin
Sent: Friday, September 20, 2013 1:08 PM
To: CDT General developers list.
Subject: Re: [cdt-dev] Help with Indexer Bug

 

https://bugs.eclipse.org/bugs/show_bug.cgi?id=413768#c11 contains analysis of the problem and suggests a potential solution. I'm not sure whether that solution would not break other use cases, but it's at least something to try. I would start with diagnosing the problem described in bug 417193 similar to how it wasdone for bug 413768.

 

-sergey

 

On Fri, Sep 20, 2013 at 9:50 AM, Joseph Henry <Joseph.Henry@xxxxxxx> wrote:

Hi all,

 

I have filed bug 417193, which seems to be related to bug 413768.

 

I have not gotten much response on either of these bugs and was wondering if someone could point me in the right direction to fix this. I really need this bug fixed so I have been looking into it, but cant seem to make any headway.

 

If anyone could point me in the right direction that would be great.


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev

 


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev

 


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



Back to the top