(readded cc: cscope-devel)

2011/2/16 Hans-Bernhard Bröker <hbbroe...@t-online.de>:
> On 17.02.2011 01:56, Ken Smith wrote:
>>
>> 2011/2/16 Hans-Bernhard Bröker<hbbroe...@t-online.de>:
>>
>>> Actually, you would _always_ have to do cscope -R -b -q.  The ability to
>>> concatenate single-letter options that don't use arguments is a GNU
>>> feature
>>> offered by getopt_long().  No _GNU_SOURCE, no -Rbq.
>
>> Ok.  I'm compiling on Linux with the GNU compiler which doesn't define
>> it by default.
>
> As of when?  It's actually predefined by GNU libc, not the compiler, if
> memory serves.

I don't know when this changed if it was previously not the case but
let me demonstrate what I observe.

% gcc --version
gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

% cat macro-check.c
#if defined(_GNU_SOURCE)
#error _GNU_SOURCE is defined
#endif

% gcc -c macro-check.c
macro-check.c:4: error: #error _GNU_SOURCE is not defined

Interestingly,

% g++ -c macro-check.c
macro-check.c:2: error: #error _GNU_SOURCE is defined

and this difference is complained about elsewhere on the internet.
When I do a fresh checkout of cscope, ./configure, and build it,
_GNU_SOURCE is not defined.  I verified this by putting a check
similar to the above in src/main.c.  Perhaps it would be worth your
while to check with someone at one of the distros to see if they have
to apply any patches to cscope to get it to build with _GNU_SOURCE
enabled.

>> I'm happy to learn that cscope already does what I want but so far, I
>> don't think -P does.  I'm happy to be proven wrong.
>
> You don't want to pass $(pwd) to -P.  It's meant to be used like this:
>
>        cscope -d -f /some/where/cscope.out -P/some/where

This does work but I find it more straightforward to build the
database with absolute paths.  Is there any harm in that?  The
vim/cscope integration mirrors the above by allowing an argument to
:cs add.

cs add /path/to/cscope.out /path/to

But isn't it more convenient to simply build the database with
absolute paths and then you don't have to use -P to load each one of
them every time.  Indeed, the invocation is somewhat redundant don't
you think?  Perhaps the default behavior of -f should be to
automatically prepend the supplied path when that path is not the same
as $PWD.  The default behavior of using paths relative to the current
directory at database creation time is in harmony with that.

At any rate, the patch is yours to do with as you please.  I
personally find it useful and would love to see it integrated into the
mainline but I'm also content with patching my own copy.

The patch probably needs to be modified to avoid using unistd.h for
Windows and such but I don't have a Windows development box handy to
work out the details.

   ks

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Cscope-devel mailing list
Cscope-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cscope-devel

Reply via email to