public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] dynarray: Use libc_hidden_proto only for !_ISOMAC
@ 2017-06-13  9:16 Florian Weimer
  2017-06-16 11:24 ` Florian Weimer
  0 siblings, 1 reply; 4+ messages in thread
From: Florian Weimer @ 2017-06-13  9:16 UTC (permalink / raw)
  To: libc-alpha

With this change, it is possible to use dynarray from non-internal
tests.

2017-06-13  Florian Weimer  <fweimer@redhat.com>

	* malloc/dynarray.h: Use libc_hidden_proto only for !_ISOMAC.

diff --git a/malloc/dynarray.h b/malloc/dynarray.h
index c73e08b..5888bcb 100644
--- a/malloc/dynarray.h
+++ b/malloc/dynarray.h
@@ -128,7 +128,6 @@ __dynarray_error (struct dynarray_header *list)
    Return false on failure, true on success.  */
 bool __libc_dynarray_emplace_enlarge (struct dynarray_header *,
                                       void *scratch, size_t element_size);
-libc_hidden_proto (__libc_dynarray_emplace_enlarge)
 
 /* Internal function.  Enlarge the dynamically allocated area of the
    array to make room for at least SIZE elements (which must be larger
@@ -138,13 +137,11 @@ libc_hidden_proto (__libc_dynarray_emplace_enlarge)
    Return false on failure, true on success.  */
 bool __libc_dynarray_resize (struct dynarray_header *, size_t size,
                              void *scratch, size_t element_size);
-libc_hidden_proto (__libc_dynarray_resize)
 
 /* Internal function.  Like __libc_dynarray_resize, but clear the new
    part of the dynamic array.  */
 bool __libc_dynarray_resize_clear (struct dynarray_header *, size_t size,
                                    void *scratch, size_t element_size);
-libc_hidden_proto (__libc_dynarray_resize_clear)
 
 /* Internal type.  */
 struct dynarray_finalize_result
@@ -163,7 +160,6 @@ struct dynarray_finalize_result
 bool __libc_dynarray_finalize (struct dynarray_header *list, void *scratch,
                                size_t element_size,
                                struct dynarray_finalize_result *result);
-libc_hidden_proto (__libc_dynarray_finalize)
 
 
 /* Internal function.  Terminate the process after an index error.
@@ -171,6 +167,13 @@ libc_hidden_proto (__libc_dynarray_finalize)
    lookup index which triggered the failure.  */
 void __libc_dynarray_at_failure (size_t size, size_t index)
   __attribute__ ((noreturn));
+
+#ifndef _ISOMAC
+libc_hidden_proto (__libc_dynarray_emplace_enlarge)
+libc_hidden_proto (__libc_dynarray_resize)
+libc_hidden_proto (__libc_dynarray_resize_clear)
+libc_hidden_proto (__libc_dynarray_finalize)
 libc_hidden_proto (__libc_dynarray_at_failure)
+#endif
 
 #endif /* _DYNARRAY_H */

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dynarray: Use libc_hidden_proto only for !_ISOMAC
  2017-06-13  9:16 [PATCH] dynarray: Use libc_hidden_proto only for !_ISOMAC Florian Weimer
@ 2017-06-16 11:24 ` Florian Weimer
  2017-06-16 13:26   ` Zack Weinberg
  0 siblings, 1 reply; 4+ messages in thread
From: Florian Weimer @ 2017-06-16 11:24 UTC (permalink / raw)
  To: libc-alpha; +Cc: Zack Weinberg

On 06/13/2017 11:16 AM, Florian Weimer wrote:
> With this change, it is possible to use dynarray from non-internal
> tests.
> 
> 2017-06-13  Florian Weimer  <fweimer@redhat.com>
> 
> 	* malloc/dynarray.h: Use libc_hidden_proto only for !_ISOMAC.
> 
> diff --git a/malloc/dynarray.h b/malloc/dynarray.h
> index c73e08b..5888bcb 100644
> --- a/malloc/dynarray.h
> +++ b/malloc/dynarray.h
> @@ -128,7 +128,6 @@ __dynarray_error (struct dynarray_header *list)
>     Return false on failure, true on success.  */
>  bool __libc_dynarray_emplace_enlarge (struct dynarray_header *,
>                                        void *scratch, size_t element_size);
> -libc_hidden_proto (__libc_dynarray_emplace_enlarge)
>  
>  /* Internal function.  Enlarge the dynamically allocated area of the
>     array to make room for at least SIZE elements (which must be larger
> @@ -138,13 +137,11 @@ libc_hidden_proto (__libc_dynarray_emplace_enlarge)
>     Return false on failure, true on success.  */
>  bool __libc_dynarray_resize (struct dynarray_header *, size_t size,
>                               void *scratch, size_t element_size);
> -libc_hidden_proto (__libc_dynarray_resize)
>  
>  /* Internal function.  Like __libc_dynarray_resize, but clear the new
>     part of the dynamic array.  */
>  bool __libc_dynarray_resize_clear (struct dynarray_header *, size_t size,
>                                     void *scratch, size_t element_size);
> -libc_hidden_proto (__libc_dynarray_resize_clear)
>  
>  /* Internal type.  */
>  struct dynarray_finalize_result
> @@ -163,7 +160,6 @@ struct dynarray_finalize_result
>  bool __libc_dynarray_finalize (struct dynarray_header *list, void *scratch,
>                                 size_t element_size,
>                                 struct dynarray_finalize_result *result);
> -libc_hidden_proto (__libc_dynarray_finalize)
>  
>  
>  /* Internal function.  Terminate the process after an index error.
> @@ -171,6 +167,13 @@ libc_hidden_proto (__libc_dynarray_finalize)
>     lookup index which triggered the failure.  */
>  void __libc_dynarray_at_failure (size_t size, size_t index)
>    __attribute__ ((noreturn));
> +
> +#ifndef _ISOMAC
> +libc_hidden_proto (__libc_dynarray_emplace_enlarge)
> +libc_hidden_proto (__libc_dynarray_resize)
> +libc_hidden_proto (__libc_dynarray_resize_clear)
> +libc_hidden_proto (__libc_dynarray_finalize)
>  libc_hidden_proto (__libc_dynarray_at_failure)
> +#endif
>  
>  #endif /* _DYNARRAY_H */

Any comments?  I'd like to commit this soon.

This approach follows earlier examples (e.g. in include/string.h).

Thanks,
Florian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dynarray: Use libc_hidden_proto only for !_ISOMAC
  2017-06-16 11:24 ` Florian Weimer
