Page MenuHomeFreeBSD

D2107.id4324.diff
No OneTemporary

D2107.id4324.diff

Index: include/stdlib.h
===================================================================
--- include/stdlib.h
+++ include/stdlib.h
@@ -87,21 +87,21 @@
long atol(const char *);
void *bsearch(const void *, const void *, size_t,
size_t, int (*)(const void *, const void *));
-void *calloc(size_t, size_t) __malloc_like;
+void *calloc(size_t, size_t) __malloc_like __wur __alloc_size(1, 2);
div_t div(int, int) __pure2;
_Noreturn void exit(int);
void free(void *);
char *getenv(const char *);
long labs(long) __pure2;
ldiv_t ldiv(long, long) __pure2;
-void *malloc(size_t) __malloc_like;
+void *malloc(size_t) __malloc_like __wur __alloc_size(1);
int mblen(const char *, size_t);
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 (*)(const void *, const void *));
int rand(void);
-void *realloc(void *, size_t);
+void *realloc(void *, size_t) __wur __alloc_size(2);
void srand(unsigned);
double strtod(const char * __restrict, char ** __restrict);
float strtof(const char * __restrict, char ** __restrict);
Index: sys/sys/cdefs.h
===================================================================
--- sys/sys/cdefs.h
+++ sys/sys/cdefs.h
@@ -40,6 +40,9 @@
* Testing against Clang-specific extensions.
*/
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#endif
#ifndef __has_extension
#define __has_extension __has_feature
#endif
@@ -363,8 +366,10 @@
#if __GNUC_PREREQ__(3, 4)
#define __fastcall __attribute__((__fastcall__))
+#define __wur __attribute__((__warn_unused_result__))
#else
#define __fastcall
+#define __wur
#endif
#if __GNUC_PREREQ__(4, 1)
@@ -373,6 +378,12 @@
#define __returns_twice
#endif
+#if __has_attribute(alloc_size) || __GNUC_PREREQ__(4, 3)
+#define __alloc_size(...) __attribute__((alloc_size(__VA_ARGS__)))
+#else
+#define __alloc_size(...)
+#endif
+
/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
#define __func__ NULL

File Metadata

Mime Type
text/plain
Expires
Wed, Mar 11, 11:09 PM (7 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29555024
Default Alt Text
D2107.id4324.diff (2 KB)

Event Timeline