People who do C know that if the defined function is only used in this file, it should be declared as static
But looking at the bionic code in Android, bionic/libc/bionic/pthread. c found such code snippets.
1269 __LIBC_HIDDEN__ 1270 int pthread_mutex_unlock_impl(pthread_mutex_t *mutex) 1271 { 1272 int mvalue, mtype, tid, oldv, shared; 1273 1274 if (__unlikely(mutex == NULL)) 1275 return EINVAL; 1276 1277 mvalue = mutex->value; 1278 mtype = (mvalue & MUTEX_TYPE_MASK); 1279 shared = (mvalue & MUTEX_SHARED_MASK);
Since this function is used by other code in this file, why not define it as static?
#define __LIBC_HIDDEN__\ __attribute__ ((visibility ("hidden")))
According to the information, the original hidden function is to make the function invisible outside the share libs, that is, there should be other files (units) in the library to use this function.
Search, and found
Pthread_debug.c 451 extern int pthread_mutex_unlock_impl (pthread_mutex_t * mutex );
458 return pthread_mutex_unlock_impl(mutex);pthread.c 1270 int pthread_mutex_unlock_impl(pthread_mutex_t *mutex) function