Skip to content

8365296: Build failure with Clang due to -Wformat warning after JDK-8364611#26771

Closed
hgqxjj wants to merge 5 commits intoopenjdk:masterfrom
hgqxjj:8365296
Closed

8365296: Build failure with Clang due to -Wformat warning after JDK-8364611#26771
hgqxjj wants to merge 5 commits intoopenjdk:masterfrom
hgqxjj:8365296

Conversation

@hgqxjj
Copy link
Member

@hgqxjj hgqxjj commented Aug 14, 2025

This issue is related to the definition of __sigset_t (__sigset_t act.sa_mask). In the glibc source, __sigset_t is defined in multiple places:

  • bits/types/__sigset_t.h
image02
  • sysdeps/unix/sysv/linux/bits/types/__sigset_t.h (introduced after glibc 2.25)
image01

During compilation with Clang, the latter definition appears to be used, where __sigset_t is a struct, causing the printf("%X", act.sa_mask) to fail.

we can detect whether _SIGSET_NWORDS is defined and handle the printing differently based on that, ensuring correct handling of the struct type.


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-8365296: Build failure with Clang due to -Wformat warning after JDK-8364611 (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 26771

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

Using diff file

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

Using Webrev

Link to Webrev Comment

…364611

This issue is related to the definition of __sigset_t (__sigset_t  act.sa_mask).  
In the glibc source, __sigset_t is defined in multiple places:  
- bits/types/__sigset_t.h  
- sysdeps/unix/sysv/linux/bits/types/__sigset_t.h (introduced after glibc 2.25)  
During compilation with Clang, the latter definition appears to be used, where __sigset_t is a struct, causing the printf("%X", act.sa_mask) to fail.
@bridgekeeper
Copy link

bridgekeeper bot commented Aug 14, 2025

👋 Welcome back ghan! 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 14, 2025

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

8365296: Build failure with Clang due to -Wformat warning after JDK-8364611

Reviewed-by: ayang, mbaesken

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 16 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.

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 (@albertnetymk, @MBaesken) 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
Copy link

openjdk bot commented Aug 14, 2025

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

  • core-libs

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.

@openjdk openjdk bot added core-libs core-libs-dev@openjdk.org rfr Pull request is ready for review labels Aug 14, 2025
@mlbridge
Copy link

mlbridge bot commented Aug 14, 2025

Webrevs

@MBaesken
Copy link
Member

Seems there is also coding in os_posix.cpp ( describe_signal_set_short ) to print signal information , maybe 'borrow' from there?

Refactor act.sa_mask output
@openjdk openjdk bot removed the rfr Pull request is ready for review label Aug 14, 2025
@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 14, 2025
@hgqxjj
Copy link
Member Author

hgqxjj commented Aug 14, 2025

Hi @MBaesken
Thanks for the suggestion! I’ve updated the code as you requested. Please take a look when you have time.

Copy link
Member

@albertnetymk albertnetymk left a comment

Choose a reason for hiding this comment

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

The fix looks reasonable. However, the discrepancy btw and AIX and others seems unnecessary complexity. I'd prefer having ifdef removed also.

Looking at how these prints are used/tested, I believe sa_mask is not really needed and it doesn't seem very useful also. Therefore, I'd suggest removing it, just like what's done for AIX. My 2c.

@hgqxjj
Copy link
Member Author

hgqxjj commented Aug 15, 2025

hi @albertnetymk , thanks for the feedback! I agree that removing it would be the simplest solution.
Let’s get @MBaesken input as well, and if we reach an agreement, I’m happy to proceed with the simplest approach.

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: XX, YY, means that this file was created in XX year and the latest update is done in YY year. If XX == YY, then use XX,.

Suggested change
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi @shqking , thanks for the suggestion! I checked the file history, and it was actually created in 2025. Therefore, I updated the copyright to Copyright (c) 2025 to reflect the correct creation year. If the file gets updated in the future, we can follow the “XX, YY” format.

@MBaesken
Copy link
Member

The fix looks reasonable. However, the discrepancy btw and AIX and others seems unnecessary complexity. I'd prefer having ifdef removed also.

Looking at how these prints are used/tested, I believe sa_mask is not really needed and it doesn't seem very useful also. Therefore, I'd suggest removing it, just like what's done for AIX. My 2c.

That's fine .

Remove unnecessary sa_mask printing based on reviewer feedback
@hgqxjj
Copy link
Member Author

hgqxjj commented Aug 15, 2025

@MBaesken @albertnetymk
Thanks for the feedback. I’ve removed the sa_mask printing as suggested. Please take another look when you have time.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Aug 15, 2025
@hgqxjj
Copy link
Member Author

hgqxjj commented Aug 15, 2025

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Aug 15, 2025
@openjdk
Copy link

openjdk bot commented Aug 15, 2025

@hgqxjj
Your change (at version 3096127) is now ready to be sponsored by a Committer.

@hgqxjj
Copy link
Member Author

hgqxjj commented Aug 15, 2025

Many thanks to both of you @MBaesken @albertnetymk for your review and approval. I’ve integrated the changes.
Please sponsor it — appreciate it!

@MBaesken
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Aug 15, 2025

Going to push as commit b6d5f49.
Since your change was applied there have been 16 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 Aug 15, 2025
@openjdk openjdk bot closed this Aug 15, 2025
@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 Aug 15, 2025
@openjdk
Copy link

openjdk bot commented Aug 15, 2025

@MBaesken @hgqxjj Pushed as commit b6d5f49.

💡 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

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

Development

Successfully merging this pull request may close these issues.

4 participants