Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] semantic error


On Dec 13, 2010, at 2:55 PM, Sergey Prigogin wrote:



On Mon, Dec 13, 2010 at 11:24 AM, Greg Watson <g.watson@xxxxxxxxxxxx> wrote:
Ok, thanks. Are there known bugs in it? I tried the following simple case on OS X:

test.h:

#ifndef TEST_H_
#define TEST_H_
#include <sys/select.h>

struct foo {
       struct timeval  select_timeout;
};
typedef struct foo      foo;

#endif /* TEST_H_ */

test.c:

#ifndef TEST_C_
#define TEST_C_

#include "test.h"

int
main()
{
       foo* a;
       a->select_timeout.tv_sec = 10;
       return 0;
}

#endif /* TEST_C_ */

I've added "." and "/usr/include" to the paths for the project. However I'm seeing an error on tv_sec: field could not be resolved.

Most likely /usr/include is not a correct include path for the compiler libraries, but I don't know what other directories it's supposed to include on OS X.


Hmm, well /usr/include is certainly the location of sys/select.h. I'm not sure what other compiler libraries might be involved, since this is presumably being analyzed before any linking is done.

It looks like select.h defines __need_struct_timeval and then includes <sys/_structs.h>. Then _structs.h defines struct timeval if __need_struct_timeval is defined. However when I open _structs.h the relevent section of code appears grey, so presumably the parser doesn't think this macro is set. It seems pretty simple, so it's strange that it doesn't work.

Greg


Back to the top