Skip to content
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] Add backup definition for LONG_WIDTH in limits-macros.h. #79375

Merged
merged 2 commits into from
Jan 24, 2024

Conversation

lntue
Copy link
Contributor

@lntue lntue commented Jan 24, 2024

No description provided.

@llvmbot
Copy link

llvmbot commented Jan 24, 2024

@llvm/pr-subscribers-libc

Author: None (lntue)

Changes

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

1 Files Affected:

  • (modified) libc/include/llvm-libc-macros/limits-macros.h (+2-2)
diff --git a/libc/include/llvm-libc-macros/limits-macros.h b/libc/include/llvm-libc-macros/limits-macros.h
index fc21d1318a081b..1926bc25bcfa1d 100644
--- a/libc/include/llvm-libc-macros/limits-macros.h
+++ b/libc/include/llvm-libc-macros/limits-macros.h
@@ -69,8 +69,8 @@
 #define LONG_WIDTH __LONG_WIDTH__
 #elif defined(__WORDSIZE)
 #define LONG_WIDTH __WORDSIZE
-#else
-#error "Unknown WORDSIZE to define LONG_WIDTH."
+#else // use sizeof(long) * CHAR_BIT as backup.
+#define LONG_WIDTH (sizeof(long) * CHAR_BIT)
 #endif // __LONG_WIDTH__
 #endif // LONG_WIDTH
 

Copy link
Contributor

@SchrodingerZhu SchrodingerZhu left a comment

Choose a reason for hiding this comment

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

Lgtm

@lntue lntue merged commit 3a92b20 into llvm:main Jan 24, 2024
4 checks passed
@lntue lntue deleted the limit branch January 24, 2024 22:19
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