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

Dead code in StyleContext.cxx raising MSVC compiler warning #11477

Closed
rdipardo opened this issue Apr 5, 2022 · 2 comments
Closed

Dead code in StyleContext.cxx raising MSVC compiler warning #11477

rdipardo opened this issue Apr 5, 2022 · 2 comments

Comments

@rdipardo
Copy link
Contributor

rdipardo commented Apr 5, 2022

Description of the Issue

In older versions of Scintilla, StyleContext::GetCurrent made an internal call to a static ::getRange function:

void StyleContext::GetCurrent(char *s, Sci_PositionU len) {
getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len);
}

Scintila 5.1.1 removed it in favour of the LexAccessor::GetRange method.

It seems Notepad++ patched it back in during the recent Scintilla upgrade, even though ::getRange is no longer used internally and is no longer reachable by any code outside lexilla/lexlib/StyleContext.cxx because of its static linkage.

Unless I'm missing something, neither Scintilla nor Notepad++ needs ::getRange at all1. Removing it will eliminate a distracting compiler warning.

Steps to Reproduce the Issue

cd PowerEditor\visual.net
msbuild /v:m /t:Lexilla /p:PlatformToolset=v141;Platform=x64;WindowsTargetPlatformVersion=%WindowsSDKVersion:~0,-1%

Expected Behavior

No compiler warnings.

Actual Behavior

 lexilla\lexlib\stylecontext.cxx(57, 13): warning C4505: 'getRange': unreferenced local function has been removed

Debug Information

Footnotes

  1. A few older lexers implement their own "getRange" functions, all of them hidden by static linkage, e.g., LexCOBOL, LexOpal, LexTACL, LexTAL

@ozone10
Copy link
Contributor

ozone10 commented Apr 29, 2022

Seems to be fixed with 100d45f

@rdipardo
Copy link
Contributor Author

Seems to be fixed with 100d45f

Confirmed: 100d45f#diff-da44f0e1e38ab1bc371aae9ebe4b604b19bfaed344ad858ecace106192b67d7cL57

Good 👀!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants