Skip to main content

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

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. 

Attachment: TestCDT2.zip
Description: Zip archive


Back to the top