Author Topic: SE beta 5 does not find all references when extern declared inside a function  (Read 1621 times)

rowbearto

  • Senior Community Member
  • Posts: 1598
  • Hero Points: 116
Hi:

I have attached a test project.

If you go into file1.c, highlight "global_var", and press Ctrl+/, it only finds the references in file1.c, but not the references in file2.c.

Similarly, if you go to file2.c, highlight "global_var", and press Ctrl+/, it only finds the references in file2.c, but not in file1.c

Thanks,
Rob

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5052
  • Hero Points: 418
Interesting case. We will look into this. Doubtful we'll have time to fix this for the initial v21 release.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2893
  • Hero Points: 436
Good example.  This will be hot fixed after v21 is finalized.

rowbearto

  • Senior Community Member
  • Posts: 1598
  • Hero Points: 116
Thanks!

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2893
  • Hero Points: 436
Update:  This will be fixed in rc2.

rowbearto

  • Senior Community Member
  • Posts: 1598
  • Hero Points: 116
Fantastic! Thank you!

rowbearto

  • Senior Community Member
  • Posts: 1598
  • Hero Points: 116
It seems this issue is not fully fixed. In my real code, it still does not find all the references.

In the testproj that I previously uploaded, go into "function2()" and highlight the "global_var" in "global_var = false" and press Ctrl+/. It pops up a "select symbol" dialog and if you choose the version in file2.c, then it only finds the references in file2.c. I don't understand why it even prompts for this as it is only defined in file1.c.

In my real code, it doesn't prompt me like when looking for global_var starting from file2.c. So not sure if it is the same issue. I will need to try and make another test project.

rowbearto

  • Senior Community Member
  • Posts: 1598
  • Hero Points: 116
I managed to create a new test project that replicates the issue in my real code (that I can't share).

See attached testproj2.7z.

Go into file1.cpp, on line 7, highlight "global_var", press Ctrl+/. Notice that it does not find the references of global_var in file2.cpp

Similarly, go into file2.cpp, on line 8, highlight "global_var", and press Ctrl+/. Notice that it does not find the referenes of global_var in file1.cpp

Thanks,
Rob
« Last Edit: September 20, 2016, 09:51:16 pm by rowbearto »

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2893
  • Hero Points: 436
It prompts because you have both a local declaration for the symbol, and the global definition.  Since you happen to have a local declaration of the symbol, it is possible that you might be interested only in the references to the symbol within the current function.  If so, choose the local.  If you want all references, choose the global.

I reproduced the problem you are having with your sample code.  Thanks, a good example really helps.  This will be fixed in RC3.

rowbearto

  • Senior Community Member
  • Posts: 1598
  • Hero Points: 116
Thanks for reproducing and having it fixed in RC3.

About the prompting, you say that I have a local declaration, but I really don't. There is an extern in the function, not a declaration. I don't think it should prompt if there is an extern.