public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/clang] Refactor internal alias for internal function
@ 2022-03-15 18:41 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-03-15 18:41 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=bf15cf1e24570ea3c077b7e30e889c1427822c80

commit bf15cf1e24570ea3c077b7e30e889c1427822c80
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 11 15:37:57 2022 -0300

    Refactor internal alias for internal function
    
    Instead of defining the internal alias with hidden_proto macros, adds
    a new hidden_proto3 which defines the macro on function prototype
    (so there is only one function prototype).

Diff:
---
 include/alloc_buffer.h  | 33 ++++++++++++++++-----------------
 include/allocate_once.h | 17 ++++++++---------
 include/libc-symbols.h  |  8 ++++++++
 3 files changed, 32 insertions(+), 26 deletions(-)

diff --git a/include/alloc_buffer.h b/include/alloc_buffer.h
index be33e8b68c..9c824830c7 100644
--- a/include/alloc_buffer.h
+++ b/include/alloc_buffer.h
@@ -83,6 +83,10 @@
 #include <stdlib.h>
 #include <sys/param.h>
 
+#ifdef _ISOMAC
+# define hidden_proto3(name, proto) name proto
+#endif
+
 /* struct alloc_buffer objects refer to a region of bytes in memory of a
    fixed size.  The functions below can be used to allocate single
    objects and arrays from this memory region, or write to its end.
@@ -113,7 +117,8 @@ enum
   };
 
 /* Internal function.  Terminate the process using __libc_fatal.  */
-void __libc_alloc_buffer_create_failure (void *start, size_t size);
+void hidden_proto3 (__libc_alloc_buffer_create_failure,
+		    (void *start, size_t size));
 
 /* Create a new allocation buffer.  The byte range from START to START
    + SIZE - 1 must be valid, and the allocation buffer allocates
@@ -130,7 +135,8 @@ alloc_buffer_create (void *start, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_allocate below.  */
-struct alloc_buffer __libc_alloc_buffer_allocate (size_t size, void **pptr)
+struct alloc_buffer hidden_proto3 (__libc_alloc_buffer_allocate,
+				   (size_t size, void **pptr))
   __attribute__ ((nonnull (2)));
 
 /* Allocate a buffer of SIZE bytes using malloc.  The returned buffer
@@ -329,9 +335,9 @@ __alloc_buffer_next (struct alloc_buffer *buf, size_t align)
    (buf, __alloc_buffer_assert_align (__alignof__ (type))))
 
 /* Internal function.  Allocate an array.  */
-void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
-					size_t size, size_t align,
-					size_t count)
+void * hidden_proto3 (__libc_alloc_buffer_alloc_array,
+		      (struct alloc_buffer *buf, size_t size, size_t align,
+		       size_t count))
   __attribute__ ((nonnull (1)));
 
 /* Obtain a TYPE * pointer to an array of COUNT objects in BUF of
@@ -346,8 +352,9 @@ void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
     count))
 
 /* Internal function.  See alloc_buffer_copy_bytes below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_bytes (struct alloc_buffer,
-						    const void *, size_t)
+struct alloc_buffer hidden_proto3 (__libc_alloc_buffer_copy_bytes,
+				   (struct alloc_buffer, const void *,
+				    size_t))
   __attribute__ ((nonnull (2)));
 
 /* Copy SIZE bytes starting at SRC into the buffer.  If there is not
@@ -360,8 +367,8 @@ alloc_buffer_copy_bytes (struct alloc_buffer *buf, const void *src, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_copy_string below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_string (struct alloc_buffer,
-						     const char *)
+struct alloc_buffer hidden_proto3 (__libc_alloc_buffer_copy_string,
+				   (struct alloc_buffer, const char *))
   __attribute__ ((nonnull (2)));
 
 /* Copy the string at SRC into the buffer, including its null
@@ -377,12 +384,4 @@ alloc_buffer_copy_string (struct alloc_buffer *buf, const char *src)
   return result;
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_alloc_buffer_alloc_array)
-libc_hidden_proto (__libc_alloc_buffer_allocate)
-libc_hidden_proto (__libc_alloc_buffer_copy_bytes)
-libc_hidden_proto (__libc_alloc_buffer_copy_string)
-libc_hidden_proto (__libc_alloc_buffer_create_failure)
-#endif
-
 #endif /* _ALLOC_BUFFER_H */
diff --git a/include/allocate_once.h b/include/allocate_once.h
index a487d641d5..3d267fafe4 100644
--- a/include/allocate_once.h
+++ b/include/allocate_once.h
@@ -21,12 +21,15 @@
 
 #include <atomic.h>
 
+#ifdef _ISOMAC
+# define hidden_proto3(name, proto) name proto
+#endif
+
 /* Slow path for allocate_once; see below.  */