@ 2017-06-16 13:26   ` Zack Weinberg
  2017-06-25 14:25     ` Florian Weimer
  0 siblings, 1 reply; 4+ messages in thread
From: Zack Weinberg @ 2017-06-16 13:26 UTC (permalink / raw)
  To: Florian Weimer; +Cc: GNU C Library

On Fri, Jun 16, 2017 at 7:24 AM, Florian Weimer <fweimer@redhat.com> wrote:
> On 06/13/2017 11:16 AM, Florian Weimer wrote:
>> With this change, it is possible to use dynarray from non-internal
>> tests.
>>
>> 2017-06-13  Florian Weimer  <fweimer@redhat.com>
>>
>>       * malloc/dynarray.h: Use libc_hidden_proto only for !_ISOMAC.

I'm a little surprised it's possible to call these functions from
outside libc, but the patch itself seems correct as long as this isn't
an installed header.

zw

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dynarray: Use libc_hidden_proto only for !_ISOMAC
  2017-06-16 13:26   ` Zack Weinberg
@ 2017-06-25 14:25     ` Florian Weimer
  0 siblings, 0 replies; 4+ messages in thread
From: Florian Weimer @ 2017-06-25 14:25 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: GNU C Library

On 06/16/2017 03:26 PM, Zack Weinberg wrote:
> On Fri, Jun 16, 2017 at 7:24 AM, Florian Weimer <fweimer@redhat.com> wrote:
>> On 06/13/2017 11:16 AM, Florian Weimer wrote:
>>> With this change, it is possible to use dynarray from non-internal
>>> tests.
>>>
>>> 2017-06-13  Florian Weimer  <fweimer@redhat.com>
>>>
>>>       * malloc/dynarray.h: Use libc_hidden_proto only for !_ISOMAC.
> 
> I'm a little surprised it's possible to call these functions from
> outside libc, but the patch itself seems correct as long as this isn't
> an installed header.

They are exported as GLIBC_PRIVATE, so that we can use arrays from other
parts of glibc.

Thanks,
Florian

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-25 14:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-13  9:16 [PATCH] dynarray: Use libc_hidden_proto only for !_ISOMAC Florian Weimer
2017-06-16 11:24 ` Florian Weimer
2017-06-16 13:26   ` Zack Weinberg
2017-06-25 14:25     ` Florian Weimer

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).