extern is a C keyword. It serves two puposes - states that the variable is declared externally(outside of this file) and can specify the linkage type. extern "C" states that the variable or function has C linkage. It tell compiler that this function name should not be mangled. I thought there were other linkage types than just "C" but I couln't find any examples. What would be the proper fix in cscope for this? Take out all things between #ifdef __cplusplus/#endif?
Is there another fix possible for this issue? This is a valid issue since extern "C" statement is a valid C statement.
Hello, this is a patch for this issue. I just look at "C" string that comes after extern and reset extern state. I tested it on a large project tree and there are no crashes or anything unusial. If I find better solution I will post it here. Can this patch be merged?
From the comment in the similar reported issue I gathered that brace { in the extern "C" statement makes cscope confused and it assumes that definitions are local. I have to disagree with this statement. In that case in my example test_enum definition would also be local but it is present in both cases. Same with defines, although defines may be treated differently internally.
I guess, there is already a bug with exactly the same content and it is not going to be fixed. I understand that cscope would require re-work to support this. Since cscope can recognize C++ classes it does support C++ to some extent. Maybe the solution to this problem is to look for following statements and take them out : #ifdef __cplusplus extern "C" { #endif Basically take out everything that would be processed by the C++ compiler.
extern "C" used in include file prevents enumeration members from appearing in global scope