oracle / opengrok

OpenGrok is a fast and usable source code search and cross reference engine, written in Java
http://oracle.github.io/opengrok/
Other
4.35k stars 747 forks source link

Generating incorrect links for C/C++ "#include" statements if extension of a header file is not on the lexer's list (Bugzilla #16760) #471

Open vladak opened 11 years ago

vladak commented 11 years ago

status REOPENED severity minor in component analyzer for --- Reported in version unspecified on platform ANY/Generic Assigned to: Lubos Kosco

On 2010-08-09 22:20:46 +0000, Yuriy Vasylchenko wrote:

For example I got invalid link to "header.h" + trailing "h" for the statement "#include "

Workaround that helped me to cover the code tree:

--- src.ori/org/opensolaris/opengrok/analysis/c/CXref.lex 2010-05-11 02:12:43.000000000 -0700 +++ src/org/opensolaris/opengrok/analysis/c/CXref.lex 2010-08-02 13:38:17.643478404 -0700 @@ -66,7 +66,7 @@

URIChar = [\?+\%&:\/.\@\;\=\$\,-!~*] FNameChar = [a-zA-Z0-9-.] -File = [a-zA-Z]{FNameChar}* "." ([chts]|"conf"|"java"|"cpp"|"hpp"|"CC"|"txt"|"htm"|"html"|"pl"|"xml") +File = [a-zA-Z]{FNameChar}* "." ([chts]|"conf"|"java"|"cpp"|"hpp"|"CC"|"txt"|"htm"|"html"|"pl"|"xml"|"cc"|"cxx"|"c++"|"hh"|"hxx"|"h++") Path = "/"? [a-zA-Z]{FNameChar}* ("/" [a-zA-Z]{FNameChar}*[a-zA-Z0-9])+

Number = ([0-9][0-9]*|[0-9]+.[0-9]+|"0x" [0-9a-fA-F]+ )([udl]+)?

--- src.ori/org/opensolaris/opengrok/analysis/c/CxxXref.lex 2010-05-11 02:12:43.000000000 -0700 +++ src/org/opensolaris/opengrok/analysis/c/CxxXref.lex 2010-08-02 13:39:02.935826843 -0700 @@ -66,7 +66,7 @@

URIChar = [\?+\%&:\/.\@\;\=\$\,-!~*] FNameChar = [a-zA-Z0-9-.] -File = [a-zA-Z]{FNameChar}* "." ([chts]|"conf"|"java"|"cpp"|"hpp"|"CC"|"txt"|"htm"|"html"|"pl"|"xml") +File = [a-zA-Z]{FNameChar}* "." ([chts]|"conf"|"java"|"cpp"|"hpp"|"CC"|"txt"|"htm"|"html"|"pl"|"xml"|"cc"|"cxx"|"c++"|"hh"|"hxx"|"h++") Path = "/"? [a-zA-Z]{FNameChar}* ("/" [a-zA-Z]{FNameChar}*[a-zA-Z0-9])+

Number = ([0-9][0-9]*|[0-9]+.[0-9]+|"0x" [0-9a-fA-F]+ )([udl]+)?

On 2010-08-10 06:21:03 +0000, Lubos Kosco wrote:

http://src.opensolaris.org/source/xref/opengrok/trunk/src/org/opensolaris/opengrok/index/CommandLineOptions.java# 95

e.g. -A hh:

if hh is some standard header extension, I'll just add it (http://filext.com/file-extension/HH suggests it's like that ... so I'll add this)

thnx ! L

note that for bigger patches of yours we would need SCA if you want your name to be in contrib list (http://hub.opensolaris.org/bin/view/Main/sun_contributor_agreement , one can get the SCA# with mail ...)

On 2010-08-10 13:55:03 +0000, Lubos Kosco wrote:

changeset: 1070:db0798ab2fac

On 2010-08-11 17:27:37 +0000, Yuriy Vasylchenko wrote:

All of "cpp"/"hpp", "cc"/"hh", "cxx"/"hxx" and "c++"/"h++" are standard C++ source files' extensions and they all are widely used, some of them - more for Windows development, some - more on *NIX side.

My point was that in the statements:

include

include "file2.ext2"

Filenames are 'file1.ext1' and 'file2.ext2' - analyzer does not need to guess what the names are there (based on list of extensions or anything else). The exact file name can be extracted directly from the string and analyzer should generate link accordingly (In the ideal world)

SCA#OS0465

Thanks.

On 2010-08-11 18:26:41 +0000, Lubos Kosco wrote:

ah, gotcha you wanted the lexical analysis to just use anything after include keyword and make it a path ref ...

reopening then

I'll check the rest of your bugs and push them with respective SCA

thanks for explanation Lubos

On 2010-08-12 03:15:25 +0000, Yuriy Vasylchenko wrote:

Thanks for rephrasing my mumbling using established project's terminology

On 2010-08-12 06:01:31 +0000, Lubos Kosco wrote:

:-D

(In reply to comment # 5)

Thanks for rephrasing my mumbling using established project's terminology

On 2011-01-05 08:41:56 +0000, Knut Anders Hatlen wrote:

Resetting target milestone since the full fix for this bug won't make it into 0.10.

idodeclare commented 6 years ago

OK this is resolved!