Bugs item #3555640, was opened at 2012-08-09 03:47
Message generated for change (Settings changed) made by broeker
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=104664&aid=3555640&group_id=4664

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: Jerome Reybert (klubad)
Assigned to: Nobody/Anonymous (nobody)
Summary: cscope doesn't search in header files

Initial Comment:
When I create a database, I put both .c and .h files in it. When I want to jump 
to a function declaration, I would like to have the possibility to choose 
between the definition in the header file or the implementation in the C file.

Let say I have a simple project:
$ more test.*
::::::::::::::
test.c
::::::::::::::
int test_function() {
  return 0;
}
::::::::::::::
test.h
::::::::::::::
int test_function();

If I build a database with all the files
$ cscope -b

and I search for the test_function definition, the only choice I have is in the 
C file. Symbol show me well both C and header file, but in a huge project, I 
can't afford to search in the symbol result.

If I limit database to header file, I don't have any result:
$ cat cscope.files
test.h
$ cscope -b

In bigger projects, definitions are sometimes found in header file (if the 
function is only defined in header, and not in C file), but I can't reproduce 
this behaviour in this little example. Here, cscope don't find test_function at 
all.

Is it a bug or a wanted behaviour to not include header definitions (or only in 
some obscure circumstances) in database?

----------------------------------------------------------------------

Comment By: Darryl (darrylo)
Date: 2012-08-09 11:06

Message:
Ah, sorry.  The behavior is correct.  You're also getting the terminology
confused:

* The "definition" is the actual C/C++ code that implements your function. 
"Definitions" generally do not occur in header files except in the cases of
inline functions or poorly-organized code.

* The "declaration" is the function prototype that specifies the function
return value, name, and (optionally) the function parameter types.  The
declaration generally does not contain any source code that implements the
function (inline functions are a gray zone, here, and definitions can act
as implicit declarations).  Header files generally contain declarations,
but not definitions.

* What you're asking for is certainly reasonable, but currently does not
exist.  You basically want a way to display both declarations and
definitions, but not symbol usages/references.  There is currently no way
to display only declarations, although cscope does sometimes try to display
declarations first (usually unsuccessfully), when showing symbol usage.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=104664&aid=3555640&group_id=4664

------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Cscope-devel mailing list
Cscope-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cscope-devel

Reply via email to