Skip to content

qsort_r.h: qsort_r() is POSIX now. #138545

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

Merged
merged 1 commit into from
May 5, 2025
Merged

Conversation

enh-google
Copy link
Contributor

No description provided.

@llvmbot llvmbot added the libc label May 5, 2025
@llvmbot
Copy link
Member

llvmbot commented May 5, 2025

@llvm/pr-subscribers-libc

Author: None (enh-google)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/138545.diff

1 Files Affected:

  • (modified) libc/src/stdlib/qsort_r.h (+3-4)
diff --git a/libc/src/stdlib/qsort_r.h b/libc/src/stdlib/qsort_r.h
index 51a459c3f7633..b0d8c57c75c78 100644
--- a/libc/src/stdlib/qsort_r.h
+++ b/libc/src/stdlib/qsort_r.h
@@ -14,10 +14,9 @@
 
 namespace LIBC_NAMESPACE_DECL {
 
-// This qsort_r uses the glibc argument ordering instead of the BSD argument
-// ordering (which puts arg before the function pointer). Putting arg after the
-// function pointer more closely matches the ordering for qsort_s, which is the
-// standardized equivalent of qsort_r.
+// This qsort_r uses the POSIX 1003.1-2024 argument ordering instead of the
+// historical BSD argument ordering (which put arg before the function pointer).
+// https://www.austingroupbugs.net/view.php?id=900
 
 void qsort_r(void *array, size_t array_size, size_t elem_size,
              int (*compare)(const void *, const void *, void *), void *arg);

@SchrodingerZhu
Copy link
Contributor

@enh-google maybe headergen config also needs to be updated.

Copy link
Contributor

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

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

LGTM

@enh-google
Copy link
Contributor Author

@enh-google maybe headergen config also needs to be updated.

github search doesn't find anything with that name?

@SchrodingerZhu
Copy link
Contributor

- GNUExtensions

@enh-google
Copy link
Contributor Author

- GNUExtensions

ah, i see. i've sent #138572 for that.

@enh-google enh-google closed this May 5, 2025
@enh-google enh-google reopened this May 5, 2025
@enh-google enh-google merged commit 673047e into llvm:main May 5, 2025
35 checks passed
@enh-google enh-google deleted the enh-google-patch-3 branch May 5, 2025 20:20
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants