-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
[libc] fix -Wgcc-compat #120303
Merged
Merged
[libc] fix -Wgcc-compat #120303
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I don't quite recall why I added those in the first place. These tests build without diagnostics for both clang and GCC with this fix. Fixes: llvm#114653
@llvm/pr-subscribers-libc Author: Nick Desaulniers (nickdesaulniers) ChangesI don't quite recall why I added those in the first place. These tests build Fixes: #114653 Full diff: https://github.com/llvm/llvm-project/pull/120303.diff 1 Files Affected:
diff --git a/libc/test/include/stdbit_stub.h b/libc/test/include/stdbit_stub.h
index 65b1ca3b2c2976..7cdb3948855499 100644
--- a/libc/test/include/stdbit_stub.h
+++ b/libc/test/include/stdbit_stub.h
@@ -17,19 +17,19 @@
#include <stdbool.h> // bool in C
#define STDBIT_STUB_FUNCTION(FUNC_NAME, LEADING_VAL) \
- unsigned FUNC_NAME##_uc(unsigned char x) __NOEXCEPT { \
+ unsigned FUNC_NAME##_uc(unsigned char x) { \
return LEADING_VAL##AU; \
} \
- unsigned FUNC_NAME##_us(unsigned short x) __NOEXCEPT { \
+ unsigned FUNC_NAME##_us(unsigned short x) { \
return LEADING_VAL##BU; \
} \
- unsigned FUNC_NAME##_ui(unsigned int x) __NOEXCEPT { \
+ unsigned FUNC_NAME##_ui(unsigned int x) { \
return LEADING_VAL##CU; \
} \
- unsigned FUNC_NAME##_ul(unsigned long x) __NOEXCEPT { \
+ unsigned FUNC_NAME##_ul(unsigned long x) { \
return LEADING_VAL##DU; \
} \
- unsigned FUNC_NAME##_ull(unsigned long long x) __NOEXCEPT { \
+ unsigned FUNC_NAME##_ull(unsigned long long x) { \
return LEADING_VAL##EU; \
}
@@ -46,27 +46,27 @@ STDBIT_STUB_FUNCTION(stdc_first_trailing_one, 0x1)
STDBIT_STUB_FUNCTION(stdc_count_zeros, 0x2)
STDBIT_STUB_FUNCTION(stdc_count_ones, 0x3)
-bool stdc_has_single_bit_uc(unsigned char x) __NOEXCEPT { return false; }
-bool stdc_has_single_bit_us(unsigned short x) __NOEXCEPT { return false; }
-bool stdc_has_single_bit_ui(unsigned x) __NOEXCEPT { return false; }
-bool stdc_has_single_bit_ul(unsigned long x) __NOEXCEPT { return false; }
-bool stdc_has_single_bit_ull(unsigned long long x) __NOEXCEPT { return false; }
+bool stdc_has_single_bit_uc(unsigned char x) { return false; }
+bool stdc_has_single_bit_us(unsigned short x) { return false; }
+bool stdc_has_single_bit_ui(unsigned x) { return false; }
+bool stdc_has_single_bit_ul(unsigned long x) { return false; }
+bool stdc_has_single_bit_ull(unsigned long long x) { return false; }
STDBIT_STUB_FUNCTION(stdc_bit_width, 0x4)
-unsigned char stdc_bit_floor_uc(unsigned char x) __NOEXCEPT { return 0x5AU; }
-unsigned short stdc_bit_floor_us(unsigned short x) __NOEXCEPT { return 0x5BU; }
-unsigned stdc_bit_floor_ui(unsigned x) __NOEXCEPT { return 0x5CU; }
-unsigned long stdc_bit_floor_ul(unsigned long x) __NOEXCEPT { return 0x5DUL; }
-unsigned long long stdc_bit_floor_ull(unsigned long long x) __NOEXCEPT {
+unsigned char stdc_bit_floor_uc(unsigned char x) { return 0x5AU; }
+unsigned short stdc_bit_floor_us(unsigned short x) { return 0x5BU; }
+unsigned stdc_bit_floor_ui(unsigned x) { return 0x5CU; }
+unsigned long stdc_bit_floor_ul(unsigned long x) { return 0x5DUL; }
+unsigned long long stdc_bit_floor_ull(unsigned long long x) {
return 0x5EULL;
}
-unsigned char stdc_bit_ceil_uc(unsigned char x) __NOEXCEPT { return 0x6AU; }
-unsigned short stdc_bit_ceil_us(unsigned short x) __NOEXCEPT { return 0x6BU; }
-unsigned stdc_bit_ceil_ui(unsigned x) __NOEXCEPT { return 0x6CU; }
-unsigned long stdc_bit_ceil_ul(unsigned long x) __NOEXCEPT { return 0x6DUL; }
-unsigned long long stdc_bit_ceil_ull(unsigned long long x) __NOEXCEPT {
+unsigned char stdc_bit_ceil_uc(unsigned char x) { return 0x6AU; }
+unsigned short stdc_bit_ceil_us(unsigned short x) { return 0x6BU; }
+unsigned stdc_bit_ceil_ui(unsigned x) { return 0x6CU; }
+unsigned long stdc_bit_ceil_ul(unsigned long x) { return 0x6DUL; }
+unsigned long long stdc_bit_ceil_ull(unsigned long long x) {
return 0x6EULL;
}
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
lntue
approved these changes
Dec 17, 2024
SchrodingerZhu
approved these changes
Dec 17, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I don't quite recall why I added those in the first place. These tests build
without diagnostics for both clang and GCC with this fix.
Fixes: #114653