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

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
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: 6823
  • Hero Points: 526
Interesting case. We will look into this. Doubtful we'll have time to fix this for the initial v21 release.

Dennis

  • Senior Community Member
  • Posts: 3954
  • Hero Points: 515
Good example.  This will be hot fixed after v21 is finalized.

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Thanks!

Dennis

  • Senior Community Member
  • Posts: 3954
  • Hero Points: 515
Update:  This will be fixed in rc2.

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Fantastic! Thank you!

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
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: 2335
  • Hero Points: 132
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

  • Senior Community Member
  • Posts: 3954
  • Hero Points: 515
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: 2335
  • Hero Points: 132
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.