Skip to content

JDK-8309219: Fix xlc17 clang 15 warnings in java.base#14281

Closed
JoKern65 wants to merge 3 commits intoopenjdk:masterfrom
JoKern65:JDK-8309219
Closed

JDK-8309219: Fix xlc17 clang 15 warnings in java.base#14281
JoKern65 wants to merge 3 commits intoopenjdk:masterfrom
JoKern65:JDK-8309219

Conversation

@JoKern65
Copy link
Contributor

@JoKern65 JoKern65 commented Jun 2, 2023

This pr is a split off from JDK-8308288: Fix xlc17 clang warnings in shared code #14146
It handles the part in java.base.

Compiling on AIX with xlc17 which contains the new clang 15 frontend
shows the following warnings.

built by make/modules/java.base/Lib.gmk

src/java.base/unix/native/libnet/DefaultProxySelector.c:378:41:22: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
proxies = (*g_proxy_resolver_lookup)(resolver, uri, NULL, &error);
^

src/java.base/unix/native/libnet/NetworkInterface.c:1612:24: error: arithmetic on a pointer to void is a GNU extension [-Werror,-Wgnu-pointer-arith]
end = (void *)nddp + size;

src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c:1251:7: error: '_ALLBSD_SOURCE' is not defined, evaluates to 0 [-Werror,-Wundef]
#elif _ALLBSD_SOURCE
The whole file checks whether _ALLBSD_SOURCE is defined, only where #elif is used the call to defined() was forgotten.

built by make/modules/java.base/lib/CoreLibraries.gmk

src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c:638 comparison of integers of different signs: 'int' and 'unsigned long'
if (ret < sizeof(psinfo_t)) {
ProcessHandleImpl_unix.c: Just using the proper type size_t instead of int.

src/java.base/aix/native/libjli/java_md_aix.c:42:38: error: arithmetic on a pointer to void is a GNU extension [-Werror,-Wgnu-pointer-arith]
addr < p->ldinfo_textorg + p->ldinfo_textsize) {
we can fix this with temporary casting the void* pointer to char* or by disabling the warning in CoreLibraries.gmk

src/java.base/share/native/libzip/zlib/inffast.c:74:20: error: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
void ZLIB_INTERNAL inflate_fast(strm, start)
^
src/java.base/share/native/libjli/java.c:2311:22: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
vfprintf(stderr, fmt, vl);
^~~

The test library libGetXSpace.c also shows a warning.
In addition, the cast in that lib is wrong, we opened "JDK-8309216 cast from jchar* to char* in test GetXSpace.java" for that.


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-8309219: Fix xlc17 clang 15 warnings in java.base (Bug - "4")

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 14281

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 2, 2023

👋 Welcome back JoKern65! 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 openjdk bot added the rfr Pull request is ready for review label Jun 2, 2023
@openjdk
Copy link

openjdk bot commented Jun 2, 2023

@JoKern65 The following labels will be automatically applied to this pull request:

  • build
  • core-libs
  • nio

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

@openjdk openjdk bot added nio nio-dev@openjdk.org build build-dev@openjdk.org core-libs core-libs-dev@openjdk.org labels Jun 2, 2023
@mlbridge
Copy link

mlbridge bot commented Jun 2, 2023

Webrevs

Copy link
Member

@GoeLin GoeLin left a comment

Choose a reason for hiding this comment

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

Lib.gmk / DefaultProxySelector.c
Fixing this in the file would require a larger rework. Good.
Lib.gmk / NetworkInterface.c
This looks as if it could also be fixed in the code.
But previously, other warnings have not been fixed either.
So I'm fine with this.

CoreLibraries / deprecated-non-prototype
Fixes warning in zlib, we should not touch the code
there as it is from external. Good.

CoreLibraries / format-nonliteral
In hotspot, these warnings have been fixed, or
an attribute is used to disable them locally.
These places pop up in code scanners, too.
See compilerWarnings.hpp / ATTRIBUTE_PRINTF().
The code here can not be fixed, and
I don't see any usage of the attribute or similar
in java.base, so disabling the warning seems fine to me.
Also, it's treated similar in the other
compile block.

java_md_aix.c: good.

ProcessHandleImpl_unix.c: good

UnixNativeDispatcher.c: definitely an improvement to the code!

libGetXSpace.c: good. A test library

@openjdk
Copy link

openjdk bot commented Jun 6, 2023

@JoKern65 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:

8309219: Fix xlc17 clang 15 warnings in java.base

Reviewed-by: goetz, mdoerr

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 14 new commits pushed to the master branch:

  • 177e832: 8307153: JVMTI GetThreadState on carrier should return STATE_WAITING
  • f0236ed: 8309543: Micro-optimize x86 assembler UseCondCardMark
  • 9d7bf53: 8280982: [Wayland] [XWayland] java.awt.Robot taking screenshots
  • a1ab377: 8309550: jdk.jfr.internal.Utils::formatDataAmount method should gracefully handle amounts equal to Long.MIN_VALUE
  • c49129f: 8308445: Linker should check that capture state segment is big enough
  • fa79111: 8308031: Linkers should reject unpromoted variadic parameters
  • 16ebf47: 8309594: Cleanup naming in JavacParser related to unnamed classes
  • 5722903: 8307374: Add a JFR event for tracking RSS
  • 1de40f3: 8302145: ddepth should be uint in PhaseIdealLoop::register_node()
  • a6726b6: 8309568: javac crashes attempting to -Xprint on a class file of an unnamed class
  • ... and 4 more: https://git.openjdk.org/jdk/compare/a25b7b8b55f2dcd3c2945193d78f754580421733...master

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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@GoeLin, @TheRealMDoerr) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jun 6, 2023
Copy link
Contributor

