Summary: | macro-guarded system headers sometimes not parsed properly | ||
---|---|---|---|
Product: | [Applications] kdevelop | Reporter: | julee <julee.vv> |
Component: | Language Support: CPP (old) | Assignee: | kdevelop-bugs-null |
Status: | CONFIRMED --- | ||
Severity: | normal | CC: | david.nolden.kde, julee.vv, mail, matej |
Priority: | HI | Keywords: | testcase |
Version: | 4.6.0 | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
julee
2011-05-21 17:28:40 UTC
May be others could repeat this bug with a new kdevelop session .Just click "Start new session" to click a new session,and close current session.Then create a new c++ project in the new session to test. easily reproduced. The reason is probably some issue with macro merging which leads to improper parsing of time.h... David, any idea on how to debug this? Now I wonder whether macro cause this bug! Because I found this bug not only reproduced in macro-rich place such as system header files,but also for some larger but with few simple macros project! Further more, I can confirm function cannot parse could repaired just open that header file,and then reload all open files. For example, I include time.h in main.cpp,but function time() still cannot parse after enough time.Then I can open the file time.h with kdevelop ,then reload main.cpp.After a while, function time() parsed successfully! Is there a parsing optimization strategy for not open file ?Maybe this is the trouble maker. I was able to reproduce this with time.h and KDevelop/Kdevplatfrom 4.6/1.6. Let me speculate about the cause: time.h (and some similar glibc includes) seems to be a bit tricky (simplified to show the logic): #ifndef _TIME_H #if (! defined __need_time_t && !defined __need_clock_t && \ ! defined __need_timespec) # define _TIME_H 1 #endif (...) #if defined _TIME_H || defined __need_time_t typedef <something> time_t; #endif It essentially works in 2 ways: a) included by user code: no __need_something macros defined, so it defines _TIME_H and exports all functions and types. (what the user expects) b) included by other glibc header that defines some __needed_something macros: _TIME_H is not defined in this case and only requested functions or types are exported. It looks like that KDevelop contains an optimisation that each file is parsed only once even if it occurs multiple times in dependency chain. That could explain why it doesn't see all symbols. Is that true? Thank you for the bug report. As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists. If this bug is no longer persisting or relevant please change the status to resolved. |