Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
edee8a34
Commit
edee8a34
authored
Dec 18, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compiler.h: add gcc_returns_nonnull, gcc_returns_twice
parent
5582367d
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
27 additions
and
23 deletions
+27
-23
Compiler.h
src/Compiler.h
+4
-0
Directory.hxx
src/db/plugins/simple/Directory.hxx
+1
-1
Song.hxx
src/db/plugins/simple/Song.hxx
+2
-2
OutputPlugin.hxx
src/output/OutputPlugin.hxx
+1
-1
PcmBuffer.hxx
src/pcm/PcmBuffer.hxx
+2
-2
SampleFormat.hxx
src/pcm/SampleFormat.hxx
+1
-1
Tag.hxx
src/tag/Tag.hxx
+3
-3
Alloc.hxx
src/util/Alloc.hxx
+7
-7
ReusableArray.hxx
src/util/ReusableArray.hxx
+1
-1
StringAPI.hxx
src/util/StringAPI.hxx
+2
-2
VarSize.hxx
src/util/VarSize.hxx
+1
-1
WStringAPI.hxx
src/util/WStringAPI.hxx
+2
-2
No files found.
src/Compiler.h
View file @
edee8a34
...
@@ -93,6 +93,8 @@
...
@@ -93,6 +93,8 @@
#define gcc_nonnull(...) __attribute__((nonnull(__VA_ARGS__)))
#define gcc_nonnull(...) __attribute__((nonnull(__VA_ARGS__)))
#define gcc_nonnull_all __attribute__((nonnull))
#define gcc_nonnull_all __attribute__((nonnull))
#define gcc_returns_nonnull __attribute__((returns_nonnull))
#define gcc_returns_twice __attribute__((returns_twice))
#define gcc_likely(x) __builtin_expect (!!(x), 1)
#define gcc_likely(x) __builtin_expect (!!(x), 1)
#define gcc_unlikely(x) __builtin_expect (!!(x), 0)
#define gcc_unlikely(x) __builtin_expect (!!(x), 0)
...
@@ -121,6 +123,8 @@
...
@@ -121,6 +123,8 @@
#define gcc_nonnull(...)
#define gcc_nonnull(...)
#define gcc_nonnull_all
#define gcc_nonnull_all
#define gcc_returns_nonnull
#define gcc_returns_twice
#define gcc_likely(x) (x)
#define gcc_likely(x) (x)
#define gcc_unlikely(x) (x)
#define gcc_unlikely(x) (x)
...
...
src/db/plugins/simple/Directory.hxx
View file @
edee8a34
...
@@ -106,7 +106,7 @@ public:
...
@@ -106,7 +106,7 @@ public:
/**
/**
* Create a new root #Directory object.
* Create a new root #Directory object.
*/
*/
gcc_malloc
gcc_malloc
gcc_returns_nonnull
static
Directory
*
NewRoot
()
{
static
Directory
*
NewRoot
()
{
return
new
Directory
(
std
::
string
(),
nullptr
);
return
new
Directory
(
std
::
string
(),
nullptr
);
}
}
...
...
src/db/plugins/simple/Song.hxx
View file @
edee8a34
...
@@ -95,11 +95,11 @@ struct Song {
...
@@ -95,11 +95,11 @@ struct Song {
Song
(
const
char
*
_uri
,
size_t
uri_length
,
Directory
&
parent
);
Song
(
const
char
*
_uri
,
size_t
uri_length
,
Directory
&
parent
);
~
Song
();
~
Song
();
gcc_malloc
gcc_malloc
gcc_returns_nonnull
static
Song
*
NewFrom
(
DetachedSong
&&
other
,
Directory
&
parent
);
static
Song
*
NewFrom
(
DetachedSong
&&
other
,
Directory
&
parent
);
/** allocate a new song with a local file name */
/** allocate a new song with a local file name */
gcc_malloc
gcc_malloc
gcc_returns_nonnull
static
Song
*
NewFile
(
const
char
*
path_utf8
,
Directory
&
parent
);
static
Song
*
NewFile
(
const
char
*
path_utf8
,
Directory
&
parent
);
/**
/**
...
...
src/output/OutputPlugin.hxx
View file @
edee8a34
...
@@ -76,7 +76,7 @@ ao_plugin_test_default_device(const AudioOutputPlugin *plugin)
...
@@ -76,7 +76,7 @@ ao_plugin_test_default_device(const AudioOutputPlugin *plugin)
:
false
;
:
false
;
}
}
gcc_malloc
gcc_malloc
gcc_returns_nonnull
AudioOutput
*
AudioOutput
*
ao_plugin_init
(
EventLoop
&
event_loop
,
ao_plugin_init
(
EventLoop
&
event_loop
,
const
AudioOutputPlugin
&
plugin
,
const
AudioOutputPlugin
&
plugin
,
...
...
src/pcm/PcmBuffer.hxx
View file @
edee8a34
...
@@ -47,11 +47,11 @@ public:
...
@@ -47,11 +47,11 @@ public:
* to signal "error". An empty destination buffer is not
* to signal "error". An empty destination buffer is not
* always an error.
* always an error.
*/
*/
gcc_malloc
gcc_malloc
gcc_returns_nonnull
void
*
Get
(
size_t
size
);
void
*
Get
(
size_t
size
);
template
<
typename
T
>
template
<
typename
T
>
gcc_malloc
gcc_malloc
gcc_returns_nonnull
T
*
GetT
(
size_t
n
)
{
T
*
GetT
(
size_t
n
)
{
return
(
T
*
)
Get
(
n
*
sizeof
(
T
));
return
(
T
*
)
Get
(
n
*
sizeof
(
T
));
}
}
...
...
src/pcm/SampleFormat.hxx
View file @
edee8a34
...
@@ -122,7 +122,7 @@ sample_format_size(SampleFormat format)
...
@@ -122,7 +122,7 @@ sample_format_size(SampleFormat format)
* @param format a #SampleFormat enum value
* @param format a #SampleFormat enum value
* @return the string
* @return the string
*/
*/
gcc_pure
gcc_malloc
gcc_pure
gcc_malloc
gcc_returns_nonnull
const
char
*
const
char
*
sample_format_to_string
(
SampleFormat
format
)
noexcept
;
sample_format_to_string
(
SampleFormat
format
)
noexcept
;
...
...
src/tag/Tag.hxx
View file @
edee8a34
...
@@ -116,7 +116,7 @@ struct Tag {
...
@@ -116,7 +116,7 @@ struct Tag {
*
*
* @return a newly allocated tag
* @return a newly allocated tag
*/
*/
gcc_malloc
gcc_malloc
gcc_returns_nonnull
static
Tag
*
Merge
(
const
Tag
&
base
,
const
Tag
&
add
);
static
Tag
*
Merge
(
const
Tag
&
base
,
const
Tag
&
add
);
/**
/**
...
@@ -125,7 +125,7 @@ struct Tag {
...
@@ -125,7 +125,7 @@ struct Tag {
*
*
* @return a newly allocated tag
* @return a newly allocated tag
*/
*/
gcc_malloc
gcc_malloc
gcc_returns_nonnull
static
Tag
*
MergeReplace
(
Tag
*
base
,
Tag
*
add
);
static
Tag
*
MergeReplace
(
Tag
*
base
,
Tag
*
add
);
/**
/**
...
@@ -148,7 +148,7 @@ struct Tag {
...
@@ -148,7 +148,7 @@ struct Tag {
* (e.g. #TAG_ALBUM_ARTIST falls back to #TAG_ARTIST). If
* (e.g. #TAG_ALBUM_ARTIST falls back to #TAG_ARTIST). If
* there is no such value, returns an empty string.
* there is no such value, returns an empty string.
*/
*/
gcc_pure
gcc_pure
gcc_returns_nonnull
const
char
*
GetSortValue
(
TagType
type
)
const
noexcept
;
const
char
*
GetSortValue
(
TagType
type
)
const
noexcept
;
class
const_iterator
{
class
const_iterator
{
...
...
src/util/Alloc.hxx
View file @
edee8a34
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
* This function never fails; in out-of-memory situations, it aborts
* This function never fails; in out-of-memory situations, it aborts
* the process.
* the process.
*/
*/
gcc_malloc
gcc_malloc
gcc_returns_nonnull
void
*
void
*
xalloc
(
size_t
size
);
xalloc
(
size_t
size
);
...
@@ -40,7 +40,7 @@ xalloc(size_t size);
...
@@ -40,7 +40,7 @@ xalloc(size_t size);
* This function never fails; in out-of-memory situations, it aborts
* This function never fails; in out-of-memory situations, it aborts
* the process.
* the process.
*/
*/
gcc_malloc
gcc_nonnull_all
gcc_malloc
gcc_
returns_nonnull
gcc_
nonnull_all
void
*
void
*
xmemdup
(
const
void
*
s
,
size_t
size
);
xmemdup
(
const
void
*
s
,
size_t
size
);
...
@@ -50,7 +50,7 @@ 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
* This function never fails; in out-of-memory situations, it aborts
* the process.
* the process.
*/
*/
gcc_malloc
gcc_nonnull_all
gcc_malloc
gcc_
returns_nonnull
gcc_
nonnull_all
char
*
char
*
xstrdup
(
const
char
*
s
);
xstrdup
(
const
char
*
s
);
...
@@ -60,7 +60,7 @@ xstrdup(const char *s);
...
@@ -60,7 +60,7 @@ xstrdup(const char *s);
* This function never fails; in out-of-memory situations, it aborts
* This function never fails; in out-of-memory situations, it aborts
* the process.
* the process.
*/
*/
gcc_malloc
gcc_nonnull_all
gcc_malloc
gcc_
returns_nonnull
gcc_
nonnull_all
char
*
char
*
xstrndup
(
const
char
*
s
,
size_t
n
);
xstrndup
(
const
char
*
s
,
size_t
n
);
...
@@ -71,15 +71,15 @@ 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
* This function never fails; in out-of-memory situations, it aborts
* the process.
* the process.
*/
*/
gcc_malloc
gcc_nonnull_all
gcc_malloc
gcc_
returns_nonnull
gcc_
nonnull_all
char
*
char
*
xstrcatdup
(
const
char
*
a
,
const
char
*
b
);
xstrcatdup
(
const
char
*
a
,
const
char
*
b
);
gcc_malloc
gcc_nonnull_all
gcc_malloc
gcc_
returns_nonnull
gcc_
nonnull_all
char
*
char
*
xstrcatdup
(
const
char
*
a
,
const
char
*
b
,
const
char
*
c
);
xstrcatdup
(
const
char
*
a
,
const
char
*
b
,
const
char
*
c
);
gcc_malloc
gcc_nonnull_all
gcc_malloc
gcc_
returns_nonnull
gcc_
nonnull_all
char
*
char
*
xstrcatdup
(
const
char
*
a
,
const
char
*
b
,
const
char
*
c
,
const
char
*
d
);
xstrcatdup
(
const
char
*
a
,
const
char
*
b
,
const
char
*
c
,
const
char
*
d
);
...
...
src/util/ReusableArray.hxx
View file @
edee8a34
...
@@ -84,7 +84,7 @@ public:
...
@@ -84,7 +84,7 @@ public:
* Get the buffer, and guarantee a minimum size. This buffer
* Get the buffer, and guarantee a minimum size. This buffer
* becomes invalid with the next Get() call.
* becomes invalid with the next Get() call.
*/
*/
gcc_malloc
gcc_malloc
gcc_returns_nonnull
T
*
Get
(
size_t
size
)
{
T
*
Get
(
size_t
size
)
{
if
(
gcc_unlikely
(
size
>
capacity
))
{
if
(
gcc_unlikely
(
size
>
capacity
))
{
/* too small: grow */
/* too small: grow */
...
...
src/util/StringAPI.hxx
View file @
edee8a34
...
@@ -107,7 +107,7 @@ UnsafeCopyString(char *dest, const char *src) noexcept
...
@@ -107,7 +107,7 @@ UnsafeCopyString(char *dest, const char *src) noexcept
strcpy
(
dest
,
src
);
strcpy
(
dest
,
src
);
}
}
gcc_nonnull_all
gcc_
returns_nonnull
gcc_
nonnull_all
static
inline
char
*
static
inline
char
*
UnsafeCopyStringP
(
char
*
dest
,
const
char
*
src
)
noexcept
UnsafeCopyStringP
(
char
*
dest
,
const
char
*
src
)
noexcept
{
{
...
@@ -165,7 +165,7 @@ StringCollate(const char *a, const char *b) 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
* Copy the string to a new allocation. The return value must be
* freed with free().
* freed with free().
*/
*/
gcc_malloc
gcc_nonnull_all
gcc_malloc
gcc_
returns_nonnull
gcc_
nonnull_all
static
inline
char
*
static
inline
char
*
DuplicateString
(
const
char
*
p
)
noexcept
DuplicateString
(
const
char
*
p
)
noexcept
{
{
...
...
src/util/VarSize.hxx
View file @
edee8a34
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
* #T
* #T
*/
*/
template
<
class
T
,
typename
...
Args
>
template
<
class
T
,
typename
...
Args
>
gcc_malloc
gcc_malloc
gcc_returns_nonnull
T
*
T
*
NewVarSize
(
size_t
declared_tail_size
,
size_t
real_tail_size
,
Args
&&
...
args
)
NewVarSize
(
size_t
declared_tail_size
,
size_t
real_tail_size
,
Args
&&
...
args
)
{
{
...
...
src/util/WStringAPI.hxx
View file @
edee8a34
...
@@ -97,7 +97,7 @@ UnsafeCopyString(wchar_t *dest, const wchar_t *src) noexcept
...
@@ -97,7 +97,7 @@ UnsafeCopyString(wchar_t *dest, const wchar_t *src) noexcept
wcscpy
(
dest
,
src
);
wcscpy
(
dest
,
src
);
}
}
gcc_nonnull_all
gcc_
returns_nonnull
gcc_
nonnull_all
static
inline
wchar_t
*
static
inline
wchar_t
*
UnsafeCopyStringP
(
wchar_t
*
dest
,
const
wchar_t
*
src
)
noexcept
UnsafeCopyStringP
(
wchar_t
*
dest
,
const
wchar_t
*
src
)
noexcept
{
{
...
@@ -155,7 +155,7 @@ StringIsEqualIgnoreCase(const wchar_t *a, const wchar_t *b,
...
@@ -155,7 +155,7 @@ StringIsEqualIgnoreCase(const wchar_t *a, const wchar_t *b,
#ifndef __BIONIC__
#ifndef __BIONIC__
gcc_malloc
gcc_nonnull_all
gcc_malloc
gcc_
returns_nonnull
gcc_
nonnull_all
static
inline
wchar_t
*
static
inline
wchar_t
*
DuplicateString
(
const
wchar_t
*
p
)
DuplicateString
(
const
wchar_t
*
p
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment