Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verilog #23

Closed
wants to merge 5 commits into from
Closed

Verilog #23

wants to merge 5 commits into from

Conversation

vhda
Copy link
Contributor

@vhda vhda commented Apr 11, 2014

Hi!

Please do not pull this in yet, I'm just looking for code review and feedback from you.

Thanks,
Vitor

@fishman
Copy link
Contributor

fishman commented Apr 14, 2014

@masatake can you take a look at this too by any chance?

@fishman
Copy link
Contributor

fishman commented Apr 14, 2014

also @vhda do you have a test for this by any chance?

@vhda
Copy link
Contributor Author

vhda commented Apr 14, 2014

No really. I've used some SV examples I found online during the development
of these updates.
I'm now reviewing ctags within my projects at work.
I'll create some test cases later (in fact, I already found an issue where
a `endif is being identified as a port).

On Mon, Apr 14, 2014 at 7:27 PM, Reza Jelveh [email protected]:

also @vhda https://github.com/vhda do you have a test for this by any
chance?


Reply to this email directly or view it on GitHubhttps://github.com//pull/23#issuecomment-40400876
.

@masatake
Copy link
Member

I'll take a look.

2014-04-14 23:21 GMT+09:00 Reza Jelveh [email protected]:

@masatake https://github.com/masatake can you take a look at this too
by any chance?


Reply to this email directly or view it on GitHubhttps://github.com//pull/23#issuecomment-40370861
.

@masatake
Copy link
Member

Hi, sorry to be late.
I did cherry-pick "96831e68eef9f627ac4b73e40f0babb6c478ed13".
About other patch, the knowledges for verilog and SystemVerilog are needed.
I need test cases to merge.
The problem is the test facility of ctags; it seems that the facility has not been maintained well.
I'm working on this area. Please, wait me for fixing the facility.

@masatake
Copy link
Member

Hi, again.

I've fixed the test facility. I did much more.
Could you send a pull request https://github.com/masatake/ctags/tree/next.
I'll merge and the I send a pull request for ctags/fishman to Reza.
To fix the test facility to many changes are needed. Reza is busy now. So I decided to use masatake/ctags/tree/next for patch buffering:)

In addition I need example and expected output of ctags.
Based on your information I will extend the test facility more language oriented.
Thank you.

@masatake
Copy link
Member

masatake commented May 1, 2014

Related topic was discussed at:

http://sourceforge.net/p/ctags/support-requests/17/

@masatake
Copy link
Member

masatake commented May 1, 2014

Finally I introduced unit test facility in my next tree.
Could you read https://github.com/masatake/ctags/blob/next/Units/README
and write a test case?
I need testes for the unit test facility:)

@vhda
Copy link
Contributor Author

vhda commented May 2, 2014

I'll try to create some test cases during the weekend :)

On Thu, May 1, 2014 at 4:37 PM, Masatake YAMATO [email protected]:

Finally I introduced unit test facility in my next tree.
Could you read https://github.com/masatake/ctags/blob/next/Units/README
and write a test case?
I need testes for the unit test facility:)


Reply to this email directly or view it on GitHubhttps://github.com//pull/23#issuecomment-41921411
.

@vhda
Copy link
Contributor Author

vhda commented May 5, 2014

Please check my testcase branch.
There's nothing fancy there, as I did not have much free time this weekend.

@masatake
Copy link
Member

masatake commented May 7, 2014

Thank you for preparing test cases.

After applying all your patch to my next tree, I run tests and got a coredump.
By git-bisect I found your a885e73 introduces the coredump.
Could you take a look?

$ PATH=/usr/bin make -f testing.mak test
Testing tag inclusion...ctags.ref: Warning: ignoring null tag in Test/1878155.js
ctags: Warning: ignoring null tag in Test/bug2888482.js
make: *** [test.include] Segmentation fault (core dumped)
$ gdb ctags --core ./core.4031
...
Core was generated by ./ctags -R -nu --c-kinds=+lpx --format=1 -o tags.test Test'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x0000000000425786 in findTag (name=0x193b990) at verilog.c:365 365 vStringCatS (endTokenName, VerilogKinds[currentContext->kind].name); warning: File "/home/yamato/var/ctags-github/.gdbinit" auto-loading has been declined by yourauto-load safe-path' set to "$debugdir:$datadir/auto-load:/usr/bin/mono-gdb.py".
(gdb) p File.source.name.buffer
$1 = 0x193b8c0 "Test/bug2747828.v"
(gdb) where
#0 0x0000000000425786 in findTag (name=0x193b990) at verilog.c:365
#1 findVerilogTags () at verilog.c:435
#2 0x000000000041bc10 in createTagsForFile (passCount=, language=40, fileName=0x18e6810 "Test/bug2747828.v") at parse.c:617
#3 createTagsWithFallback (language=40, fileName=0x18e6810 "Test/bug2747828.v") at parse.c:640
#4 parseFile (fileName=fileName@entry=0x18e6810 "Test/bug2747828.v") at parse.c:677
#5 0x0000000000414c85 in createTagsForEntry (entryName=0x18e6810 "Test/bug2747828.v") at main.c:303
#6 0x0000000000414b5a in recurseUsingOpendir (dirName=0x7ffffecbc3bf "Test") at main.c:161
#7 recurseIntoDirectory (dirName=0x7ffffecbc3bf "Test") at main.c:258
#8 0x0000000000414ce0 in createTagsForEntry (entryName=0x7ffffecbc3bf "Test") at main.c:299
#9 0x0000000000402ab0 in createTagsForArgs (args=0x18b2120) at main.c:348
#10 makeTags (args=0x18b2120) at main.c:494
#11 main (argc=, argv=) at main.c:562
(gdb)

@vhda
Copy link
Contributor Author

vhda commented May 7, 2014

Hi Masatake,

I'm unable to replicate this segmentation fault on my side :(
Could you please share all the compilation steps you followed?

Thanks!

On Wed, May 7, 2014 at 3:20 AM, Masatake YAMATO [email protected]:

Thank you for preparing test cases.

After applying all your patch to my next tree, I run tests and got a
coredump.
By git-bisect I found your a885e73a885e73introduces the coredump.
Could you take a look?

$ PATH=/usr/bin make -f testing.mak test

Testing tag inclusion...ctags.ref: Warning: ignoring null tag in
Test/1878155.js
ctags: Warning: ignoring null tag in Test/bug2888482.js
make: *** [test.include] Segmentation fault (core dumped)
$ gdb ctags --core ./core.4031
...
Core was generated by ./ctags -R -nu --c-kinds=+lpx --format=1 -o
tags.test Test'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000000000425786 in findTag (name=0x193b990) at verilog.c:365
365 vStringCatS (endTokenName, VerilogKinds[currentContext->kind].name);
warning: File "/home/yamato/var/ctags-github/.gdbinit" auto-loading has
been declined by yourauto-load safe-path' set to
"$debugdir:$datadir/auto-load:/usr/bin/mono-gdb.py".
(gdb) p File.source.name.buffer
$1 = 0x193b8c0 "Test/bug2747828.v"
(gdb) where
#0 0x0000000000425786 in findTag (name=0x193b990) at verilog.c:365
#1 #1 findVerilogTags () at
verilog.c:435
#2 #2 0x000000000041bc10 in
createTagsForFile (passCount=, language=40, fileName=0x18e6810
"Test/bug2747828.v") at parse.c:617
#3 #3 createTagsWithFallback
(language=40, fileName=0x18e6810 "Test/bug2747828.v") at parse.c:640
#4 #4 parseFile
(fileName=fileName@entry=0x18e6810 "Test/bug2747828.v") at parse.c:677
#5 #5 0x0000000000414c85 in
createTagsForEntry (entryName=0x18e6810 "Test/bug2747828.v") at main.c:303
#6 #6 0x0000000000414b5a in
recurseUsingOpendir (dirName=0x7ffffecbc3bf "Test") at main.c:161
#7 #7 recurseIntoDirectory
(dirName=0x7ffffecbc3bf "Test") at main.c:258
#8 #8 0x0000000000414ce0 in
createTagsForEntry (entryName=0x7ffffecbc3bf "Test") at main.c:299
#9 #9 0x0000000000402ab0 in
createTagsForArgs (args=0x18b2120) at main.c:348
#10 #10 makeTags (args=0x18b2120)
at main.c:494
#11 #11 main (argc=, argv=) at
main.c:562
(gdb)


Reply to this email directly or view it on GitHubhttps://github.com//pull/23#issuecomment-42382755
.

@masatake
Copy link
Member

masatake commented May 8, 2014

I put the working tree for merging your patch to github. Could you see following command line session?

How to reproduce

$ cd /tmp
$ git clone https://github.com/masatake/ctags.git
$ cd ctags
$ git checkout tmp-review-SystemVerilog
$ autoconf
$ ./configure
$ make
$ cp ctags ctags.ref
$ make  -f testing.mak 
Testing tag inclusion...ctags.ref: Warning: ignoring null tag in Test/1878155.js
make: *** [test.include] Segmentation fault (core dumped)

My fix

This may be not enough.

$ cat tmp.patch 
diff --git a/verilog.c b/verilog.c
index 3783efc..4650479 100644
--- a/verilog.c
+++ b/verilog.c
@@ -496,6 +496,7 @@ static void findVerilogTags (void)
        }
    }
    deleteToken (currentContext);
+   currentContext = NULL;
 }

 extern parserDefinition* VerilogParser (void)

Re run the test

Unit test reports unexpected output.

$ patch < tmp.patch
$ make
$ cp ctags ctags.ref
$ make  -f testing.mak
Testing tag inclusion...ctags.ref: Warning: ignoring null tag in Test/1878155.js
ctags: Warning: ignoring null tag in Test/1878155.js
Passed
Testing extension fields...ctags.ref: Warning: ignoring null tag in Test/1878155.js
ctags: Warning: ignoring null tag in Test/1878155.js
Passed
Testing extra tags...ctags.ref: Warning: ignoring null tag in Test/1878155.js
ctags: Warning: ignoring null tag in Test/1878155.js
Passed
Testing line directives...Passed
Testing TAGS output...ctags.ref: Warning: ignoring null tag in Test/1878155.js
ctags: Warning: ignoring null tag in Test/1878155.js
Passed
No Eiffel library source found for testing
No Linux kernel source found for testing
Testing Units/cpp-type-alias-with-using-keyword...Passed
Testing Units/c-sample...Passed
Testing Units/verilog-2001...FAILED: differences left in Units/verilog-2001.d/DIFF
Testing Units/verilog-basic...FAILED: differences left in Units/verilog-basic.d/DIFF
$ head Units/verilog-2001.d/DIFF
--- Units/verilog-2001.d/EXPECTED   2014-05-08 11:52:24.538887360 +0900
+++ Units/verilog-2001.d/OUTPUT 2014-05-08 11:52:24.536887337 +0900
@@ -2,11 +2,11 @@
-PARAM  Units/verilog-2001.d/input.v    /^parameter PARAM = 1;$/;"  c
-a  Units/verilog-2001.d/input.v    /^    input wire a,$/;" p
-add    Units/verilog-2001.d/input.v    /^task add ($/;"    t
-b  Units/verilog-2001.d/input.v    /^    b,c,$/;"  p
-c  Units/verilog-2001.d/input.v    /^    b,c,$/;"  p
-d  Units/verilog-2001.d/input.v    /^    d ,$/;"   p
-e  Units/verilog-2001.d/input.v    /^    output wire e ,$/;"   p

@masatake
Copy link
Member

vhda, How do you do?

The next branch of mine is merged into deploy branch of fishiman. So you can use the deploy branch of fishiman as base.

@vhda
Copy link
Contributor Author

vhda commented May 29, 2014

sorry, I still did not have time to review this. I'll try to look into it
tonight
On 29 May 2014 19:12, "Masatake YAMATO" [email protected] wrote:

vhda, How do you do?

The next branch of mine is merged into deploy branch of fishiman. So you
can use the deploy branch of fishiman as base.


Reply to this email directly or view it on GitHub
#23 (comment).

@vhda
Copy link
Contributor Author

vhda commented May 30, 2014

Hi Masatake,

Hope everything is ok with you :)

I've reviewed the code and I think the NULL assignment you added is the only one that is needed. Thank you for help spotting this issue and for the suggested fix.

As you requested, I have rebased my work over fishman/deploy. The following branches are currently available:

  1. testcase - Contains only the two simple verilog testcases I created.
  2. verilog - Updates to the verilog parser.
  3. systemverilog - Extension of the verilog parser to support SystemVerilog.

In my opinion the first two are ready for merge, so I'll go ahead and create the respective pull requests.

@vhda vhda closed this May 30, 2014
vhda added 2 commits May 30, 2014 01:46
Starting from version 2001, the Verilog standard allows module
declaration in the following format:

module module_name (
    input wire a,
    output reg b
);

This patch adds a check to confirm if the name of the port is not a
keyword, guaranteeing that the port net type is not added as a port by
mistake.

Note: when using this format only the port declaration is listed with
the assumption that the respective net type is not important. Although
this concept true in my workflow, this might not be so in all situations
and is open to further discussion.
Add tokenInfo structure and required helper functions to implement a
push/pop stack containing the current context of the tags being found.
@fishman fishman reopened this May 30, 2014
@fishman
Copy link
Contributor

fishman commented May 30, 2014

it looks good to me though.

acked from me

@masatake
Copy link
Member

Hi, vhda.

I'm confused because you open multiple pull requests.
As far as reading #33 of pull requests you want more comprehensive
discussion about SystemVerilog and Verilog with experts before merging.

Yes, I love your approach. However, you have to be the coordinator of
discussion because fishman and I don't know well about SystemVerilog and Verilog.

  1. Please, tell me the commit ids of your changes which you want us to pull now.
    I guess c05c957 01acca6 94d3294 1730980 are ready for merge. However, if
    you think more discussions are needed, tell me. I'll suspend pulling.
    Tell me the commit ids in this pull request thread.
  2. If you are interested in more comprehensive discussion, could you join the discussion of Draft text for announcement #30?
    ctags-devel may be good place to find people who are interested in SystemVerilog ctags support. We have a plane to submit an article which declares we are working on reactivating
    ctags development at https://github.com/fishman/ctags. Once submitting the article, it becomes easier for you to invite people at ctags-devel list to here.

@vhda
Copy link
Contributor Author

vhda commented Jun 2, 2014

Hi Masatake,

I guess I should read some documentation regarding github development flows. I was trying to mimic what I've done in the past by email with git format-patch, but I can see I was not very successful :)

  1. From what I can see the all the commit ids are already associated with this pull request, so you can go along and pull the for commit ids you mentioned.
  2. Ok, let's do this. I've tried to get Vikram's contact information through Sourceforge, but wasn't very successful.

Vitor

@masatake
Copy link
Member

masatake commented Jun 4, 2014

Maybe my English is wrong. Sorry.

Let's forget the work flow on github here. I don't know well, too:-P

I make my question simpler.

Do you want me to merge your c05c957 01acca6 94d3294 1730980 to fishiman tree now?
Or more discussion is needed before merging?

@vhda
Copy link
Contributor Author

vhda commented Jun 4, 2014

Merge them! :D

On Wed, Jun 4, 2014 at 2:30 PM, Masatake YAMATO [email protected]
wrote:

Maybe my English is wrong. Sorry.

Let's forget the work flow on github here. I don't know well, too:-P

I make my question simpler.

Do you want me to merge your c05c957
c05c957 01acca6
01acca6 94d3294
94d3294 1730980
1730980 to fishiman tree now?
Or more discussion is needed before merging?


Reply to this email directly or view it on GitHub
#23 (comment).

@masatake
Copy link
Member

masatake commented Jun 4, 2014

To avoid introduce unexpected modifications, I use cherry-pick. Could you look at fishman's deploy branch wheter your patches are merged expectedly? If they are, please close this thread.

Ok, let's do this. I've tried to get Vikram's contact information through Sourceforge, but wasn't very successful.

O.K. Let's try again after posting the ANNOUNCEMENT. I think we should be popular more.

Tests output:

$ PATH=/usr/bin make -f testing.mak
Testing tag inclusion...ctags.ref: Warning: ignoring null tag in Test/1878155.js
ctags: Warning: ignoring null tag in Test/1878155.js
Passed
Testing extension fields...ctags.ref: Warning: ignoring null tag in Test/1878155.js
ctags: Warning: ignoring null tag in Test/1878155.js
Passed
Testing extra tags...ctags.ref: Warning: ignoring null tag in Test/1878155.js
ctags: Warning: ignoring null tag in Test/1878155.js
Passed
Testing line directives...Passed
Testing TAGS output...ctags.ref: Warning: ignoring null tag in Test/1878155.js
ctags: Warning: ignoring null tag in Test/1878155.js
Passed
No Eiffel library source found for testing
No Linux kernel source found for testing
Testing Units/cpp-type-alias-with-using-keyword...Passed
Testing Units/c-sample...Passed
Testing Units/verilog-2001...Passed
Testing Units/verilog-basic...Passed

Thanks.

@masatake masatake mentioned this pull request Jun 4, 2014
@vhda
Copy link
Contributor Author

vhda commented Jun 4, 2014

Hi Masatake,

I've rebased my verilog branch on top of your commits and no unexpected
changes were detected.
But you should really have merged the branches instead... please do try to
do that next time.

Regarding the SF area, I've already updated issue #17 sharing my work and
fishman's repository in order to get more feedback on my changes.

Thanks,
Vitor

On Wed, Jun 4, 2014 at 4:33 PM, Masatake YAMATO [email protected]
wrote:

To avoid introduce unexpected modifications, I use cherry-pick. Could you
look at fishman's deploy branch wheter your patches are merged expectedly?
If they are, please close this thread.

Ok, let's do this. I've tried to get Vikram's contact information through
Sourceforge, but wasn't very successful.

O.K. Let's try again after posting the ANNOUNCEMENT. I think we should be
popular more.

Tests output:

$ PATH=/usr/bin make -f testing.mak
Testing tag inclusion...ctags.ref: Warning: ignoring null tag in Test/1878155.js
ctags: Warning: ignoring null tag in Test/1878155.js
Passed
Testing extension fields...ctags.ref: Warning: ignoring null tag in Test/1878155.js
ctags: Warning: ignoring null tag in Test/1878155.js
Passed
Testing extra tags...ctags.ref: Warning: ignoring null tag in Test/1878155.js
ctags: Warning: ignoring null tag in Test/1878155.js
Passed
Testing line directives...Passed
Testing TAGS output...ctags.ref: Warning: ignoring null tag in Test/1878155.js
ctags: Warning: ignoring null tag in Test/1878155.js
Passed
No Eiffel library source found for testing
No Linux kernel source found for testing
Testing Units/cpp-type-alias-with-using-keyword...Passed
Testing Units/c-sample...Passed
Testing Units/verilog-2001...Passed
Testing Units/verilog-basic...Passed

Thanks.


Reply to this email directly or view it on GitHub
#23 (comment).

@masatake
Copy link
Member

masatake commented Jun 4, 2014

I'm sorry. Now I understand I should just merge.
I think we can use #33 for the rest of discussion.

@masatake masatake closed this Jun 4, 2014
masatake pushed a commit to masatake/ctags that referenced this pull request Mar 12, 2020
Add ‘ifndef … endif’ guard around thread locking macros
masatake added a commit to masatake/ctags that referenced this pull request Nov 3, 2020
6c289b79 Merge pull request universal-ctags#23 from masatake/github-issue-21
8536bc8e tagsOpen: propagate errno from readTagLineRaw to tagsOpen instead of calling perror
a526cc93 Close FILE when failing to initialize tagFile

git-subtree-dir: libreadtags
git-subtree-split: 6c289b793ef6a06b90f288c48be869f1d56826dd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants