diff options
author | Stan Shebs <stanshebs@google.com> | 2018-04-20 14:44:54 -0700 |
---|---|---|
committer | Stan Shebs <stanshebs@google.com> | 2018-04-20 14:44:54 -0700 |
commit | 090479eb8ce8eecbcb78a72b8070549762f80c1b (patch) | |
tree | 448c59d07d9e77d5138b428a567768a20387fc81 | |
parent | 8254ee748c227f5921d28dd5fece73b20fde50f7 (diff) | |
download | glibc-090479eb8ce8eecbcb78a72b8070549762f80c1b.zip glibc-090479eb8ce8eecbcb78a72b8070549762f80c1b.tar.gz glibc-090479eb8ce8eecbcb78a72b8070549762f80c1b.tar.bz2 |
Work around clang mishandling of assert functions in resolver buffer allocation, fixes random error returns in resolv/ tests.
-rw-r--r-- | include/alloc_buffer.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/alloc_buffer.h b/include/alloc_buffer.h index 4167584..a06980e 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; } |