-void *__libc_allocate_once_slow (void **__place,
-                                 void *(*__allocate) (void *__closure),
-                                 void (*__deallocate) (void *__closure,
-                                                       void *__ptr),
-                                 void *__closure);
+void * hidden_proto3 (__libc_allocate_once_slow,
+		      (void **__place, void *(*__allocate) (void *__closure),
+		       void (*__deallocate) (void *__closure, void *__ptr),
+		       void *__closure));
 
 /* Return an a pointer to an allocated and initialized data structure.
    If this function returns a non-NULL value, the caller can assume
@@ -88,8 +91,4 @@ allocate_once (void **__place, void *(*__allocate) (void *__closure),
                                       __closure);
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_allocate_once_slow)
-#endif
-
 #endif /* _ALLOCATE_ONCE_H */
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 4a55a8f7f9..a346520cad 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -539,6 +539,11 @@ for linking")
   __hidden_proto (name, , __GI_##name, ##attrs)
 #  define hidden_proto2(type, name, attrs...) \
   __hidden_proto2 (type, name, , __GI_##name, ##attrs)
+#  define __hidden_proto_alias(internal) \
+    __asm__(__hidden_asmname (#internal))
+#  define hidden_proto3(name, proto, attrs...) \
+  name proto __hidden_proto_alias (__GI_##name) \
+   __hidden_proto_hiddenattr (##attrs)
 #  define hidden_tls_proto(name, attrs...) \
   __hidden_proto (name, __thread, __GI_##name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
@@ -610,8 +615,11 @@ for linking")
   __hidden_proto (name, __thread, name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
   extern thread __typeof (name) name __hidden_proto_hiddenattr (attrs);
+#  define hidden_proto3(name, proto, attrs...) \
+     name proto __hidden_proto_hiddenattr (##attrs)
 # else
 #   define hidden_proto(name, attrs...)
+#   define hidden_proto3(name, proto, attrs...) name proto
 #   define hidden_tls_proto(name, attrs...)
 # endif
 # define __hidden_proto2(type, name, thread, attrs...)     \


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

* [glibc/azanella/clang] Refactor internal alias for internal function
@ 2022-10-04 12:56 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-10-04 12:56 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=856eecac217b5aa08d24dee8a3e2cd19fb07dcf3

commit 856eecac217b5aa08d24dee8a3e2cd19fb07dcf3
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 11 15:37:57 2022 -0300

    Refactor internal alias for internal function
    
    Instead of defining the internal alias with hidden_proto macros, adds
    a new hidden_proto3 which defines the macro on function prototype
    (so there is only one function prototype).

Diff:
---
 include/alloc_buffer.h  | 33 ++++++++++++++++-----------------
 include/allocate_once.h | 17 ++++++++---------
 include/libc-symbols.h  |  9 +++++++++
 3 files changed, 33 insertions(+), 26 deletions(-)

diff --git a/include/alloc_buffer.h b/include/alloc_buffer.h
index be33e8b68c..5660642d73 100644
--- a/include/alloc_buffer.h
+++ b/include/alloc_buffer.h
@@ -83,6 +83,10 @@
 #include <stdlib.h>
 #include <sys/param.h>
 
+#ifdef _ISOMAC
+# define libc_hidden_proto3(name, proto) name proto
+#endif
+
 /* struct alloc_buffer objects refer to a region of bytes in memory of a
    fixed size.  The functions below can be used to allocate single
    objects and arrays from this memory region, or write to its end.
@@ -113,7 +117,8 @@ enum
   };
 
 /* Internal function.  Terminate the process using __libc_fatal.  */
-void __libc_alloc_buffer_create_failure (void *start, size_t size);
+void libc_hidden_proto3 (__libc_alloc_buffer_create_failure,
+			 (void *start, size_t size));
 
 /* Create a new allocation buffer.  The byte range from START to START
    + SIZE - 1 must be valid, and the allocation buffer allocates
@@ -130,7 +135,8 @@ alloc_buffer_create (void *start, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_allocate below.  */
-struct alloc_buffer __libc_alloc_buffer_allocate (size_t size, void **pptr)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_allocate,
+					(size_t size, void **pptr))
   __attribute__ ((nonnull (2)));
 
 /* Allocate a buffer of SIZE bytes using malloc.  The returned buffer
@@ -329,9 +335,9 @@ __alloc_buffer_next (struct alloc_buffer *buf, size_t align)
    (buf, __alloc_buffer_assert_align (__alignof__ (type))))
 
 /* Internal function.  Allocate an array.  */
-void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
-					size_t size, size_t align,
-					size_t count)
+void * libc_hidden_proto3 (__libc_alloc_buffer_alloc_array,
+			   (struct alloc_buffer *buf, size_t size, size_t align,
+			    size_t count))
   __attribute__ ((nonnull (1)));
 
 /* Obtain a TYPE * pointer to an array of COUNT objects in BUF of
@@ -346,8 +352,9 @@ void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
     count))
 
 /* Internal function.  See alloc_buffer_copy_bytes below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_bytes (struct alloc_buffer,
-						    const void *, size_t)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_bytes,
+					(struct alloc_buffer, const void *,
+					 size_t))
   __attribute__ ((nonnull (2)));
 
 /* Copy SIZE bytes starting at SRC into the buffer.  If there is not
@@ -360,8 +367,8 @@ alloc_buffer_copy_bytes (struct alloc_buffer *buf, const void *src, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_copy_string below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_string (struct alloc_buffer,
-						     const char *)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_string,
+					(struct alloc_buffer, const char *))
   __attribute__ ((nonnull (2)));
 
 /* Copy the string at SRC into the buffer, including its null
@@ -377,12 +384,4 @@ alloc_buffer_copy_string (struct alloc_buffer *buf, const char *src)
   return result;
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_alloc_buffer_alloc_array)
-libc_hidden_proto (__libc_alloc_buffer_allocate)
-libc_hidden_proto (__libc_alloc_buffer_copy_bytes)
-libc_hidden_proto (__libc_alloc_buffer_copy_string)
-libc_hidden_proto (__libc_alloc_buffer_create_failure)
-#endif
-
 #endif /* _ALLOC_BUFFER_H */
diff --git a/include/allocate_once.h b/include/allocate_once.h
index a487d641d5..3d267fafe4 100644
--- a/include/allocate_once.h
+++ b/include/allocate_once.h
@@ -21,12 +21,15 @@
 
 #include <atomic.h>
 
+#ifdef _ISOMAC
+# define hidden_proto3(name, proto) name proto
+#endif
+
 /* Slow path for allocate_once; see below.  */
-void *__libc_allocate_once_slow (void **__place,
-                                 void *(*__allocate) (void *__closure),
-                                 void (*__deallocate) (void *__closure,
-                                                       void *__ptr),
-                                 void *__closure);
+void * hidden_proto3 (__libc_allocate_once_slow,
+		      (void **__place, void *(*__allocate) (void *__closure),
+		       void (*__deallocate) (void *__closure, void *__ptr),
+		       void *__closure));
 
 /* Return an a pointer to an allocated and initialized data structure.
    If this function returns a non-NULL value, the caller can assume
@@ -88,8 +91,4 @@ allocate_once (void **__place, void *(*__allocate) (void *__closure),
                                       __closure);
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_allocate_once_slow)
-#endif
-
 #endif /* _ALLOCATE_ONCE_H */
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 0715d87c7d..033a433778 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -522,6 +522,10 @@ for linking")
   __hidden_proto_alias (name, , alias, ##attrs)
 #  define hidden_proto2(type, name, attrs...) \
   __hidden_proto2 (type, name, , __GI_##name, ##attrs)
+#  define __hidden_proto3(internal) \
+  __asm__(__hidden_asmname (#internal))
+#  define hidden_proto3(name, proto, attrs...) \
+  name proto __hidden_proto3 (__GI_##name) __hidden_proto_hiddenattr (##attrs)
 #  define hidden_tls_proto(name, attrs...) \
   __hidden_proto (name, __thread, __GI_##name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
@@ -602,8 +606,11 @@ for linking")
   extern thread __typeof (name) name __hidden_proto_hiddenattr (attrs);
 #  define __hidden_proto_alias(name, thread, internal, attrs...)     \
   extern thread __typeof (name) internal __hidden_proto_hiddenattr (attrs);
+# define hidden_proto3(name, proto, attrs...) \
+  name proto __hidden_proto_hiddenattr (##attrs)
 # else
 #   define hidden_proto(name, attrs...)
+#   define hidden_proto3(name, proto, attrs...) name proto
 #   define hidden_proto_alias(name, alias, attrs...)
 #   define hidden_tls_proto(name, attrs...)
 # endif
@@ -629,6 +636,7 @@ for linking")
 # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
 # define libc_hidden_proto_alias(name, alias, attrs...) \
    hidden_proto_alias (name, alias, ##attrs)
+# define libc_hidden_proto3(name, proto, attrs...) hidden_proto3 (name, proto, ##attrs)
 # define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
 # define libc_hidden_def(name) hidden_def (name)
 # define libc_hidden_weak(name) hidden_weak (name)
@@ -640,6 +648,7 @@ for linking")
 # define libc_hidden_data_weak(name) hidden_data_weak (name)
 #else
 # define libc_hidden_proto(name, attrs...)
+# define libc_hidden_proto3(name, proto, attrs...) name proto
 # define libc_hidden_proto_alias(name, alias, attrs...)
 # define libc_hidden_tls_proto(name, attrs...)
 # define libc_hidden_def(name)

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

* [glibc/azanella/clang] Refactor internal alias for internal function
@ 2022-06-09 21:20 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-06-09 21:20 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8495c4a071737aadb20423af592cf4a46d87084c

commit 8495c4a071737aadb20423af592cf4a46d87084c
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 11 15:37:57 2022 -0300

    Refactor internal alias for internal function
    
    Instead of defining the internal alias with hidden_proto macros, adds
    a new hidden_proto3 which defines the macro on function prototype
    (so there is only one function prototype).

Diff:
---
 include/alloc_buffer.h  | 33 ++++++++++++++++-----------------
 include/allocate_once.h | 17 ++++++++---------
 include/libc-symbols.h  | 10 ++++++++++
 3 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/include/alloc_buffer.h b/include/alloc_buffer.h
index be33e8b68c..5660642d73 100644
--- a/include/alloc_buffer.h
+++ b/include/alloc_buffer.h
@@ -83,6 +83,10 @@
 #include <stdlib.h>
 #include <sys/param.h>
 
+#ifdef _ISOMAC
+# define libc_hidden_proto3(name, proto) name proto
+#endif
+
 /* struct alloc_buffer objects refer to a region of bytes in memory of a
    fixed size.  The functions below can be used to allocate single
    objects and arrays from this memory region, or write to its end.
@@ -113,7 +117,8 @@ enum
   };
 
 /* Internal function.  Terminate the process using __libc_fatal.  */
-void __libc_alloc_buffer_create_failure (void *start, size_t size);
+void libc_hidden_proto3 (__libc_alloc_buffer_create_failure,
+			 (void *start, size_t size));
 
 /* Create a new allocation buffer.  The byte range from START to START
    + SIZE - 1 must be valid, and the allocation buffer allocates
@@ -130,7 +135,8 @@ alloc_buffer_create (void *start, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_allocate below.  */
-struct alloc_buffer __libc_alloc_buffer_allocate (size_t size, void **pptr)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_allocate,
+					(size_t size, void **pptr))
   __attribute__ ((nonnull (2)));
 
 /* Allocate a buffer of SIZE bytes using malloc.  The returned buffer
@@ -329,9 +335,9 @@ __alloc_buffer_next (struct alloc_buffer *buf, size_t align)
    (buf, __alloc_buffer_assert_align (__alignof__ (type))))
 
 /* Internal function.  Allocate an array.  */
-void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
-					size_t size, size_t align,
-					size_t count)
+void * libc_hidden_proto3 (__libc_alloc_buffer_alloc_array,
+			   (struct alloc_buffer *buf, size_t size, size_t align,
+			    size_t count))
   __attribute__ ((nonnull (1)));
 
 /* Obtain a TYPE * pointer to an array of COUNT objects in BUF of
@@ -346,8 +352,9 @@ void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
     count))
 
 /* Internal function.  See alloc_buffer_copy_bytes below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_bytes (struct alloc_buffer,
-						    const void *, size_t)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_bytes,
+					(struct alloc_buffer, const void *,
+					 size_t))
   __attribute__ ((nonnull (2)));
 
 /* Copy SIZE bytes starting at SRC into the buffer.  If there is not
@@ -360,8 +367,8 @@ alloc_buffer_copy_bytes (struct alloc_buffer *buf, const void *src, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_copy_string below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_string (struct alloc_buffer,
-						     const char *)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_string,
+					(struct alloc_buffer, const char *))
   __attribute__ ((nonnull (2)));
 
 /* Copy the string at SRC into the buffer, including its null
@@ -377,12 +384,4 @@ alloc_buffer_copy_string (struct alloc_buffer *buf, const char *src)
   return result;
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_alloc_buffer_alloc_array)
-libc_hidden_proto (__libc_alloc_buffer_allocate)
-libc_hidden_proto (__libc_alloc_buffer_copy_bytes)
-libc_hidden_proto (__libc_alloc_buffer_copy_string)
-libc_hidden_proto (__libc_alloc_buffer_create_failure)
-#endif
-
 #endif /* _ALLOC_BUFFER_H */
diff --git a/include/allocate_once.h b/include/allocate_once.h
index a487d641d5..3d267fafe4 100644
--- a/include/allocate_once.h
+++ b/include/allocate_once.h
@@ -21,12 +21,15 @@
 
 #include <atomic.h>
 
+#ifdef _ISOMAC
+# define hidden_proto3(name, proto) name proto
+#endif
+
 /* Slow path for allocate_once; see below.  */
-void *__libc_allocate_once_slow (void **__place,
-                                 void *(*__allocate) (void *__closure),
-                                 void (*__deallocate) (void *__closure,
-                                                       void *__ptr),
-                                 void *__closure);
+void * hidden_proto3 (__libc_allocate_once_slow,
+		      (void **__place, void *(*__allocate) (void *__closure),
+		       void (*__deallocate) (void *__closure, void *__ptr),
+		       void *__closure));
 
 /* Return an a pointer to an allocated and initialized data structure.
    If this function returns a non-NULL value, the caller can assume
@@ -88,8 +91,4 @@ allocate_once (void **__place, void *(*__allocate) (void *__closure),
                                       __closure);
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_allocate_once_slow)
-#endif
-
 #endif /* _ALLOCATE_ONCE_H */
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 245e7c2c0b..416a32e888 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -541,6 +541,11 @@ for linking")
   __hidden_proto (name, , __GI_##name, ##attrs)
 #  define hidden_proto2(type, name, attrs...) \
   __hidden_proto2 (type, name, , __GI_##name, ##attrs)
+#  define __hidden_proto_alias(internal) \
+    __asm__(__hidden_asmname (#internal))
+#  define hidden_proto3(name, proto, attrs...) \
+  name proto __hidden_proto_alias (__GI_##name) \
+   __hidden_proto_hiddenattr (##attrs)
 #  define hidden_tls_proto(name, attrs...) \
   __hidden_proto (name, __thread, __GI_##name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
@@ -612,8 +617,11 @@ for linking")
   __hidden_proto (name, __thread, name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
   extern thread __typeof (name) name __hidden_proto_hiddenattr (attrs);
+#  define hidden_proto3(name, proto, attrs...) \
+     name proto __hidden_proto_hiddenattr (##attrs)
 # else
 #   define hidden_proto(name, attrs...)
+#   define hidden_proto3(name, proto, attrs...) name proto
 #   define hidden_tls_proto(name, attrs...)
 # endif
 # define __hidden_proto2(type, name, thread, attrs...)     \
@@ -635,6 +643,7 @@ for linking")
 
 #if IS_IN (libc)
 # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
+# define libc_hidden_proto3(name, proto, attrs...) hidden_proto3 (name, proto, ##attrs)
 # define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
 # define libc_hidden_def(name) hidden_def (name)
 # define libc_hidden_weak(name) hidden_weak (name)
@@ -646,6 +655,7 @@ for linking")
 # define libc_hidden_data_ver(local, name) hidden_data_ver (local, name)
 #else
 # define libc_hidden_proto(name, attrs...)
+# define libc_hidden_proto3(name, proto, attrs...) name proto
 # define libc_hidden_tls_proto(name, attrs...)
 # define libc_hidden_def(name)
 # define libc_hidden_weak(name)


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

* [glibc/azanella/clang] Refactor internal alias for internal function
@ 2022-06-09 13:16 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-06-09 13:16 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8495c4a071737aadb20423af592cf4a46d87084c

commit 8495c4a071737aadb20423af592cf4a46d87084c
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 11 15:37:57 2022 -0300

    Refactor internal alias for internal function
    
    Instead of defining the internal alias with hidden_proto macros, adds
    a new hidden_proto3 which defines the macro on function prototype
    (so there is only one function prototype).

Diff:
---
 include/alloc_buffer.h  | 33 ++++++++++++++++-----------------
 include/allocate_once.h | 17 ++++++++---------
 include/libc-symbols.h  | 10 ++++++++++
 3 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/include/alloc_buffer.h b/include/alloc_buffer.h
index be33e8b68c..5660642d73 100644
--- a/include/alloc_buffer.h
+++ b/include/alloc_buffer.h
@@ -83,6 +83,10 @@
 #include <stdlib.h>
 #include <sys/param.h>
 
+#ifdef _ISOMAC
+# define libc_hidden_proto3(name, proto) name proto
+#endif
+
 /* struct alloc_buffer objects refer to a region of bytes in memory of a
    fixed size.  The functions below can be used to allocate single
    objects and arrays from this memory region, or write to its end.
@@ -113,7 +117,8 @@ enum
   };
 
 /* Internal function.  Terminate the process using __libc_fatal.  */
-void __libc_alloc_buffer_create_failure (void *start, size_t size);
+void libc_hidden_proto3 (__libc_alloc_buffer_create_failure,
+			 (void *start, size_t size));
 
 /* Create a new allocation buffer.  The byte range from START to START
    + SIZE - 1 must be valid, and the allocation buffer allocates
@@ -130,7 +135,8 @@ alloc_buffer_create (void *start, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_allocate below.  */
-struct alloc_buffer __libc_alloc_buffer_allocate (size_t size, void **pptr)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_allocate,
+					(size_t size, void **pptr))
   __attribute__ ((nonnull (2)));
 
 /* Allocate a buffer of SIZE bytes using malloc.  The returned buffer
@@ -329,9 +335,9 @@ __alloc_buffer_next (struct alloc_buffer *buf, size_t align)
    (buf, __alloc_buffer_assert_align (__alignof__ (type))))
 
 /* Internal function.  Allocate an array.  */
-void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
-					size_t size, size_t align,
-					size_t count)
+void * libc_hidden_proto3 (__libc_alloc_buffer_alloc_array,
+			   (struct alloc_buffer *buf, size_t size, size_t align,
+			    size_t count))
   __attribute__ ((nonnull (1)));
 
 /* Obtain a TYPE * pointer to an array of COUNT objects in BUF of
@@ -346,8 +352,9 @@ void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
     count))
 
 /* Internal function.  See alloc_buffer_copy_bytes below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_bytes (struct alloc_buffer,
-						    const void *, size_t)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_bytes,
+					(struct alloc_buffer, const void *,
+					 size_t))
   __attribute__ ((nonnull (2)));
 
 /* Copy SIZE bytes starting at SRC into the buffer.  If there is not
@@ -360,8 +367,8 @@ alloc_buffer_copy_bytes (struct alloc_buffer *buf, const void *src, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_copy_string below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_string (struct alloc_buffer,
-						     const char *)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_string,
+					(struct alloc_buffer, const char *))
   __attribute__ ((nonnull (2)));
 
 /* Copy the string at SRC into the buffer, including its null
@@ -377,12 +384,4 @@ alloc_buffer_copy_string (struct alloc_buffer *buf, const char *src)
   return result;
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_alloc_buffer_alloc_array)
-libc_hidden_proto (__libc_alloc_buffer_allocate)
-libc_hidden_proto (__libc_alloc_buffer_copy_bytes)
-libc_hidden_proto (__libc_alloc_buffer_copy_string)
-libc_hidden_proto (__libc_alloc_buffer_create_failure)
-#endif
-
 #endif /* _ALLOC_BUFFER_H */
diff --git a/include/allocate_once.h b/include/allocate_once.h
index a487d641d5..3d267fafe4 100644
--- a/include/allocate_once.h
+++ b/include/allocate_once.h
@@ -21,12 +21,15 @@
 
 #include <atomic.h>
 
+#ifdef _ISOMAC
+# define hidden_proto3(name, proto) name proto
+#endif
+
 /* Slow path for allocate_once; see below.  */
-void *__libc_allocate_once_slow (void **__place,
-                                 void *(*__allocate) (void *__closure),
-                                 void (*__deallocate) (void *__closure,
-                                                       void *__ptr),
-                                 void *__closure);
+void * hidden_proto3 (__libc_allocate_once_slow,
+		      (void **__place, void *(*__allocate) (void *__closure),
+		       void (*__deallocate) (void *__closure, void *__ptr),
+		       void *__closure));
 
 /* Return an a pointer to an allocated and initialized data structure.
    If this function returns a non-NULL value, the caller can assume
@@ -88,8 +91,4 @@ allocate_once (void **__place, void *(*__allocate) (void *__closure),
                                       __closure);
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_allocate_once_slow)
-#endif
-
 #endif /* _ALLOCATE_ONCE_H */
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 245e7c2c0b..416a32e888 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -541,6 +541,11 @@ for linking")
   __hidden_proto (name, , __GI_##name, ##attrs)
 #  define hidden_proto2(type, name, attrs...) \
   __hidden_proto2 (type, name, , __GI_##name, ##attrs)
+#  define __hidden_proto_alias(internal) \
+    __asm__(__hidden_asmname (#internal))
+#  define hidden_proto3(name, proto, attrs...) \
+  name proto __hidden_proto_alias (__GI_##name) \
+   __hidden_proto_hiddenattr (##attrs)
 #  define hidden_tls_proto(name, attrs...) \
   __hidden_proto (name, __thread, __GI_##name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
@@ -612,8 +617,11 @@ for linking")
   __hidden_proto (name, __thread, name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
   extern thread __typeof (name) name __hidden_proto_hiddenattr (attrs);
+#  define hidden_proto3(name, proto, attrs...) \
+     name proto __hidden_proto_hiddenattr (##attrs)
 # else
 #   define hidden_proto(name, attrs...)
+#   define hidden_proto3(name, proto, attrs...) name proto
 #   define hidden_tls_proto(name, attrs...)
 # endif
 # define __hidden_proto2(type, name, thread, attrs...)     \
@@ -635,6 +643,7 @@ for linking")
 
 #if IS_IN (libc)
 # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
+# define libc_hidden_proto3(name, proto, attrs...) hidden_proto3 (name, proto, ##attrs)
 # define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
 # define libc_hidden_def(name) hidden_def (name)
 # define libc_hidden_weak(name) hidden_weak (name)
@@ -646,6 +655,7 @@ for linking")
 # define libc_hidden_data_ver(local, name) hidden_data_ver (local, name)
 #else
 # define libc_hidden_proto(name, attrs...)
+# define libc_hidden_proto3(name, proto, attrs...) name proto
 # define libc_hidden_tls_proto(name, attrs...)
 # define libc_hidden_def(name)
 # define libc_hidden_weak(name)


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

* [glibc/azanella/clang] Refactor internal alias for internal function
@ 2022-06-03 14:05 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-06-03 14:05 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2239d5988f9221ad243280d61232f822c94f4d45

commit 2239d5988f9221ad243280d61232f822c94f4d45
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 11 15:37:57 2022 -0300

    Refactor internal alias for internal function
    
    Instead of defining the internal alias with hidden_proto macros, adds
    a new hidden_proto3 which defines the macro on function prototype
    (so there is only one function prototype).

Diff:
---
 include/alloc_buffer.h  | 33 ++++++++++++++++-----------------
 include/allocate_once.h | 17 ++++++++---------
 include/libc-symbols.h  | 10 ++++++++++
 3 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/include/alloc_buffer.h b/include/alloc_buffer.h
index be33e8b68c..5660642d73 100644
--- a/include/alloc_buffer.h
+++ b/include/alloc_buffer.h
@@ -83,6 +83,10 @@
 #include <stdlib.h>
 #include <sys/param.h>
 
+#ifdef _ISOMAC
+# define libc_hidden_proto3(name, proto) name proto
+#endif
+
 /* struct alloc_buffer objects refer to a region of bytes in memory of a
    fixed size.  The functions below can be used to allocate single
    objects and arrays from this memory region, or write to its end.
@@ -113,7 +117,8 @@ enum
   };
 
 /* Internal function.  Terminate the process using __libc_fatal.  */
-void __libc_alloc_buffer_create_failure (void *start, size_t size);
+void libc_hidden_proto3 (__libc_alloc_buffer_create_failure,
+			 (void *start, size_t size));
 
 /* Create a new allocation buffer.  The byte range from START to START
    + SIZE - 1 must be valid, and the allocation buffer allocates
@@ -130,7 +135,8 @@ alloc_buffer_create (void *start, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_allocate below.  */
-struct alloc_buffer __libc_alloc_buffer_allocate (size_t size, void **pptr)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_allocate,
+					(size_t size, void **pptr))
   __attribute__ ((nonnull (2)));
 
 /* Allocate a buffer of SIZE bytes using malloc.  The returned buffer
@@ -329,9 +335,9 @@ __alloc_buffer_next (struct alloc_buffer *buf, size_t align)
    (buf, __alloc_buffer_assert_align (__alignof__ (type))))
 
 /* Internal function.  Allocate an array.  */
-void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
-					size_t size, size_t align,
-					size_t count)
+void * libc_hidden_proto3 (__libc_alloc_buffer_alloc_array,
+			   (struct alloc_buffer *buf, size_t size, size_t align,
+			    size_t count))
   __attribute__ ((nonnull (1)));
 
 /* Obtain a TYPE * pointer to an array of COUNT objects in BUF of
@@ -346,8 +352,9 @@ void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
     count))
 
 /* Internal function.  See alloc_buffer_copy_bytes below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_bytes (struct alloc_buffer,
-						    const void *, size_t)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_bytes,
+					(struct alloc_buffer, const void *,
+					 size_t))
   __attribute__ ((nonnull (2)));
 
 /* Copy SIZE bytes starting at SRC into the buffer.  If there is not
@@ -360,8 +367,8 @@ alloc_buffer_copy_bytes (struct alloc_buffer *buf, const void *src, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_copy_string below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_string (struct alloc_buffer,
-						     const char *)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_string,
+					(struct alloc_buffer, const char *))
   __attribute__ ((nonnull (2)));
 
 /* Copy the string at SRC into the buffer, including its null
@@ -377,12 +384,4 @@ alloc_buffer_copy_string (struct alloc_buffer *buf, const char *src)
   return result;
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_alloc_buffer_alloc_array)
-libc_hidden_proto (__libc_alloc_buffer_allocate)
-libc_hidden_proto (__libc_alloc_buffer_copy_bytes)
-libc_hidden_proto (__libc_alloc_buffer_copy_string)
-libc_hidden_proto (__libc_alloc_buffer_create_failure)
-#endif
-
 #endif /* _ALLOC_BUFFER_H */
diff --git a/include/allocate_once.h b/include/allocate_once.h
index a487d641d5..3d267fafe4 100644
--- a/include/allocate_once.h
+++ b/include/allocate_once.h
@@ -21,12 +21,15 @@
 
 #include <atomic.h>
 
+#ifdef _ISOMAC
+# define hidden_proto3(name, proto) name proto
+#endif
+
 /* Slow path for allocate_once; see below.  */
-void *__libc_allocate_once_slow (void **__place,
-                                 void *(*__allocate) (void *__closure),
-                                 void (*__deallocate) (void *__closure,
-                                                       void *__ptr),
-                                 void *__closure);
+void * hidden_proto3 (__libc_allocate_once_slow,
+		      (void **__place, void *(*__allocate) (void *__closure),
+		       void (*__deallocate) (void *__closure, void *__ptr),
+		       void *__closure));
 
 /* Return an a pointer to an allocated and initialized data structure.
    If this function returns a non-NULL value, the caller can assume
@@ -88,8 +91,4 @@ allocate_once (void **__place, void *(*__allocate) (void *__closure),
                                       __closure);
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_allocate_once_slow)
-#endif
-
 #endif /* _ALLOCATE_ONCE_H */
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 245e7c2c0b..416a32e888 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -541,6 +541,11 @@ for linking")
   __hidden_proto (name, , __GI_##name, ##attrs)
 #  define hidden_proto2(type, name, attrs...) \
   __hidden_proto2 (type, name, , __GI_##name, ##attrs)
+#  define __hidden_proto_alias(internal) \
+    __asm__(__hidden_asmname (#internal))
+#  define hidden_proto3(name, proto, attrs...) \
+  name proto __hidden_proto_alias (__GI_##name) \
+   __hidden_proto_hiddenattr (##attrs)
 #  define hidden_tls_proto(name, attrs...) \
   __hidden_proto (name, __thread, __GI_##name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
@@ -612,8 +617,11 @@ for linking")
   __hidden_proto (name, __thread, name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
   extern thread __typeof (name) name __hidden_proto_hiddenattr (attrs);
+#  define hidden_proto3(name, proto, attrs...) \
+     name proto __hidden_proto_hiddenattr (##attrs)
 # else
 #   define hidden_proto(name, attrs...)
+#   define hidden_proto3(name, proto, attrs...) name proto
 #   define hidden_tls_proto(name, attrs...)
 # endif
 # define __hidden_proto2(type, name, thread, attrs...)     \
@@ -635,6 +643,7 @@ for linking")
 
 #if IS_IN (libc)
 # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
+# define libc_hidden_proto3(name, proto, attrs...) hidden_proto3 (name, proto, ##attrs)
 # define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
 # define libc_hidden_def(name) hidden_def (name)
 # define libc_hidden_weak(name) hidden_weak (name)
@@ -646,6 +655,7 @@ for linking")
 # define libc_hidden_data_ver(local, name) hidden_data_ver (local, name)
 #else
 # define libc_hidden_proto(name, attrs...)
+# define libc_hidden_proto3(name, proto, attrs...) name proto
 # define libc_hidden_tls_proto(name, attrs...)
 # define libc_hidden_def(name)
 # define libc_hidden_weak(name)


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

* [glibc/azanella/clang] Refactor internal alias for internal function
@ 2022-05-13 14:19 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-05-13 14:19 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=51d4f631b81d917bc257de67736374acea306eaf

commit 51d4f631b81d917bc257de67736374acea306eaf
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 11 15:37:57 2022 -0300

    Refactor internal alias for internal function
    
    Instead of defining the internal alias with hidden_proto macros, adds
    a new hidden_proto3 which defines the macro on function prototype
    (so there is only one function prototype).

Diff:
---
 include/alloc_buffer.h  | 33 ++++++++++++++++-----------------
 include/allocate_once.h | 17 ++++++++---------
 include/libc-symbols.h  | 10 ++++++++++
 3 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/include/alloc_buffer.h b/include/alloc_buffer.h
index be33e8b68c..5660642d73 100644
--- a/include/alloc_buffer.h
+++ b/include/alloc_buffer.h
@@ -83,6 +83,10 @@
 #include <stdlib.h>
 #include <sys/param.h>
 
+#ifdef _ISOMAC
+# define libc_hidden_proto3(name, proto) name proto
+#endif
+
 /* struct alloc_buffer objects refer to a region of bytes in memory of a
    fixed size.  The functions below can be used to allocate single
    objects and arrays from this memory region, or write to its end.
@@ -113,7 +117,8 @@ enum
   };
 
 /* Internal function.  Terminate the process using __libc_fatal.  */
-void __libc_alloc_buffer_create_failure (void *start, size_t size);
+void libc_hidden_proto3 (__libc_alloc_buffer_create_failure,
+			 (void *start, size_t size));
 
 /* Create a new allocation buffer.  The byte range from START to START
    + SIZE - 1 must be valid, and the allocation buffer allocates
@@ -130,7 +135,8 @@ alloc_buffer_create (void *start, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_allocate below.  */
-struct alloc_buffer __libc_alloc_buffer_allocate (size_t size, void **pptr)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_allocate,
+					(size_t size, void **pptr))
   __attribute__ ((nonnull (2)));
 
 /* Allocate a buffer of SIZE bytes using malloc.  The returned buffer
@@ -329,9 +335,9 @@ __alloc_buffer_next (struct alloc_buffer *buf, size_t align)
    (buf, __alloc_buffer_assert_align (__alignof__ (type))))
 
 /* Internal function.  Allocate an array.  */
-void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
-					size_t size, size_t align,
-					size_t count)
+void * libc_hidden_proto3 (__libc_alloc_buffer_alloc_array,
+			   (struct alloc_buffer *buf, size_t size, size_t align,
+			    size_t count))
   __attribute__ ((nonnull (1)));
 
 /* Obtain a TYPE * pointer to an array of COUNT objects in BUF of
@@ -346,8 +352,9 @@ void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
     count))
 
 /* Internal function.  See alloc_buffer_copy_bytes below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_bytes (struct alloc_buffer,
-						    const void *, size_t)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_bytes,
+					(struct alloc_buffer, const void *,
+					 size_t))
   __attribute__ ((nonnull (2)));
 
 /* Copy SIZE bytes starting at SRC into the buffer.  If there is not
@@ -360,8 +367,8 @@ alloc_buffer_copy_bytes (struct alloc_buffer *buf, const void *src, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_copy_string below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_string (struct alloc_buffer,
-						     const char *)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_string,
+					(struct alloc_buffer, const char *))
   __attribute__ ((nonnull (2)));
 
 /* Copy the string at SRC into the buffer, including its null
@@ -377,12 +384,4 @@ alloc_buffer_copy_string (struct alloc_buffer *buf, const char *src)
   return result;
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_alloc_buffer_alloc_array)
-libc_hidden_proto (__libc_alloc_buffer_allocate)
-libc_hidden_proto (__libc_alloc_buffer_copy_bytes)
-libc_hidden_proto (__libc_alloc_buffer_copy_string)
-libc_hidden_proto (__libc_alloc_buffer_create_failure)
-#endif
-
 #endif /* _ALLOC_BUFFER_H */
diff --git a/include/allocate_once.h b/include/allocate_once.h
index a487d641d5..3d267fafe4 100644
--- a/include/allocate_once.h
+++ b/include/allocate_once.h
@@ -21,12 +21,15 @@
 
 #include <atomic.h>
 
+#ifdef _ISOMAC
+# define hidden_proto3(name, proto) name proto
+#endif
+
 /* Slow path for allocate_once; see below.  */
-void *__libc_allocate_once_slow (void **__place,
-                                 void *(*__allocate) (void *__closure),
-                                 void (*__deallocate) (void *__closure,
-                                                       void *__ptr),
-                                 void *__closure);
+void * hidden_proto3 (__libc_allocate_once_slow,
+		      (void **__place, void *(*__allocate) (void *__closure),
+		       void (*__deallocate) (void *__closure, void *__ptr),
+		       void *__closure));
 
 /* Return an a pointer to an allocated and initialized data structure.
    If this function returns a non-NULL value, the caller can assume
@@ -88,8 +91,4 @@ allocate_once (void **__place, void *(*__allocate) (void *__closure),
                                       __closure);
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_allocate_once_slow)
-#endif
-
 #endif /* _ALLOCATE_ONCE_H */
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 245e7c2c0b..416a32e888 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -541,6 +541,11 @@ for linking")
   __hidden_proto (name, , __GI_##name, ##attrs)
 #  define hidden_proto2(type, name, attrs...) \
   __hidden_proto2 (type, name, , __GI_##name, ##attrs)
+#  define __hidden_proto_alias(internal) \
+    __asm__(__hidden_asmname (#internal))
+#  define hidden_proto3(name, proto, attrs...) \
+  name proto __hidden_proto_alias (__GI_##name) \
+   __hidden_proto_hiddenattr (##attrs)
 #  define hidden_tls_proto(name, attrs...) \
   __hidden_proto (name, __thread, __GI_##name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
@@ -612,8 +617,11 @@ for linking")
   __hidden_proto (name, __thread, name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
   extern thread __typeof (name) name __hidden_proto_hiddenattr (attrs);
+#  define hidden_proto3(name, proto, attrs...) \
+     name proto __hidden_proto_hiddenattr (##attrs)
 # else
 #   define hidden_proto(name, attrs...)
+#   define hidden_proto3(name, proto, attrs...) name proto
 #   define hidden_tls_proto(name, attrs...)
 # endif
 # define __hidden_proto2(type, name, thread, attrs...)     \
@@ -635,6 +643,7 @@ for linking")
 
 #if IS_IN (libc)
 # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
+# define libc_hidden_proto3(name, proto, attrs...) hidden_proto3 (name, proto, ##attrs)
 # define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
 # define libc_hidden_def(name) hidden_def (name)
 # define libc_hidden_weak(name) hidden_weak (name)
@@ -646,6 +655,7 @@ for linking")
 # define libc_hidden_data_ver(local, name) hidden_data_ver (local, name)
 #else
 # define libc_hidden_proto(name, attrs...)
+# define libc_hidden_proto3(name, proto, attrs...) name proto
 # define libc_hidden_tls_proto(name, attrs...)
 # define libc_hidden_def(name)
 # define libc_hidden_weak(name)


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

* [glibc/azanella/clang] Refactor internal alias for internal function
@ 2022-05-12 19:33 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-05-12 19:33 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ccf36b62831018f2bd35ad35ebbef4a7f8a54dd8

commit ccf36b62831018f2bd35ad35ebbef4a7f8a54dd8
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 11 15:37:57 2022 -0300

    Refactor internal alias for internal function
    
    Instead of defining the internal alias with hidden_proto macros, adds
    a new hidden_proto3 which defines the macro on function prototype
    (so there is only one function prototype).

Diff:
---
 include/alloc_buffer.h  | 33 ++++++++++++++++-----------------
 include/allocate_once.h | 17 ++++++++---------
 include/libc-symbols.h  | 10 ++++++++++
 3 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/include/alloc_buffer.h b/include/alloc_buffer.h
index be33e8b68c..5660642d73 100644
--- a/include/alloc_buffer.h
+++ b/include/alloc_buffer.h
@@ -83,6 +83,10 @@
 #include <stdlib.h>
 #include <sys/param.h>
 
+#ifdef _ISOMAC
+# define libc_hidden_proto3(name, proto) name proto
+#endif
+
 /* struct alloc_buffer objects refer to a region of bytes in memory of a
    fixed size.  The functions below can be used to allocate single
    objects and arrays from this memory region, or write to its end.
@@ -113,7 +117,8 @@ enum
   };
 
 /* Internal function.  Terminate the process using __libc_fatal.  */
-void __libc_alloc_buffer_create_failure (void *start, size_t size);
+void libc_hidden_proto3 (__libc_alloc_buffer_create_failure,
+			 (void *start, size_t size));
 
 /* Create a new allocation buffer.  The byte range from START to START
    + SIZE - 1 must be valid, and the allocation buffer allocates
@@ -130,7 +135,8 @@ alloc_buffer_create (void *start, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_allocate below.  */
-struct alloc_buffer __libc_alloc_buffer_allocate (size_t size, void **pptr)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_allocate,
+					(size_t size, void **pptr))
   __attribute__ ((nonnull (2)));
 
 /* Allocate a buffer of SIZE bytes using malloc.  The returned buffer
@@ -329,9 +335,9 @@ __alloc_buffer_next (struct alloc_buffer *buf, size_t align)
    (buf, __alloc_buffer_assert_align (__alignof__ (type))))
 
 /* Internal function.  Allocate an array.  */
-void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
-					size_t size, size_t align,
-					size_t count)
+void * libc_hidden_proto3 (__libc_alloc_buffer_alloc_array,
+			   (struct alloc_buffer *buf, size_t size, size_t align,
+			    size_t count))
   __attribute__ ((nonnull (1)));
 
 /* Obtain a TYPE * pointer to an array of COUNT objects in BUF of
@@ -346,8 +352,9 @@ void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
     count))
 
 /* Internal function.  See alloc_buffer_copy_bytes below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_bytes (struct alloc_buffer,
-						    const void *, size_t)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_bytes,
+					(struct alloc_buffer, const void *,
+					 size_t))
   __attribute__ ((nonnull (2)));
 
 /* Copy SIZE bytes starting at SRC into the buffer.  If there is not
@@ -360,8 +367,8 @@ alloc_buffer_copy_bytes (struct alloc_buffer *buf, const void *src, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_copy_string below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_string (struct alloc_buffer,
-						     const char *)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_string,
+					(struct alloc_buffer, const char *))
   __attribute__ ((nonnull (2)));
 
 /* Copy the string at SRC into the buffer, including its null
@@ -377,12 +384,4 @@ alloc_buffer_copy_string (struct alloc_buffer *buf, const char *src)
   return result;
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_alloc_buffer_alloc_array)
-libc_hidden_proto (__libc_alloc_buffer_allocate)
-libc_hidden_proto (__libc_alloc_buffer_copy_bytes)
-libc_hidden_proto (__libc_alloc_buffer_copy_string)
-libc_hidden_proto (__libc_alloc_buffer_create_failure)
-#endif
-
 #endif /* _ALLOC_BUFFER_H */
diff --git a/include/allocate_once.h b/include/allocate_once.h
index a487d641d5..3d267fafe4 100644
--- a/include/allocate_once.h
+++ b/include/allocate_once.h
@@ -21,12 +21,15 @@
 
 #include <atomic.h>
 
+#ifdef _ISOMAC
+# define hidden_proto3(name, proto) name proto
+#endif
+
 /* Slow path for allocate_once; see below.  */
-void *__libc_allocate_once_slow (void **__place,
-                                 void *(*__allocate) (void *__closure),
-                                 void (*__deallocate) (void *__closure,
-                                                       void *__ptr),
-                                 void *__closure);
+void * hidden_proto3 (__libc_allocate_once_slow,
+		      (void **__place, void *(*__allocate) (void *__closure),
+		       void (*__deallocate) (void *__closure, void *__ptr),
+		       void *__closure));
 
 /* Return an a pointer to an allocated and initialized data structure.
    If this function returns a non-NULL value, the caller can assume
@@ -88,8 +91,4 @@ allocate_once (void **__place, void *(*__allocate) (void *__closure),
                                       __closure);
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_allocate_once_slow)
-#endif
-
 #endif /* _ALLOCATE_ONCE_H */
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 245e7c2c0b..416a32e888 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -541,6 +541,11 @@ for linking")
   __hidden_proto (name, , __GI_##name, ##attrs)
 #  define hidden_proto2(type, name, attrs...) \
   __hidden_proto2 (type, name, , __GI_##name, ##attrs)
+#  define __hidden_proto_alias(internal) \
+    __asm__(__hidden_asmname (#internal))
+#  define hidden_proto3(name, proto, attrs...) \
+  name proto __hidden_proto_alias (__GI_##name) \
+   __hidden_proto_hiddenattr (##attrs)
 #  define hidden_tls_proto(name, attrs...) \
   __hidden_proto (name, __thread, __GI_##name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
@@ -612,8 +617,11 @@ for linking")
   __hidden_proto (name, __thread, name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
   extern thread __typeof (name) name __hidden_proto_hiddenattr (attrs);
+#  define hidden_proto3(name, proto, attrs...) \
+     name proto __hidden_proto_hiddenattr (##attrs)
 # else
 #   define hidden_proto(name, attrs...)
+#   define hidden_proto3(name, proto, attrs...) name proto
 #   define hidden_tls_proto(name, attrs...)
 # endif
 # define __hidden_proto2(type, name, thread, attrs...)     \
@@ -635,6 +643,7 @@ for linking")
 
 #if IS_IN (libc)
 # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
+# define libc_hidden_proto3(name, proto, attrs...) hidden_proto3 (name, proto, ##attrs)
 # define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
 # define libc_hidden_def(name) hidden_def (name)
 # define libc_hidden_weak(name) hidden_weak (name)
@@ -646,6 +655,7 @@ for linking")
 # define libc_hidden_data_ver(local, name) hidden_data_ver (local, name)
 #else
 # define libc_hidden_proto(name, attrs...)
+# define libc_hidden_proto3(name, proto, attrs...) name proto
 # define libc_hidden_tls_proto(name, attrs...)
 # define libc_hidden_def(name)
 # define libc_hidden_weak(name)


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

* [glibc/azanella/clang] Refactor internal alias for internal function
@ 2022-05-10 18:23 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-05-10 18:23 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=820453baf5706f0a73ed74953e046ad1ea551b4a

commit 820453baf5706f0a73ed74953e046ad1ea551b4a
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 11 15:37:57 2022 -0300

    Refactor internal alias for internal function
    
    Instead of defining the internal alias with hidden_proto macros, adds
    a new hidden_proto3 which defines the macro on function prototype
    (so there is only one function prototype).

Diff:
---
 include/alloc_buffer.h  | 33 ++++++++++++++++-----------------
 include/allocate_once.h | 17 ++++++++---------
 include/libc-symbols.h  | 10 ++++++++++
 3 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/include/alloc_buffer.h b/include/alloc_buffer.h
index be33e8b68c..5660642d73 100644
--- a/include/alloc_buffer.h
+++ b/include/alloc_buffer.h
@@ -83,6 +83,10 @@
 #include <stdlib.h>
 #include <sys/param.h>
 
+#ifdef _ISOMAC
+# define libc_hidden_proto3(name, proto) name proto
+#endif
+
 /* struct alloc_buffer objects refer to a region of bytes in memory of a
    fixed size.  The functions below can be used to allocate single
    objects and arrays from this memory region, or write to its end.
@@ -113,7 +117,8 @@ enum
   };
 
 /* Internal function.  Terminate the process using __libc_fatal.  */
-void __libc_alloc_buffer_create_failure (void *start, size_t size);
+void libc_hidden_proto3 (__libc_alloc_buffer_create_failure,
+			 (void *start, size_t size));
 
 /* Create a new allocation buffer.  The byte range from START to START
    + SIZE - 1 must be valid, and the allocation buffer allocates
@@ -130,7 +135,8 @@ alloc_buffer_create (void *start, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_allocate below.  */
-struct alloc_buffer __libc_alloc_buffer_allocate (size_t size, void **pptr)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_allocate,
+					(size_t size, void **pptr))
   __attribute__ ((nonnull (2)));
 
 /* Allocate a buffer of SIZE bytes using malloc.  The returned buffer
@@ -329,9 +335,9 @@ __alloc_buffer_next (struct alloc_buffer *buf, size_t align)
    (buf, __alloc_buffer_assert_align (__alignof__ (type))))
 
 /* Internal function.  Allocate an array.  */
-void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
-					size_t size, size_t align,
-					size_t count)
+void * libc_hidden_proto3 (__libc_alloc_buffer_alloc_array,
+			   (struct alloc_buffer *buf, size_t size, size_t align,
+			    size_t count))
   __attribute__ ((nonnull (1)));
 
 /* Obtain a TYPE * pointer to an array of COUNT objects in BUF of
@@ -346,8 +352,9 @@ void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
     count))
 
 /* Internal function.  See alloc_buffer_copy_bytes below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_bytes (struct alloc_buffer,
-						    const void *, size_t)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_bytes,
+					(struct alloc_buffer, const void *,
+					 size_t))
   __attribute__ ((nonnull (2)));
 
 /* Copy SIZE bytes starting at SRC into the buffer.  If there is not
@@ -360,8 +367,8 @@ alloc_buffer_copy_bytes (struct alloc_buffer *buf, const void *src, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_copy_string below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_string (struct alloc_buffer,
-						     const char *)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_string,
+					(struct alloc_buffer, const char *))
   __attribute__ ((nonnull (2)));
 
 /* Copy the string at SRC into the buffer, including its null
@@ -377,12 +384,4 @@ alloc_buffer_copy_string (struct alloc_buffer *buf, const char *src)
   return result;
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_alloc_buffer_alloc_array)
-libc_hidden_proto (__libc_alloc_buffer_allocate)
-libc_hidden_proto (__libc_alloc_buffer_copy_bytes)
-libc_hidden_proto (__libc_alloc_buffer_copy_string)
-libc_hidden_proto (__libc_alloc_buffer_create_failure)
-#endif
-
 #endif /* _ALLOC_BUFFER_H */
diff --git a/include/allocate_once.h b/include/allocate_once.h
index a487d641d5..3d267fafe4 100644
--- a/include/allocate_once.h
+++ b/include/allocate_once.h
@@ -21,12 +21,15 @@
 
 #include <atomic.h>
 
+#ifdef _ISOMAC
+# define hidden_proto3(name, proto) name proto
+#endif
+
 /* Slow path for allocate_once; see below.  */
-void *__libc_allocate_once_slow (void **__place,
-                                 void *(*__allocate) (void *__closure),
-                                 void (*__deallocate) (void *__closure,
-                                                       void *__ptr),
-                                 void *__closure);
+void * hidden_proto3 (__libc_allocate_once_slow,
+		      (void **__place, void *(*__allocate) (void *__closure),
+		       void (*__deallocate) (void *__closure, void *__ptr),
+		       void *__closure));
 
 /* Return an a pointer to an allocated and initialized data structure.
    If this function returns a non-NULL value, the caller can assume
@@ -88,8 +91,4 @@ allocate_once (void **__place, void *(*__allocate) (void *__closure),
                                       __closure);
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_allocate_once_slow)
-#endif
-
 #endif /* _ALLOCATE_ONCE_H */
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 245e7c2c0b..416a32e888 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -541,6 +541,11 @@ for linking")
   __hidden_proto (name, , __GI_##name, ##attrs)
 #  define hidden_proto2(type, name, attrs...) \
   __hidden_proto2 (type, name, , __GI_##name, ##attrs)
+#  define __hidden_proto_alias(internal) \
+    __asm__(__hidden_asmname (#internal))
+#  define hidden_proto3(name, proto, attrs...) \
+  name proto __hidden_proto_alias (__GI_##name) \
+   __hidden_proto_hiddenattr (##attrs)
 #  define hidden_tls_proto(name, attrs...) \
   __hidden_proto (name, __thread, __GI_##name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
@@ -612,8 +617,11 @@ for linking")
   __hidden_proto (name, __thread, name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
   extern thread __typeof (name) name __hidden_proto_hiddenattr (attrs);
+#  define hidden_proto3(name, proto, attrs...) \
+     name proto __hidden_proto_hiddenattr (##attrs)
 # else
 #   define hidden_proto(name, attrs...)
+#   define hidden_proto3(name, proto, attrs...) name proto
 #   define hidden_tls_proto(name, attrs...)
 # endif
 # define __hidden_proto2(type, name, thread, attrs...)     \
@@ -635,6 +643,7 @@ for linking")
 
 #if IS_IN (libc)
 # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
+# define libc_hidden_proto3(name, proto, attrs...) hidden_proto3 (name, proto, ##attrs)
 # define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
 # define libc_hidden_def(name) hidden_def (name)
 # define libc_hidden_weak(name) hidden_weak (name)
@@ -646,6 +655,7 @@ for linking")
 # define libc_hidden_data_ver(local, name) hidden_data_ver (local, name)
 #else
 # define libc_hidden_proto(name, attrs...)
+# define libc_hidden_proto3(name, proto, attrs...) name proto
 # define libc_hidden_tls_proto(name, attrs...)
 # define libc_hidden_def(name)
 # define libc_hidden_weak(name)


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

* [glibc/azanella/clang] Refactor internal alias for internal function
@ 2022-04-29 14:03 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-04-29 14:03 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d2bba9b29ca95283033533e5875e3c7147e4d29a

commit d2bba9b29ca95283033533e5875e3c7147e4d29a
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 11 15:37:57 2022 -0300

    Refactor internal alias for internal function
    
    Instead of defining the internal alias with hidden_proto macros, adds
    a new hidden_proto3 which defines the macro on function prototype
    (so there is only one function prototype).

Diff:
---
 include/alloc_buffer.h  | 33 ++++++++++++++++-----------------
 include/allocate_once.h | 17 ++++++++---------
 include/libc-symbols.h  | 10 ++++++++++
 3 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/include/alloc_buffer.h b/include/alloc_buffer.h
index be33e8b68c..5660642d73 100644
--- a/include/alloc_buffer.h
+++ b/include/alloc_buffer.h
@@ -83,6 +83,10 @@
 #include <stdlib.h>
 #include <sys/param.h>
 
+#ifdef _ISOMAC
+# define libc_hidden_proto3(name, proto) name proto
+#endif
+
 /* struct alloc_buffer objects refer to a region of bytes in memory of a
    fixed size.  The functions below can be used to allocate single
    objects and arrays from this memory region, or write to its end.
@@ -113,7 +117,8 @@ enum
   };
 
 /* Internal function.  Terminate the process using __libc_fatal.  */
-void __libc_alloc_buffer_create_failure (void *start, size_t size);
+void libc_hidden_proto3 (__libc_alloc_buffer_create_failure,
+			 (void *start, size_t size));
 
 /* Create a new allocation buffer.  The byte range from START to START
    + SIZE - 1 must be valid, and the allocation buffer allocates
@@ -130,7 +135,8 @@ alloc_buffer_create (void *start, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_allocate below.  */
-struct alloc_buffer __libc_alloc_buffer_allocate (size_t size, void **pptr)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_allocate,
+					(size_t size, void **pptr))
   __attribute__ ((nonnull (2)));
 
 /* Allocate a buffer of SIZE bytes using malloc.  The returned buffer
@@ -329,9 +335,9 @@ __alloc_buffer_next (struct alloc_buffer *buf, size_t align)
    (buf, __alloc_buffer_assert_align (__alignof__ (type))))
 
 /* Internal function.  Allocate an array.  */
-void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
-					size_t size, size_t align,
-					size_t count)
+void * libc_hidden_proto3 (__libc_alloc_buffer_alloc_array,
+			   (struct alloc_buffer *buf, size_t size, size_t align,
+			    size_t count))
   __attribute__ ((nonnull (1)));
 
 /* Obtain a TYPE * pointer to an array of COUNT objects in BUF of
@@ -346,8 +352,9 @@ void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
     count))
 
 /* Internal function.  See alloc_buffer_copy_bytes below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_bytes (struct alloc_buffer,
-						    const void *, size_t)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_bytes,
+					(struct alloc_buffer, const void *,
+					 size_t))
   __attribute__ ((nonnull (2)));
 
 /* Copy SIZE bytes starting at SRC into the buffer.  If there is not
@@ -360,8 +367,8 @@ alloc_buffer_copy_bytes (struct alloc_buffer *buf, const void *src, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_copy_string below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_string (struct alloc_buffer,
-						     const char *)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_string,
+					(struct alloc_buffer, const char *))
   __attribute__ ((nonnull (2)));
 
 /* Copy the string at SRC into the buffer, including its null
@@ -377,12 +384,4 @@ alloc_buffer_copy_string (struct alloc_buffer *buf, const char *src)
   return result;
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_alloc_buffer_alloc_array)
-libc_hidden_proto (__libc_alloc_buffer_allocate)
-libc_hidden_proto (__libc_alloc_buffer_copy_bytes)
-libc_hidden_proto (__libc_alloc_buffer_copy_string)
-libc_hidden_proto (__libc_alloc_buffer_create_failure)
-#endif
-
 #endif /* _ALLOC_BUFFER_H */
diff --git a/include/allocate_once.h b/include/allocate_once.h
index a487d641d5..3d267fafe4 100644
--- a/include/allocate_once.h
+++ b/include/allocate_once.h
@@ -21,12 +21,15 @@
 
 #include <atomic.h>
 
+#ifdef _ISOMAC
+# define hidden_proto3(name, proto) name proto
+#endif
+
 /* Slow path for allocate_once; see below.  */
-void *__libc_allocate_once_slow (void **__place,
-                                 void *(*__allocate) (void *__closure),
-                                 void (*__deallocate) (void *__closure,
-                                                       void *__ptr),
-                                 void *__closure);
+void * hidden_proto3 (__libc_allocate_once_slow,
+		      (void **__place, void *(*__allocate) (void *__closure),
+		       void (*__deallocate) (void *__closure, void *__ptr),
+		       void *__closure));
 
 /* Return an a pointer to an allocated and initialized data structure.
    If this function returns a non-NULL value, the caller can assume
@@ -88,8 +91,4 @@ allocate_once (void **__place, void *(*__allocate) (void *__closure),
                                       __closure);
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_allocate_once_slow)
-#endif
-
 #endif /* _ALLOCATE_ONCE_H */
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 245e7c2c0b..416a32e888 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -541,6 +541,11 @@ for linking")
   __hidden_proto (name, , __GI_##name, ##attrs)
 #  define hidden_proto2(type, name, attrs...) \
   __hidden_proto2 (type, name, , __GI_##name, ##attrs)
+#  define __hidden_proto_alias(internal) \
+    __asm__(__hidden_asmname (#internal))
+#  define hidden_proto3(name, proto, attrs...) \
+  name proto __hidden_proto_alias (__GI_##name) \
+   __hidden_proto_hiddenattr (##attrs)
 #  define hidden_tls_proto(name, attrs...) \
   __hidden_proto (name, __thread, __GI_##name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
@@ -612,8 +617,11 @@ for linking")
   __hidden_proto (name, __thread, name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
   extern thread __typeof (name) name __hidden_proto_hiddenattr (attrs);
+#  define hidden_proto3(name, proto, attrs...) \
+     name proto __hidden_proto_hiddenattr (##attrs)
 # else
 #   define hidden_proto(name, attrs...)
+#   define hidden_proto3(name, proto, attrs...) name proto
 #   define hidden_tls_proto(name, attrs...)
 # endif
 # define __hidden_proto2(type, name, thread, attrs...)     \
@@ -635,6 +643,7 @@ for linking")
 
 #if IS_IN (libc)
 # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
+# define libc_hidden_proto3(name, proto, attrs...) hidden_proto3 (name, proto, ##attrs)
 # define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
 # define libc_hidden_def(name) hidden_def (name)
 # define libc_hidden_weak(name) hidden_weak (name)
@@ -646,6 +655,7 @@ for linking")
 # define libc_hidden_data_ver(local, name) hidden_data_ver (local, name)
 #else
 # define libc_hidden_proto(name, attrs...)
+# define libc_hidden_proto3(name, proto, attrs...) name proto
 # define libc_hidden_tls_proto(name, attrs...)
 # define libc_hidden_def(name)
 # define libc_hidden_weak(name)


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

* [glibc/azanella/clang] Refactor internal alias for internal function
@ 2022-04-04 12:54 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-04-04 12:54 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=45de093045fb414a22fa0d9d2faf5392f624e9f3

commit 45de093045fb414a22fa0d9d2faf5392f624e9f3
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 11 15:37:57 2022 -0300

    Refactor internal alias for internal function
    
    Instead of defining the internal alias with hidden_proto macros, adds
    a new hidden_proto3 which defines the macro on function prototype
    (so there is only one function prototype).

Diff:
---
 include/alloc_buffer.h  | 33 ++++++++++++++++-----------------
 include/allocate_once.h | 17 ++++++++---------
 include/libc-symbols.h  | 10 ++++++++++
 3 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/include/alloc_buffer.h b/include/alloc_buffer.h
index be33e8b68c..5660642d73 100644
--- a/include/alloc_buffer.h
+++ b/include/alloc_buffer.h
@@ -83,6 +83,10 @@
 #include <stdlib.h>
 #include <sys/param.h>
 
+#ifdef _ISOMAC
+# define libc_hidden_proto3(name, proto) name proto
+#endif
+
 /* struct alloc_buffer objects refer to a region of bytes in memory of a
    fixed size.  The functions below can be used to allocate single
    objects and arrays from this memory region, or write to its end.
@@ -113,7 +117,8 @@ enum
   };
 
 /* Internal function.  Terminate the process using __libc_fatal.  */
-void __libc_alloc_buffer_create_failure (void *start, size_t size);
+void libc_hidden_proto3 (__libc_alloc_buffer_create_failure,
+			 (void *start, size_t size));
 
 /* Create a new allocation buffer.  The byte range from START to START
    + SIZE - 1 must be valid, and the allocation buffer allocates
@@ -130,7 +135,8 @@ alloc_buffer_create (void *start, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_allocate below.  */
-struct alloc_buffer __libc_alloc_buffer_allocate (size_t size, void **pptr)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_allocate,
+					(size_t size, void **pptr))
   __attribute__ ((nonnull (2)));
 
 /* Allocate a buffer of SIZE bytes using malloc.  The returned buffer
@@ -329,9 +335,9 @@ __alloc_buffer_next (struct alloc_buffer *buf, size_t align)
    (buf, __alloc_buffer_assert_align (__alignof__ (type))))
 
 /* Internal function.  Allocate an array.  */
-void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
-					size_t size, size_t align,
-					size_t count)
+void * libc_hidden_proto3 (__libc_alloc_buffer_alloc_array,
+			   (struct alloc_buffer *buf, size_t size, size_t align,
+			    size_t count))
   __attribute__ ((nonnull (1)));
 
 /* Obtain a TYPE * pointer to an array of COUNT objects in BUF of
@@ -346,8 +352,9 @@ void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
     count))
 
 /* Internal function.  See alloc_buffer_copy_bytes below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_bytes (struct alloc_buffer,
-						    const void *, size_t)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_bytes,
+					(struct alloc_buffer, const void *,
+					 size_t))
   __attribute__ ((nonnull (2)));
 
 /* Copy SIZE bytes starting at SRC into the buffer.  If there is not
@@ -360,8 +367,8 @@ alloc_buffer_copy_bytes (struct alloc_buffer *buf, const void *src, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_copy_string below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_string (struct alloc_buffer,
-						     const char *)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_string,
+					(struct alloc_buffer, const char *))
   __attribute__ ((nonnull (2)));
 
 /* Copy the string at SRC into the buffer, including its null
@@ -377,12 +384,4 @@ alloc_buffer_copy_string (struct alloc_buffer *buf, const char *src)
   return result;
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_alloc_buffer_alloc_array)
-libc_hidden_proto (__libc_alloc_buffer_allocate)
-libc_hidden_proto (__libc_alloc_buffer_copy_bytes)
-libc_hidden_proto (__libc_alloc_buffer_copy_string)
-libc_hidden_proto (__libc_alloc_buffer_create_failure)
-#endif
-
 #endif /* _ALLOC_BUFFER_H */
diff --git a/include/allocate_once.h b/include/allocate_once.h
index a487d641d5..3d267fafe4 100644
--- a/include/allocate_once.h
+++ b/include/allocate_once.h
@@ -21,12 +21,15 @@
 
 #include <atomic.h>
 
+#ifdef _ISOMAC
+# define hidden_proto3(name, proto) name proto
+#endif
+
 /* Slow path for allocate_once; see below.  */
-void *__libc_allocate_once_slow (void **__place,
-                                 void *(*__allocate) (void *__closure),
-                                 void (*__deallocate) (void *__closure,
-                                                       void *__ptr),
-                                 void *__closure);
+void * hidden_proto3 (__libc_allocate_once_slow,
+		      (void **__place, void *(*__allocate) (void *__closure),
+		       void (*__deallocate) (void *__closure, void *__ptr),
+		       void *__closure));
 
 /* Return an a pointer to an allocated and initialized data structure.
    If this function returns a non-NULL value, the caller can assume
@@ -88,8 +91,4 @@ allocate_once (void **__place, void *(*__allocate) (void *__closure),
                                       __closure);
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_allocate_once_slow)
-#endif
-
 #endif /* _ALLOCATE_ONCE_H */
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 4a55a8f7f9..6dbc4def0c 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -539,6 +539,11 @@ for linking")
   __hidden_proto (name, , __GI_##name, ##attrs)
 #  define hidden_proto2(type, name, attrs...) \
   __hidden_proto2 (type, name, , __GI_##name, ##attrs)
+#  define __hidden_proto_alias(internal) \
+    __asm__(__hidden_asmname (#internal))
+#  define hidden_proto3(name, proto, attrs...) \
+  name proto __hidden_proto_alias (__GI_##name) \
+   __hidden_proto_hiddenattr (##attrs)
 #  define hidden_tls_proto(name, attrs...) \
   __hidden_proto (name, __thread, __GI_##name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
@@ -610,8 +615,11 @@ for linking")
   __hidden_proto (name, __thread, name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
   extern thread __typeof (name) name __hidden_proto_hiddenattr (attrs);
+#  define hidden_proto3(name, proto, attrs...) \
+     name proto __hidden_proto_hiddenattr (##attrs)
 # else
 #   define hidden_proto(name, attrs...)
+#   define hidden_proto3(name, proto, attrs...) name proto
 #   define hidden_tls_proto(name, attrs...)
 # endif
 # define __hidden_proto2(type, name, thread, attrs...)     \
@@ -633,6 +641,7 @@ for linking")
 
 #if IS_IN (libc)
 # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
+# define libc_hidden_proto3(name, proto, attrs...) hidden_proto3 (name, proto, ##attrs)
 # define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
 # define libc_hidden_def(name) hidden_def (name)
 # define libc_hidden_weak(name) hidden_weak (name)
@@ -644,6 +653,7 @@ for linking")
 # define libc_hidden_data_ver(local, name) hidden_data_ver (local, name)
 #else
 # define libc_hidden_proto(name, attrs...)
+# define libc_hidden_proto3(name, proto, attrs...) name proto
 # define libc_hidden_tls_proto(name, attrs...)
 # define libc_hidden_def(name)
 # define libc_hidden_weak(name)


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

* [glibc/azanella/clang] Refactor internal alias for internal function
@ 2022-03-31 19:06 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-03-31 19:06 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=837b1600b57b8ecc8a7c726ac159bc0cf59c0878

commit 837b1600b57b8ecc8a7c726ac159bc0cf59c0878
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 11 15:37:57 2022 -0300

    Refactor internal alias for internal function
    
    Instead of defining the internal alias with hidden_proto macros, adds
    a new hidden_proto3 which defines the macro on function prototype
    (so there is only one function prototype).

Diff:
---
 include/alloc_buffer.h  | 33 ++++++++++++++++-----------------
 include/allocate_once.h | 17 ++++++++---------
 include/libc-symbols.h  | 10 ++++++++++
 3 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/include/alloc_buffer.h b/include/alloc_buffer.h
index be33e8b68c..5660642d73 100644
--- a/include/alloc_buffer.h
+++ b/include/alloc_buffer.h
@@ -83,6 +83,10 @@
 #include <stdlib.h>
 #include <sys/param.h>
 
+#ifdef _ISOMAC
+# define libc_hidden_proto3(name, proto) name proto
+#endif
+
 /* struct alloc_buffer objects refer to a region of bytes in memory of a
    fixed size.  The functions below can be used to allocate single
    objects and arrays from this memory region, or write to its end.
@@ -113,7 +117,8 @@ enum
   };
 
 /* Internal function.  Terminate the process using __libc_fatal.  */
-void __libc_alloc_buffer_create_failure (void *start, size_t size);
+void libc_hidden_proto3 (__libc_alloc_buffer_create_failure,
+			 (void *start, size_t size));
 
 /* Create a new allocation buffer.  The byte range from START to START
    + SIZE - 1 must be valid, and the allocation buffer allocates
@@ -130,7 +135,8 @@ alloc_buffer_create (void *start, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_allocate below.  */
-struct alloc_buffer __libc_alloc_buffer_allocate (size_t size, void **pptr)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_allocate,
+					(size_t size, void **pptr))
   __attribute__ ((nonnull (2)));
 
 /* Allocate a buffer of SIZE bytes using malloc.  The returned buffer
@@ -329,9 +335,9 @@ __alloc_buffer_next (struct alloc_buffer *buf, size_t align)
    (buf, __alloc_buffer_assert_align (__alignof__ (type))))
 
 /* Internal function.  Allocate an array.  */
-void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
-					size_t size, size_t align,
-					size_t count)
+void * libc_hidden_proto3 (__libc_alloc_buffer_alloc_array,
+			   (struct alloc_buffer *buf, size_t size, size_t align,
+			    size_t count))
   __attribute__ ((nonnull (1)));
 
 /* Obtain a TYPE * pointer to an array of COUNT objects in BUF of
@@ -346,8 +352,9 @@ void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
     count))
 
 /* Internal function.  See alloc_buffer_copy_bytes below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_bytes (struct alloc_buffer,
-						    const void *, size_t)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_bytes,
+					(struct alloc_buffer, const void *,
+					 size_t))
   __attribute__ ((nonnull (2)));
 
 /* Copy SIZE bytes starting at SRC into the buffer.  If there is not
@@ -360,8 +367,8 @@ alloc_buffer_copy_bytes (struct alloc_buffer *buf, const void *src, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_copy_string below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_string (struct alloc_buffer,
-						     const char *)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_string,
+					(struct alloc_buffer, const char *))
   __attribute__ ((nonnull (2)));
 
 /* Copy the string at SRC into the buffer, including its null
@@ -377,12 +384,4 @@ alloc_buffer_copy_string (struct alloc_buffer *buf, const char *src)
   return result;
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_alloc_buffer_alloc_array)
-libc_hidden_proto (__libc_alloc_buffer_allocate)
-libc_hidden_proto (__libc_alloc_buffer_copy_bytes)
-libc_hidden_proto (__libc_alloc_buffer_copy_string)
-libc_hidden_proto (__libc_alloc_buffer_create_failure)
-#endif
-
 #endif /* _ALLOC_BUFFER_H */
diff --git a/include/allocate_once.h b/include/allocate_once.h
index a487d641d5..3d267fafe4 100644
--- a/include/allocate_once.h
+++ b/include/allocate_once.h
@@ -21,12 +21,15 @@
 
 #include <atomic.h>
 
+#ifdef _ISOMAC
+# define hidden_proto3(name, proto) name proto
+#endif
+
 /* Slow path for allocate_once; see below.  */
-void *__libc_allocate_once_slow (void **__place,
-                                 void *(*__allocate) (void *__closure),
-                                 void (*__deallocate) (void *__closure,
-                                                       void *__ptr),
-                                 void *__closure);
+void * hidden_proto3 (__libc_allocate_once_slow,
+		      (void **__place, void *(*__allocate) (void *__closure),
+		       void (*__deallocate) (void *__closure, void *__ptr),
+		       void *__closure));
 
 /* Return an a pointer to an allocated and initialized data structure.
    If this function returns a non-NULL value, the caller can assume
@@ -88,8 +91,4 @@ allocate_once (void **__place, void *(*__allocate) (void *__closure),
                                       __closure);
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_allocate_once_slow)
-#endif
-
 #endif /* _ALLOCATE_ONCE_H */
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 4a55a8f7f9..6dbc4def0c 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -539,6 +539,11 @@ for linking")
   __hidden_proto (name, , __GI_##name, ##attrs)
 #  define hidden_proto2(type, name, attrs...) \
   __hidden_proto2 (type, name, , __GI_##name, ##attrs)
+#  define __hidden_proto_alias(internal) \
+    __asm__(__hidden_asmname (#internal))
+#  define hidden_proto3(name, proto, attrs...) \
+  name proto __hidden_proto_alias (__GI_##name) \
+   __hidden_proto_hiddenattr (##attrs)
 #  define hidden_tls_proto(name, attrs...) \
   __hidden_proto (name, __thread, __GI_##name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
@@ -610,8 +615,11 @@ for linking")
   __hidden_proto (name, __thread, name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
   extern thread __typeof (name) name __hidden_proto_hiddenattr (attrs);
+#  define hidden_proto3(name, proto, attrs...) \
+     name proto __hidden_proto_hiddenattr (##attrs)
 # else
 #   define hidden_proto(name, attrs...)
+#   define hidden_proto3(name, proto, attrs...) name proto
 #   define hidden_tls_proto(name, attrs...)
 # endif
 # define __hidden_proto2(type, name, thread, attrs...)     \
@@ -633,6 +641,7 @@ for linking")
 
 #if IS_IN (libc)
 # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
+# define libc_hidden_proto3(name, proto, attrs...) hidden_proto3 (name, proto, ##attrs)
 # define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
 # define libc_hidden_def(name) hidden_def (name)
 # define libc_hidden_weak(name) hidden_weak (name)
@@ -644,6 +653,7 @@ for linking")
 # define libc_hidden_data_ver(local, name) hidden_data_ver (local, name)
 #else
 # define libc_hidden_proto(name, attrs...)
+# define libc_hidden_proto3(name, proto, attrs...) name proto
 # define libc_hidden_tls_proto(name, attrs...)
 # define libc_hidden_def(name)
 # define libc_hidden_weak(name)


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

* [glibc/azanella/clang] Refactor internal alias for internal function
@ 2022-03-29 20:29 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-03-29 20:29 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=af817d48bbebc742146a1dbed01324627a69b817

commit af817d48bbebc742146a1dbed01324627a69b817
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 11 15:37:57 2022 -0300

    Refactor internal alias for internal function
    
    Instead of defining the internal alias with hidden_proto macros, adds
    a new hidden_proto3 which defines the macro on function prototype
    (so there is only one function prototype).

Diff:
---
 include/alloc_buffer.h  | 33 ++++++++++++++++-----------------
 include/allocate_once.h | 17 ++++++++---------
 include/libc-symbols.h  | 10 ++++++++++
 3 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/include/alloc_buffer.h b/include/alloc_buffer.h
index be33e8b68c..5660642d73 100644
--- a/include/alloc_buffer.h
+++ b/include/alloc_buffer.h
@@ -83,6 +83,10 @@
 #include <stdlib.h>
 #include <sys/param.h>
 
+#ifdef _ISOMAC
+# define libc_hidden_proto3(name, proto) name proto
+#endif
+
 /* struct alloc_buffer objects refer to a region of bytes in memory of a
    fixed size.  The functions below can be used to allocate single
    objects and arrays from this memory region, or write to its end.
@@ -113,7 +117,8 @@ enum
   };
 
 /* Internal function.  Terminate the process using __libc_fatal.  */
-void __libc_alloc_buffer_create_failure (void *start, size_t size);
+void libc_hidden_proto3 (__libc_alloc_buffer_create_failure,
+			 (void *start, size_t size));
 
 /* Create a new allocation buffer.  The byte range from START to START
    + SIZE - 1 must be valid, and the allocation buffer allocates
@@ -130,7 +135,8 @@ alloc_buffer_create (void *start, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_allocate below.  */
-struct alloc_buffer __libc_alloc_buffer_allocate (size_t size, void **pptr)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_allocate,
+					(size_t size, void **pptr))
   __attribute__ ((nonnull (2)));
 
 /* Allocate a buffer of SIZE bytes using malloc.  The returned buffer
@@ -329,9 +335,9 @@ __alloc_buffer_next (struct alloc_buffer *buf, size_t align)
    (buf, __alloc_buffer_assert_align (__alignof__ (type))))
 
 /* Internal function.  Allocate an array.  */
-void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
-					size_t size, size_t align,
-					size_t count)
+void * libc_hidden_proto3 (__libc_alloc_buffer_alloc_array,
+			   (struct alloc_buffer *buf, size_t size, size_t align,
+			    size_t count))
   __attribute__ ((nonnull (1)));
 
 /* Obtain a TYPE * pointer to an array of COUNT objects in BUF of
@@ -346,8 +352,9 @@ void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
     count))
 
 /* Internal function.  See alloc_buffer_copy_bytes below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_bytes (struct alloc_buffer,
-						    const void *, size_t)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_bytes,
+					(struct alloc_buffer, const void *,
+					 size_t))
   __attribute__ ((nonnull (2)));
 
 /* Copy SIZE bytes starting at SRC into the buffer.  If there is not
@@ -360,8 +367,8 @@ alloc_buffer_copy_bytes (struct alloc_buffer *buf, const void *src, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_copy_string below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_string (struct alloc_buffer,
-						     const char *)
+struct alloc_buffer libc_hidden_proto3 (__libc_alloc_buffer_copy_string,
+					(struct alloc_buffer, const char *))
   __attribute__ ((nonnull (2)));
 
 /* Copy the string at SRC into the buffer, including its null
@@ -377,12 +384,4 @@ alloc_buffer_copy_string (struct alloc_buffer *buf, const char *src)
   return result;
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_alloc_buffer_alloc_array)
-libc_hidden_proto (__libc_alloc_buffer_allocate)
-libc_hidden_proto (__libc_alloc_buffer_copy_bytes)
-libc_hidden_proto (__libc_alloc_buffer_copy_string)
-libc_hidden_proto (__libc_alloc_buffer_create_failure)
-#endif
-
 #endif /* _ALLOC_BUFFER_H */
diff --git a/include/allocate_once.h b/include/allocate_once.h
index a487d641d5..3d267fafe4 100644
--- a/include/allocate_once.h
+++ b/include/allocate_once.h
@@ -21,12 +21,15 @@
 
 #include <atomic.h>
 
+#ifdef _ISOMAC
+# define hidden_proto3(name, proto) name proto
+#endif
+
 /* Slow path for allocate_once; see below.  */
-void *__libc_allocate_once_slow (void **__place,
-                                 void *(*__allocate) (void *__closure),
-                                 void (*__deallocate) (void *__closure,
-                                                       void *__ptr),
-                                 void *__closure);
+void * hidden_proto3 (__libc_allocate_once_slow,
+		      (void **__place, void *(*__allocate) (void *__closure),
+		       void (*__deallocate) (void *__closure, void *__ptr),
+		       void *__closure));
 
 /* Return an a pointer to an allocated and initialized data structure.
    If this function returns a non-NULL value, the caller can assume
@@ -88,8 +91,4 @@ allocate_once (void **__place, void *(*__allocate) (void *__closure),
                                       __closure);
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_allocate_once_slow)
-#endif
-
 #endif /* _ALLOCATE_ONCE_H */
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 4a55a8f7f9..6dbc4def0c 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -539,6 +539,11 @@ for linking")
   __hidden_proto (name, , __GI_##name, ##attrs)
 #  define hidden_proto2(type, name, attrs...) \
   __hidden_proto2 (type, name, , __GI_##name, ##attrs)
+#  define __hidden_proto_alias(internal) \
+    __asm__(__hidden_asmname (#internal))
+#  define hidden_proto3(name, proto, attrs...) \
+  name proto __hidden_proto_alias (__GI_##name) \
+   __hidden_proto_hiddenattr (##attrs)
 #  define hidden_tls_proto(name, attrs...) \
   __hidden_proto (name, __thread, __GI_##name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
@@ -610,8 +615,11 @@ for linking")
   __hidden_proto (name, __thread, name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
   extern thread __typeof (name) name __hidden_proto_hiddenattr (attrs);
+#  define hidden_proto3(name, proto, attrs...) \
+     name proto __hidden_proto_hiddenattr (##attrs)
 # else
 #   define hidden_proto(name, attrs...)
+#   define hidden_proto3(name, proto, attrs...) name proto
 #   define hidden_tls_proto(name, attrs...)
 # endif
 # define __hidden_proto2(type, name, thread, attrs...)     \
@@ -633,6 +641,7 @@ for linking")
 
 #if IS_IN (libc)
 # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
+# define libc_hidden_proto3(name, proto, attrs...) hidden_proto3 (name, proto, ##attrs)
 # define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
 # define libc_hidden_def(name) hidden_def (name)
 # define libc_hidden_weak(name) hidden_weak (name)
@@ -644,6 +653,7 @@ for linking")
 # define libc_hidden_data_ver(local, name) hidden_data_ver (local, name)
 #else
 # define libc_hidden_proto(name, attrs...)
+# define libc_hidden_proto3(name, proto, attrs...) name proto
 # define libc_hidden_tls_proto(name, attrs...)
 # define libc_hidden_def(name)
 # define libc_hidden_weak(name)


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

* [glibc/azanella/clang] Refactor internal alias for internal function
@ 2022-03-16 18:03 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-03-16 18:03 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3372c7eb4323c3ea6e1f4fb5482f87170e01bff2

commit 3372c7eb4323c3ea6e1f4fb5482f87170e01bff2
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Mar 11 15:37:57 2022 -0300

    Refactor internal alias for internal function
    
    Instead of defining the internal alias with hidden_proto macros, adds
    a new hidden_proto3 which defines the macro on function prototype
    (so there is only one function prototype).

Diff:
---
 include/alloc_buffer.h  | 33 ++++++++++++++++-----------------
 include/allocate_once.h | 17 ++++++++---------
 include/libc-symbols.h  |  8 ++++++++
 3 files changed, 32 insertions(+), 26 deletions(-)

diff --git a/include/alloc_buffer.h b/include/alloc_buffer.h
index be33e8b68c..9c824830c7 100644
--- a/include/alloc_buffer.h
+++ b/include/alloc_buffer.h
@@ -83,6 +83,10 @@
 #include <stdlib.h>
 #include <sys/param.h>
 
+#ifdef _ISOMAC
+# define hidden_proto3(name, proto) name proto
+#endif
+
 /* struct alloc_buffer objects refer to a region of bytes in memory of a
    fixed size.  The functions below can be used to allocate single
    objects and arrays from this memory region, or write to its end.
@@ -113,7 +117,8 @@ enum
   };
 
 /* Internal function.  Terminate the process using __libc_fatal.  */
-void __libc_alloc_buffer_create_failure (void *start, size_t size);
+void hidden_proto3 (__libc_alloc_buffer_create_failure,
+		    (void *start, size_t size));
 
 /* Create a new allocation buffer.  The byte range from START to START
    + SIZE - 1 must be valid, and the allocation buffer allocates
@@ -130,7 +135,8 @@ alloc_buffer_create (void *start, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_allocate below.  */
-struct alloc_buffer __libc_alloc_buffer_allocate (size_t size, void **pptr)
+struct alloc_buffer hidden_proto3 (__libc_alloc_buffer_allocate,
+				   (size_t size, void **pptr))
   __attribute__ ((nonnull (2)));
 
 /* Allocate a buffer of SIZE bytes using malloc.  The returned buffer
@@ -329,9 +335,9 @@ __alloc_buffer_next (struct alloc_buffer *buf, size_t align)
    (buf, __alloc_buffer_assert_align (__alignof__ (type))))
 
 /* Internal function.  Allocate an array.  */
-void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
-					size_t size, size_t align,
-					size_t count)
+void * hidden_proto3 (__libc_alloc_buffer_alloc_array,
+		      (struct alloc_buffer *buf, size_t size, size_t align,
+		       size_t count))
   __attribute__ ((nonnull (1)));
 
 /* Obtain a TYPE * pointer to an array of COUNT objects in BUF of
@@ -346,8 +352,9 @@ void * __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf,
     count))
 
 /* Internal function.  See alloc_buffer_copy_bytes below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_bytes (struct alloc_buffer,
-						    const void *, size_t)
+struct alloc_buffer hidden_proto3 (__libc_alloc_buffer_copy_bytes,
+				   (struct alloc_buffer, const void *,
+				    size_t))
   __attribute__ ((nonnull (2)));
 
 /* Copy SIZE bytes starting at SRC into the buffer.  If there is not
@@ -360,8 +367,8 @@ alloc_buffer_copy_bytes (struct alloc_buffer *buf, const void *src, size_t size)
 }
 
 /* Internal function.  See alloc_buffer_copy_string below.  */
-struct alloc_buffer __libc_alloc_buffer_copy_string (struct alloc_buffer,
-						     const char *)
+struct alloc_buffer hidden_proto3 (__libc_alloc_buffer_copy_string,
+				   (struct alloc_buffer, const char *))
   __attribute__ ((nonnull (2)));
 
 /* Copy the string at SRC into the buffer, including its null
@@ -377,12 +384,4 @@ alloc_buffer_copy_string (struct alloc_buffer *buf, const char *src)
   return result;
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_alloc_buffer_alloc_array)
-libc_hidden_proto (__libc_alloc_buffer_allocate)
-libc_hidden_proto (__libc_alloc_buffer_copy_bytes)
-libc_hidden_proto (__libc_alloc_buffer_copy_string)
-libc_hidden_proto (__libc_alloc_buffer_create_failure)
-#endif
-
 #endif /* _ALLOC_BUFFER_H */
diff --git a/include/allocate_once.h b/include/allocate_once.h
index a487d641d5..3d267fafe4 100644
--- a/include/allocate_once.h
+++ b/include/allocate_once.h
@@ -21,12 +21,15 @@
 
 #include <atomic.h>
 
+#ifdef _ISOMAC
+# define hidden_proto3(name, proto) name proto
+#endif
+
 /* Slow path for allocate_once; see below.  */
-void *__libc_allocate_once_slow (void **__place,
-                                 void *(*__allocate) (void *__closure),
-                                 void (*__deallocate) (void *__closure,
-                                                       void *__ptr),
-                                 void *__closure);
+void * hidden_proto3 (__libc_allocate_once_slow,
+		      (void **__place, void *(*__allocate) (void *__closure),
+		       void (*__deallocate) (void *__closure, void *__ptr),
+		       void *__closure));
 
 /* Return an a pointer to an allocated and initialized data structure.
    If this function returns a non-NULL value, the caller can assume
@@ -88,8 +91,4 @@ allocate_once (void **__place, void *(*__allocate) (void *__closure),
                                       __closure);
 }
 
-#ifndef _ISOMAC
-libc_hidden_proto (__libc_allocate_once_slow)
-#endif
-
 #endif /* _ALLOCATE_ONCE_H */
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 4a55a8f7f9..a346520cad 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -539,6 +539,11 @@ for linking")
   __hidden_proto (name, , __GI_##name, ##attrs)
 #  define hidden_proto2(type, name, attrs...) \
   __hidden_proto2 (type, name, , __GI_##name, ##attrs)
+#  define __hidden_proto_alias(internal) \
+    __asm__(__hidden_asmname (#internal))
+#  define hidden_proto3(name, proto, attrs...) \
+  name proto __hidden_proto_alias (__GI_##name) \
+   __hidden_proto_hiddenattr (##attrs)
 #  define hidden_tls_proto(name, attrs...) \
   __hidden_proto (name, __thread, __GI_##name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
@@ -610,8 +615,11 @@ for linking")
   __hidden_proto (name, __thread, name, ##attrs)
 #  define __hidden_proto(name, thread, internal, attrs...)	     \
   extern thread __typeof (name) name __hidden_proto_hiddenattr (attrs);
+#  define hidden_proto3(name, proto, attrs...) \
+     name proto __hidden_proto_hiddenattr (##attrs)
 # else
 #   define hidden_proto(name, attrs...)
+#   define hidden_proto3(name, proto, attrs...) name proto
 #   define hidden_tls_proto(name, attrs...)
 # endif
 # define __hidden_proto2(type, name, thread, attrs...)     \


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

end of thread, other threads:[~2022-10-04 12:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-15 18:41 [glibc/azanella/clang] Refactor internal alias for internal function Adhemerval Zanella
2022-03-16 18:03 Adhemerval Zanella
2022-03-29 20:29 Adhemerval Zanella
2022-03-31 19:06 Adhemerval Zanella
2022-04-04 12:54 Adhemerval Zanella
2022-04-29 14:03 Adhemerval Zanella
2022-05-10 18:23 Adhemerval Zanella
2022-05-12 19:33 Adhemerval Zanella
2022-05-13 14:19 Adhemerval Zanella
2022-06-03 14:05 Adhemerval Zanella
2022-06-09 13:16 Adhemerval Zanella
2022-06-09 21:20 Adhemerval Zanella
2022-10-04 12:56 Adhemerval Zanella

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