Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Cparser not detecting a typedef

It is unfortunate that a problem with a macro may have a cascade effect, but this is the nature of the language. I don't think I can help much with investigation of the problem with the macro.

-sergey


On Mon, Feb 3, 2014 at 11:41 AM, Vishal Gupta <vishal.vit@xxxxxxxxx> wrote:
Even if the macro is not resolve, does it make sense to have such a reciprocal effect on some other thing like the typedef ?

I had a real tough time to identify why my typedef was marked in error. As the perl module was the third part code.

Do you require any input or data from my side to investigate this issue ?



On Tue, Feb 4, 2014 at 12:47 AM, Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx> wrote:
It means that the macro is not recognized. It makes sense to investigate why.


On Mon, Feb 3, 2014 at 10:31 AM, Vishal Gupta <vishal.vit@xxxxxxxxx> wrote:
No in that case size_t is resolved properly




On Mon, Feb 3, 2014 at 11:45 PM, Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx> wrote:
Does

__declspec(dllexport) size_t
win32_fread(void *buf, size_t size, size_t count, FILE *fp)
{
  return fread(buf, size, count, fp);
}

produce the same error as

DllExport size_t
win32_fread(void *buf, size_t size, size_t count, FILE *fp)
{
  return fread(buf, size, count, fp);
}

?


On Mon, Feb 3, 2014 at 10:09 AM, Vishal Gupta <vishal.vit@xxxxxxxxx> wrote:
Hello Sergey

As per my initial investigation :

if we write the function

DllExport size_t
win32_fread(void *buf, size_t size, size_t count, FILE *fp)
{
  return fread(buf, size, count, fp);
}

in one line like

DllExport size_t win32_fread(void *buf, size_t size, size_t count, FILE *fp)
{
  return fread(buf, size, count, fp);
}

Then the problem gets resolved.
 
In the first way of writing the code 
size_t is detected as a CVariable as DllExport is not resolved

Hence the method processIndexResults(IASTName name, IBinding[] bindings) 
In Cscope.java , gets two bindings from the index. one binding as a CVariable and another as a Typedef. Due to which this method returns null.







On Mon, Feb 3, 2014 at 11:26 PM, Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx> wrote:
I would look into reasons why it is not recognized in your case.

-sergey


On Mon, Feb 3, 2014 at 9:51 AM, Vishal Gupta <vishal.vit@xxxxxxxxx> wrote:
yes that's correct . Its definition can be found in win32.h file





On Mon, Feb 3, 2014 at 11:04 PM, Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx> wrote:
What is DllExport? Is it a macro defined as __declspec(dllexport)?

-sergey


On Mon, Feb 3, 2014 at 8:50 AM, Vishal Gupta <vishal.vit@xxxxxxxxx> wrote:
Hello All,

I am facing a problem where CDT C Parser is detecting a typedef as a C variable and due to which in other .c files the Typedef is marked in error.

I have created a sample project to show the problem

Here are the project  files and their contents :

wince.c   (this is a code from perl module)
-------------------------------------------------------------------------------------------------

DllExport size_t
win32_fread(void *buf, size_t size, size_t count, FILE *fp)
{
  return fread(buf, size, count, fp);
}
   
-------------------------------------------------------------------------------------------------

types.h
-------------------------------------------------------------------------------------------------
typedef unsigned int  __uint32_t;

typedef __uint32_t size_t;
----------------------------------------------------------------------------------------------------

App.c

-----------------------------------------------------------------------------------------------
#include <types.h>

 size_t test_func(void){

}
-------------------------------------------------------------------------------------------------

Now the problem is that the "DLLExport" is not resolved, due to which size_t (the return type of function win32_fread),  is considered as a c variable . Even though it is defined as typedef in file types.h.

Due to this in my App.c the "size_t" is not getting resolved.

I had a real tough time to identify this problem in my actual code base. 

Is it a expected behavior of C Parser ?

For Reference i have attached the sample project. 

_______________________________________________
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



_______________________________________________
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



_______________________________________________
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