Jelajahi Sumber

use __attribute__((const)) for errno and pthread_self if __GNUC__ is defined

this is not too ugly and should result in significant code size and
performance improvements for many programs.
Rich Felker 13 tahun lalu
induk
melakukan
cbf35978a9
2 mengubah file dengan 6 tambahan dan 0 penghapusan
  1. 3 0
      include/errno.h
  2. 3 0
      include/pthread.h

+ 3 - 0
include/errno.h

@@ -7,6 +7,9 @@ extern "C" {
 
 #include <bits/errno.h>
 
+#ifdef __GNUC__
+__attribute__((const))
+#endif
 extern int *__errno_location(void);
 #define errno (*__errno_location())
 

+ 3 - 0
include/pthread.h

@@ -76,6 +76,9 @@ int pthread_detach(pthread_t);
 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);