Page MenuHomeFreeBSD

D39723.1775476152.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D39723.1775476152.diff

diff --git a/include/stdlib.h b/include/stdlib.h
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -108,7 +108,7 @@
size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t);
int mbtowc(wchar_t * __restrict, const char * __restrict, size_t);
void qsort(void *, size_t, size_t,
- int (* _Nonnull)(const void *, const void *));
+ int (* _Nonnull)(const void *, const void *)) __may_be_slow;
int rand(void);
void *realloc(void *, size_t) __result_use_check __alloc_size(2);
void srand(unsigned);
@@ -301,7 +301,7 @@
int heapsort_b(void *, size_t, size_t,
int (^ _Nonnull)(const void *, const void *));
void qsort_b(void *, size_t, size_t,
- int (^ _Nonnull)(const void *, const void *));
+ int (^ _Nonnull)(const void *, const void *)) __may_be_slow;
#endif
int l64a_r(long, char *, int);
int mergesort(void *, size_t, size_t, int (*)(const void *, const void *));
@@ -312,7 +312,7 @@
int mkostemps(char *, int, int);
int mkostempsat(int, char *, int, int);
void qsort_r(void *, size_t, size_t,
- int (*)(const void *, const void *, void *), void *);
+ int (*)(const void *, const void *, void *), void *) __may_be_slow;
int radixsort(const unsigned char **, int, const unsigned char *,
unsigned);
void *reallocarray(void *, size_t, size_t) __result_use_check
@@ -349,7 +349,7 @@
*/
#if defined(__generic) || defined(__cplusplus)
void __qsort_r_compat(void *, size_t, size_t, void *,
- int (*)(void *, const void *, const void *));
+ int (*)(void *, const void *, const void *)) __may_be_slow;
__sym_compat(qsort_r, __qsort_r_compat, FBSD_1.0);
#endif
#if defined(__generic) && !defined(__cplusplus)
@@ -360,7 +360,7 @@
__END_DECLS
extern "C++" {
static inline void qsort_r(void *base, size_t nmemb, size_t size,
- void *thunk, int (*compar)(void *, const void *, const void *)) {
+ void *thunk, int (*compar)(void *, const void *, const void *)) __may_be_slow {
__qsort_r_compat(base, nmemb, size, thunk, compar);
}
}
@@ -394,7 +394,7 @@
void ignore_handler_s(const char * __restrict, void * __restrict, errno_t);
/* K.3.6.3.2 */
errno_t qsort_s(void *, rsize_t, rsize_t,
- int (*)(const void *, const void *, void *), void *);
+ int (*)(const void *, const void *, void *), void *) __may_be_slow;
#endif /* __EXT1_VISIBLE */
__END_DECLS
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -879,6 +879,15 @@
/* Function should not be analyzed. */
#define __no_lock_analysis __lock_annotate(no_thread_safety_analysis)
+/*
+ * The function marked by this macro may execute slower than expected.
+ */
+#if __has_attribute(warning)
+#define __may_be_slow __attribute__((warning("This function may execute slower than expected.")))
+#else
+#define __may_be_slow
+#endif
+
/*
* Function or variable should not be sanitized, e.g., by AddressSanitizer.
* GCC has the nosanitize attribute, but as a function attribute only, and

File Metadata

Mime Type
text/plain
Expires
Mon, Apr 6, 11:49 AM (11 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28269769
Default Alt Text
D39723.1775476152.diff (2 KB)

Event Timeline