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
Show 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 @@
#define gcc_nonnull(...) __attribute__((nonnull(__VA_ARGS__)))
#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_unlikely(x) __builtin_expect (!!(x), 0)
...
...
@@ -121,6 +123,8 @@
#define gcc_nonnull(...)
#define gcc_nonnull_all
#define gcc_returns_nonnull
#define gcc_returns_twice
#define gcc_likely(x) (x)
#define gcc_unlikely(x) (x)
...
...
src/db/plugins/simple/Directory.hxx
View file @
edee8a34
...
...
@@ -106,7 +106,7 @@ public:
/**
* Create a new root #Directory object.
*/
gcc_malloc
gcc_malloc
gcc_returns_nonnull
static
Directory
*
NewRoot
()
{
return
new
Directory
(
std
::
string
(),
nullptr
);
}
...
...
src/db/plugins/simple/Song.hxx
View file @
edee8a34
...
...
@@ -95,11 +95,11 @@ struct Song {
Song
(
const
char
*
_uri
,
size_t
uri_length
,
Directory
&
parent
);
~
Song
();
gcc_malloc
gcc_malloc
gcc_returns_nonnull
static
Song
*
NewFrom
(
DetachedSong
&&
other
,
Directory
&
parent
);
/** 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
);
/**
...
...
src/output/OutputPlugin.hxx
View file @
edee8a34
...
...
@@ -76,7 +76,7 @@ ao_plugin_test_default_device(const AudioOutputPlugin *plugin)
:
false
;
}
gcc_malloc
gcc_malloc
gcc_returns_nonnull
AudioOutput
*
ao_plugin_init
(
EventLoop
&
event_loop
,
const
AudioOutputPlugin
&
plugin
,
...
...
src/pcm/PcmBuffer.hxx
View file @
edee8a34
...
...
@@ -47,11 +47,11 @@ public:
* to signal "error". An empty destination buffer is not
* always an error.
*/
gcc_malloc
gcc_malloc
gcc_returns_nonnull
void
*
Get
(
size_t
size
);
template
<
typename
T
>
gcc_malloc
gcc_malloc
gcc_returns_nonnull
T
*
GetT
(
size_t
n
)
{
return
(
T
*
)
Get
(
n
*
sizeof
(
T
));
}
...
...
src/pcm/SampleFormat.hxx
View file @
edee8a34
...
...
@@ -122,7 +122,7 @@ sample_format_size(SampleFormat format)
* @param format a #SampleFormat enum value
* @return the string
*/
gcc_pure
gcc_malloc
gcc_pure
gcc_malloc
gcc_returns_nonnull
const
char
*
sample_format_to_string
(
SampleFormat
format
)
noexcept
;
...
...
src/tag/Tag.hxx
View file @
edee8a34
...
...
@@ -116,7 +116,7 @@ struct Tag {
*
* @return a newly allocated tag
*/
gcc_malloc
gcc_malloc
gcc_returns_nonnull
static
Tag
*
Merge
(
const
Tag
&
base
,
const
Tag
&
add
);
/**
...
...
@@ -125,7 +125,7 @@ struct Tag {
*
* @return a newly allocated tag
*/
gcc_malloc
gcc_malloc
gcc_returns_nonnull
static
Tag
*
MergeReplace
(
Tag
*
base
,
Tag
*
add
);
/**
...
...
@@ -148,7 +148,7 @@ struct Tag {
* (e.g. #TAG_ALBUM_ARTIST falls back to #TAG_ARTIST). If
* there is no such value, returns an empty string.
*/
gcc_pure
gcc_pure
gcc_returns_nonnull
const
char
*
GetSortValue
(
TagType
type
)
const
noexcept
;
class
const_iterator
{
...
...
src/util/Alloc.hxx
View file @
edee8a34
...
...
@@ -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
);
...
...
src/util/ReusableArray.hxx
View file @
edee8a34
...
...
@@ -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 */
...
...
src/util/StringAPI.hxx
View file @
edee8a34
...
...
@@ -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
{
...
...
src/util/VarSize.hxx
View file @
edee8a34
...
...
@@ -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
)
{
...
...
src/util/WStringAPI.hxx
View file @
edee8a34
...
...
@@ -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
)
{
...
...
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