public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/maskray/grte] Work around clang mishandling of assert functions in resolver buffer allocation, fixes random error
@ 2021-08-27 23:25 Fangrui Song
0 siblings, 0 replies; only message in thread
From: Fangrui Song @ 2021-08-27 23:25 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=090479eb8ce8eecbcb78a72b8070549762f80c1b
commit 090479eb8ce8eecbcb78a72b8070549762f80c1b
Author: Stan Shebs <stanshebs@google.com>
Date: Fri Apr 20 14:44:54 2018 -0700
Work around clang mishandling of assert functions in resolver buffer allocation, fixes random error returns in resolv/ tests.
Diff:
---
include/alloc_buffer.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/alloc_buffer.h b/include/alloc_buffer.h
index 4167584f6f..a06980e6d2 100644
--- a/include/alloc_buffer.h
+++ b/include/alloc_buffer.h
@@ -213,6 +213,10 @@ alloc_buffer_alloc_bytes (struct alloc_buffer *buf, size_t length)
static __always_inline size_t
__alloc_buffer_assert_size (size_t size)
{
+ /* clang does not presently support the __error__ attribute, and for
+ some reason the fallback case for __errordecl results in error()
+ being called unconditionally. So skip over this for now. */
+#ifndef __clang__
if (!__builtin_constant_p (size))
{
__errordecl (error, "type size is not constant");
@@ -223,6 +227,7 @@ __alloc_buffer_assert_size (size_t size)
__errordecl (error, "type size is zero");
error ();
}
+#endif
return size;
}
@@ -231,6 +236,8 @@ __alloc_buffer_assert_size (size_t size)
static __always_inline size_t
__alloc_buffer_assert_align (size_t align)
{
+ /* As above - skip until we have a better idea for clang here. */
+#ifndef __clang__
if (!__builtin_constant_p (align))
{
__errordecl (error, "type alignment is not constant");
@@ -246,6 +253,7 @@ __alloc_buffer_assert_align (size_t align)
__errordecl (error, "type alignment is not a power of two");
error ();
}
+#endif
return align;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-08-27 23:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-27 23:25 [glibc/maskray/grte] Work around clang mishandling of assert functions in resolver buffer allocation, fixes random error Fangrui Song
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).