From: Rich Felker Date: Tue, 16 Oct 2018 17:48:10 +0000 (-0400) Subject: restore attribute((const)) to pthread_self and errno location decls X-Git-Tag: v1.1.21~51 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=bf453d68393f7eea5965319e21311e56d71fa53c;p=oweals%2Fmusl.git restore attribute((const)) to pthread_self and errno location decls revert commit a603a75a72bb469c6be4963ed1b55fabe675fe15. as a result of commit 1c84c99913bf1cd47b866ed31e665848a0da84a2 this is now safe, assuming an interpretation of the somewhat-underspecified attribute((const)) consistent with real-world usage. --- diff --git a/include/errno.h b/include/errno.h index 93f5f6ec..0361b33a 100644 --- a/include/errno.h +++ b/include/errno.h @@ -9,6 +9,9 @@ extern "C" { #include +#ifdef __GNUC__ +__attribute__((const)) +#endif int *__errno_location(void); #define errno (*__errno_location()) diff --git a/include/netdb.h b/include/netdb.h index adde2c5e..d096c781 100644 --- a/include/netdb.h +++ b/include/netdb.h @@ -115,6 +115,9 @@ struct protoent *getprotobynumber (int); || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700) struct hostent *gethostbyname (const char *); struct hostent *gethostbyaddr (const void *, socklen_t, int); +#ifdef __GNUC__ +__attribute__((const)) +#endif int *__h_errno_location(void); #define h_errno (*__h_errno_location()) #define HOST_NOT_FOUND 1 diff --git a/include/pthread.h b/include/pthread.h index bba9587e..e238321b 100644 --- a/include/pthread.h +++ b/include/pthread.h @@ -79,6 +79,9 @@ int pthread_detach(pthread_t); _Noreturn void pthread_exit(void *); int pthread_join(pthread_t, void **); +#ifdef __GNUC__ +__attribute__((const)) +#endif pthread_t pthread_self(void); int pthread_equal(pthread_t, pthread_t);