@TheRealMDoerr TheRealMDoerr left a comment

Choose a reason for hiding this comment

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

LGTM.

cast not necessary
@JoKern65
Copy link
Contributor Author

JoKern65 commented Jun 7, 2023

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jun 7, 2023
@openjdk
Copy link

openjdk bot commented Jun 7, 2023

@JoKern65
Your change (at version 7e8f537) is now ready to be sponsored by a Committer.

@TheRealMDoerr
Copy link
Contributor

/sponsor

@openjdk
Copy link

openjdk bot commented Jun 7, 2023

Going to push as commit 6eddbe2.
Since your change was applied there have been 14 commits pushed to the master branch:

  • 177e832: 8307153: JVMTI GetThreadState on carrier should return STATE_WAITING
  • f0236ed: 8309543: Micro-optimize x86 assembler UseCondCardMark
  • 9d7bf53: 8280982: [Wayland] [XWayland] java.awt.Robot taking screenshots
  • a1ab377: 8309550: jdk.jfr.internal.Utils::formatDataAmount method should gracefully handle amounts equal to Long.MIN_VALUE
  • c49129f: 8308445: Linker should check that capture state segment is big enough
  • fa79111: 8308031: Linkers should reject unpromoted variadic parameters
  • 16ebf47: 8309594: Cleanup naming in JavacParser related to unnamed classes
  • 5722903: 8307374: Add a JFR event for tracking RSS
  • 1de40f3: 8302145: ddepth should be uint in PhaseIdealLoop::register_node()
  • a6726b6: 8309568: javac crashes attempting to -Xprint on a class file of an unnamed class
  • ... and 4 more: https://git.openjdk.org/jdk/compare/a25b7b8b55f2dcd3c2945193d78f754580421733...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jun 7, 2023
@openjdk openjdk bot closed this Jun 7, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Jun 7, 2023
@openjdk
Copy link

openjdk bot commented Jun 7, 2023

@TheRealMDoerr @JoKern65 Pushed as commit 6eddbe2.

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

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

Labels

build build-dev@openjdk.org core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated nio nio-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

3 participants