Skip to content

src: modernize cleanup queue to use c++20 - #56063

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
anonrig:yagiz/simplify-cleanup-queue
Jan 31, 2025
Merged

src: modernize cleanup queue to use c++20#56063
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
anonrig:yagiz/simplify-cleanup-queue

Conversation

@anonrig

Copy link
Copy Markdown
Member

Getting the idea from @jasnell on #56059, let's use std::ranges::sort and spaceship operator to sort with std::ranges::sort which is available on C++20.

@anonriganonrig added dont-land-on-v18.x dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. labels Nov 28, 2024
@nodejs-github-botnodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Nov 28, 2024
@codecov

codecovBot commented Nov 28, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.

Project coverage is 87.99%. Comparing base (4cf6fab) to head (2a94e99).
Report is 438 commits behind head on main.

Files with missing linesPatch %Lines
src/cleanup_queue-inl.h71.42%1 Missing and 1 partial ⚠️
src/cleanup_queue.cc75.00%0 Missing and 1 partial ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #56063 +/- ##
==========================================
- Coverage 88.00% 87.99% -0.01% 
==========================================
Files 656 656 Lines 188988 189002 +14 Branches 35992 35988 -4 ==========================================
- Hits 166315 166310 -5 - Misses 15838 15849 +11 - Partials 6835 6843 +8 
Files with missing linesCoverage Δ
src/cleanup_queue.h100.00% <ø> (ø)
src/cleanup_queue.cc81.25% <75.00%> (-4.47%)⬇️
src/cleanup_queue-inl.h85.00% <71.42%> (-7.31%)⬇️

... and 27 files with indirect coverage changes

@legendecaslegendecas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks! Commented some style thoughts...

Comment threadsrc/cleanup_queue.cc Outdated
Comment threadsrc/cleanup_queue.h Outdated
Comment threadsrc/cleanup_queue.cc Outdated
Comment threadsrc/cleanup_queue.h Outdated
@anonrig
anonrigforce-pushed the yagiz/simplify-cleanup-queue branch 2 times, most recently from 440000e to 5cb91ddCompareNovember 29, 2024 16:43
Comment threadsrc/cleanup_queue.h Outdated
@anonriganonrig added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Nov 29, 2024
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 29, 2024
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@anonrig

Copy link
Copy Markdown
MemberAuthor

cc @nodejs/build is there a limitation in macOS regarding this?

12:42:22 ../src/cleanup_queue-inl.h:35:17: error: no member named 'strong_ordering' in namespace 'std'
12:42:22 return std::strong_ordering::greater;
12:42:22 ~~~~~^
12:42:22 ../src/cleanup_queue-inl.h:39:17: error: no member named 'strong_ordering' in namespace 'std'
12:42:22 return std::strong_ordering::less;
12:42:22 ~~~~~^
12:42:22 ../src/cleanup_queue-inl.h:41:15: error: no member named 'strong_ordering' in namespace 'std'
12:42:22 return std::strong_ordering::equivalent;
12:42:22 ~~~~~^

@anonriganonrig added the blocked PRs that are blocked by other issues or PRs. label Nov 29, 2024
@jasnell

Copy link
Copy Markdown
Member

Are you missing an #include <compare>

@anonrig

Copy link
Copy Markdown
MemberAuthor

Are you missing an #include <compare>

Yes, but is it only required on macOS?

@anonrig
anonrigforce-pushed the yagiz/simplify-cleanup-queue branch from 5cb91dd to 23b6994CompareNovember 29, 2024 22:19
@anonriganonrig removed the blocked PRs that are blocked by other issues or PRs. label Nov 29, 2024
@anonrig

Copy link
Copy Markdown
MemberAuthor

cc @nodejs/build This is blocked my macOS infrastructure as well.

20:44:45 ../src/cleanup_queue.cc:3:10: fatal error: 'ranges' file not found
20:44:45 #include <ranges>
20:44:45 ^~~~~~~~
20:44:46 1 error generated.

@anonriganonrig added the blocked PRs that are blocked by other issues or PRs. label Dec 2, 2024
@jasnell

Copy link
Copy Markdown
Member

@anonrig do you know if this is still being blocked by macos test runners?

@anonrig

Copy link
Copy Markdown
MemberAuthor

@anonrig do you know if this is still being blocked by macos test runners?

Yes it is still blocked

@jasnell

Copy link
Copy Markdown
Member

@nodejs/platform-macos

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@targostargos added commit-queue Add this label to land a pull request using GitHub Actions. and removed blocked PRs that are blocked by other issues or PRs. labels Jan 31, 2025
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 31, 2025
@nodejs-github-bot
nodejs-github-bot merged commit 581b444 into nodejs:mainJan 31, 2025
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 581b444

@lpinca

lpinca commented Jan 31, 2025

Copy link
Copy Markdown
Member

It seems this broke the "Test Linux" workflow. Is a GCC update needed?

@targos

Copy link
Copy Markdown
Member

It's probably the opposite: I guess GCC was updated in the GitHub runners since the last push (two months ago) and includes new warnings.

@anonrig

Copy link
Copy Markdown
MemberAuthor

It seems this broke the "Test Linux" action. Is a GCC update needed?

No the only blocker for this was the macOS build. So Linux shouldn't break unless something changed that's outside of the scope of this Pr in the past 2 months, that broke this pr when it landed.

@anonrig

Copy link
Copy Markdown
MemberAuthor

@targos I am away from keyboard. Can you revert this PR? I can re-land it later. Right now your v8 work is more important.

@lpinca

Copy link
Copy Markdown
Member

FWIW the error is:

../src/cleanup_queue.cc:18:32: error: 'greater' may not intend to support class template argument deduction [-Werror,-Wctad-maybe-unsupported]
18 | std::ranges::sort(callbacks, std::greater());
| ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_function.h:390:12: note: add a deduction guide to suppress this warning
390 | struct greater : public binary_function<_Tp, _Tp, bool>
| ^
1 error generated.

@richardlau

Copy link
Copy Markdown
Member

The "Test Linux" workflow uses clang, not GCC.

CC: sccache clang
CXX: sccache clang++

@richardlau

Copy link
Copy Markdown
Member

The "Test Linux" workflow uses clang, not GCC.

Although FWIW actions/runner-images#11197 back in December updated GNU C++ from 13.2.0 to 13.3.0.

@richardlau

Copy link
Copy Markdown
Member

I am away from keyboard. Can you revert this PR? I can re-land it later. Right now your v8 work is more important.

#56846

nodejs-github-bot pushed a commit that referenced this pull request Feb 1, 2025
This reverts commit 581b444.
PR-URL: #56846
Refs: #56063
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.c++Issues and PRs that require attention from people who are familiar with C++.dont-land-on-v22.xPRs that should not land on the v22.x-staging branch and should not be released in v22.x.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants

@anonrig@nodejs-github-bot@jasnell@lpinca@targos@richardlau@mcollina@legendecas@RafaelGSS@aduh95