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

8339309: unused-variable warnings happen in libfontmanager #20790

Closed
wants to merge 1 commit into from

Conversation

YaSuenag
Copy link
Member

@YaSuenag YaSuenag commented Aug 30, 2024

I saw following errors (warnings) when I tried to build OpenJDK on Fedora 40 with gcc-14.2.1-1.fc40.x86_64:

/home/ysuenaga/github-forked/jdk/src/java.desktop/share/native/libfontmanager/HBShaper_Panama.c: In function ‘jdk_hb_shape’:
/home/ysuenaga/github-forked/jdk/src/java.desktop/share/native/libfontmanager/HBShaper_Panama.c:101:16: error: unused variable ‘yPtSize’ [-Werror=unused-variable]
  101 | float yPtSize = euclidianDistance(matrix[2], matrix[3]);
      | ^~~~~~~
cc1: all warnings being treated as errors
* For target support_native_java.desktop_libfontmanager_X11FontScaler.o:
/home/ysuenaga/github-forked/jdk/src/java.desktop/unix/native/libfontmanager/X11FontScaler.c: In function ‘Java_sun_font_NativeFont_getGlyphAdvance’:
/home/ysuenaga/github-forked/jdk/src/java.desktop/unix/native/libfontmanager/X11FontScaler.c:270:32: error: unused variable ‘descent’ [-Werror=unused-variable]
  270 | int direction, ascent, descent;
      | ^~~~~~~
/home/ysuenaga/github-forked/jdk/src/java.desktop/unix/native/libfontmanager/X11FontScaler.c:270:24: error: unused variable ‘ascent’ [-Werror=unused-variable]
  270 | int direction, ascent, descent;
      | ^~~~~~
/home/ysuenaga/github-forked/jdk/src/java.desktop/unix/native/libfontmanager/X11FontScaler.c:270:13: error: unused variable ‘direction’ [-Werror=unused-variable]
  270 | int direction, ascent, descent;
      | ^~~~~~~~~
/home/ysuenaga/github-forked/jdk/src/java.desktop/share/native/libfontmanager/freetypeScaler.c: In function ‘Java_sun_font_FreetypeFontScaler_createScalerContextNative’:
/home/ysuenaga/github-forked/jdk/src/java.desktop/share/native/libfontmanager/freetypeScaler.c:516:19: error: unused variable ‘scalerInfo’ [-Werror=unused-variable]
  516 | FTScalerInfo *scalerInfo =
      | ^~~~~~~~~~
/home/ysuenaga/github-forked/jdk/src/java.desktop/share/native/libfontmanager/freetypeScaler.c: In function ‘Java_sun_font_FreetypeFontScaler_getGlyphPointNative’:
/home/ysuenaga/github-forked/jdk/src/java.desktop/share/native/libfontmanager/freetypeScaler.c:1655:13: error: unused variable ‘point’ [-Werror=unused-variable]
 1655 | jobject point = NULL;
      | ^~~~~

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8339309: unused-variable warnings happen in libfontmanager (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20790/head:pull/20790
$ git checkout pull/20790

Update a local copy of the PR:
$ git checkout pull/20790
$ git pull https://git.openjdk.org/jdk.git pull/20790/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 20790

View PR using the GUI difftool:
$ git pr show -t 20790

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20790.diff

Webrev

Link to Webrev Comment

@YaSuenag YaSuenag marked this pull request as ready for review August 30, 2024 10:17
@bridgekeeper
Copy link

bridgekeeper bot commented Aug 30, 2024

👋 Welcome back ysuenaga! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Aug 30, 2024

@YaSuenag This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8339309: unused-variable warnings happen in libfontmanager

Reviewed-by: prr

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 736 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 30, 2024
@openjdk
Copy link

openjdk bot commented Aug 30, 2024

@YaSuenag The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@mlbridge
Copy link

mlbridge bot commented Aug 30, 2024

Webrevs

@@ -98,7 +98,6 @@ JDKEXPORT int jdk_hb_shape(
float devScale = 1.0f;
if (getenv("HB_NODEVTX") != NULL) {
float xPtSize = euclidianDistance(matrix[0], matrix[1]);
float yPtSize = euclidianDistance(matrix[2], matrix[3]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I paused to think about whether the problem is really that the division below should be using yPtSize .. in other words, the correct fix isn't always as obvious as it might look.

For the record, I think the unused var is becuase it was patterned after the code code in HBShaper.c which stores the yPtSize in a struct, but here it is clear that it isn't used.

fi->xPtSize = euclidianDistance(fi->matrix[0], fi->matrix[1]);
fi->yPtSize = euclidianDistance(fi->matrix[2], fi->matrix[3]);
if (getenv("HB_NODEVTX") != NULL) {
    fi->devScale = fi->xPtSize / fi->ptSize;

Now, as far as I can they aren't used except in that fn, so probably can also go ..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition, I've confirmed euclidianDistance does not make any side-effects.

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 28, 2024

@YaSuenag This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@YaSuenag
Copy link
Member Author

YaSuenag commented Sep 28, 2024

I do not stick my proposal, but I hope this will be fixed ASAP for modern C compilers.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 22, 2024
@YaSuenag
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Oct 23, 2024

Going to push as commit 476d0f1.
Since your change was applied there have been 736 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 23, 2024
@openjdk openjdk bot closed this Oct 23, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Oct 23, 2024
@openjdk
Copy link

openjdk bot commented Oct 23, 2024

@YaSuenag Pushed as commit 476d0f1.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@YaSuenag YaSuenag deleted the pr/8339309 branch October 23, 2024 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client [email protected] integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

2 participants