Compiler.h: add gcc_returns_nonnull, gcc_returns_twice
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
* This function never fails; in out-of-memory situations, it aborts
|
||||
* the process.
|
||||
*/
|
||||
gcc_malloc
|
||||
gcc_malloc gcc_returns_nonnull
|
||||
void *
|
||||
xalloc(size_t size);
|
||||
|
||||
@@ -40,7 +40,7 @@ xalloc(size_t size);
|
||||
* This function never fails; in out-of-memory situations, it aborts
|
||||
* the process.
|
||||
*/
|
||||
gcc_malloc gcc_nonnull_all
|
||||
gcc_malloc gcc_returns_nonnull gcc_nonnull_all
|
||||
void *
|
||||
xmemdup(const void *s, size_t size);
|
||||
|
||||
@@ -50,7 +50,7 @@ xmemdup(const void *s, size_t size);
|
||||
* This function never fails; in out-of-memory situations, it aborts
|
||||
* the process.
|
||||
*/
|
||||
gcc_malloc gcc_nonnull_all
|
||||
gcc_malloc gcc_returns_nonnull gcc_nonnull_all
|
||||
char *
|
||||
xstrdup(const char *s);
|
||||
|
||||
@@ -60,7 +60,7 @@ xstrdup(const char *s);
|
||||
* This function never fails; in out-of-memory situations, it aborts
|
||||
* the process.
|
||||
*/
|
||||
gcc_malloc gcc_nonnull_all
|
||||
gcc_malloc gcc_returns_nonnull gcc_nonnull_all
|
||||
char *
|
||||
xstrndup(const char *s, size_t n);
|
||||
|
||||
@@ -71,15 +71,15 @@ xstrndup(const char *s, size_t n);
|
||||
* This function never fails; in out-of-memory situations, it aborts
|
||||
* the process.
|
||||
*/
|
||||
gcc_malloc gcc_nonnull_all
|
||||
gcc_malloc gcc_returns_nonnull gcc_nonnull_all
|
||||
char *
|
||||
xstrcatdup(const char *a, const char *b);
|
||||
|
||||
gcc_malloc gcc_nonnull_all
|
||||
gcc_malloc gcc_returns_nonnull gcc_nonnull_all
|
||||
char *
|
||||
xstrcatdup(const char *a, const char *b, const char *c);
|
||||
|
||||
gcc_malloc gcc_nonnull_all
|
||||
gcc_malloc gcc_returns_nonnull gcc_nonnull_all
|
||||
char *
|
||||
xstrcatdup(const char *a, const char *b, const char *c, const char *d);
|
||||
|
||||
|
@@ -84,7 +84,7 @@ public:
|
||||
* Get the buffer, and guarantee a minimum size. This buffer
|
||||
* becomes invalid with the next Get() call.
|
||||
*/
|
||||
gcc_malloc
|
||||
gcc_malloc gcc_returns_nonnull
|
||||
T *Get(size_t size) {
|
||||
if (gcc_unlikely(size > capacity)) {
|
||||
/* too small: grow */
|
||||
|
@@ -107,7 +107,7 @@ UnsafeCopyString(char *dest, const char *src) noexcept
|
||||
strcpy(dest, src);
|
||||
}
|
||||
|
||||
gcc_nonnull_all
|
||||
gcc_returns_nonnull gcc_nonnull_all
|
||||
static inline char *
|
||||
UnsafeCopyStringP(char *dest, const char *src) noexcept
|
||||
{
|
||||
@@ -165,7 +165,7 @@ StringCollate(const char *a, const char *b) noexcept
|
||||
* Copy the string to a new allocation. The return value must be
|
||||
* freed with free().
|
||||
*/
|
||||
gcc_malloc gcc_nonnull_all
|
||||
gcc_malloc gcc_returns_nonnull gcc_nonnull_all
|
||||
static inline char *
|
||||
DuplicateString(const char *p) noexcept
|
||||
{
|
||||
|
@@ -50,7 +50,7 @@
|
||||
* #T
|
||||
*/
|
||||
template<class T, typename... Args>
|
||||
gcc_malloc
|
||||
gcc_malloc gcc_returns_nonnull
|
||||
T *
|
||||
NewVarSize(size_t declared_tail_size, size_t real_tail_size, Args&&... args)
|
||||
{
|
||||
|
@@ -97,7 +97,7 @@ UnsafeCopyString(wchar_t *dest, const wchar_t *src) noexcept
|
||||
wcscpy(dest, src);
|
||||
}
|
||||
|
||||
gcc_nonnull_all
|
||||
gcc_returns_nonnull gcc_nonnull_all
|
||||
static inline wchar_t *
|
||||
UnsafeCopyStringP(wchar_t *dest, const wchar_t *src) noexcept
|
||||
{
|
||||
@@ -155,7 +155,7 @@ StringIsEqualIgnoreCase(const wchar_t *a, const wchar_t *b,
|
||||
|
||||
#ifndef __BIONIC__
|
||||
|
||||
gcc_malloc gcc_nonnull_all
|
||||
gcc_malloc gcc_returns_nonnull gcc_nonnull_all
|
||||
static inline wchar_t *
|
||||
DuplicateString(const wchar_t *p)
|
||||
{
|
||||
|
Reference in New Issue
Block a user