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
ba69ade0
Commit
ba69ade0
authored
Nov 28, 2014
by
Max Kellermann
Committed by
Max Kellermann
Aug 23, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compiler.h: add macro CLANG_OR_GCC_VERSION()
parent
a546bfe7
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
23 additions
and
16 deletions
+23
-16
Compiler.h
src/Compiler.h
+11
-4
Helpers.cxx
src/db/Helpers.cxx
+2
-2
UpnpDatabasePlugin.cxx
src/db/plugins/upnp/UpnpDatabasePlugin.cxx
+1
-1
SmbclientNeighborPlugin.cxx
src/neighbor/plugins/SmbclientNeighborPlugin.cxx
+1
-1
HttpdInternal.hxx
src/output/plugins/httpd/HttpdInternal.hxx
+1
-1
CompositeStorage.cxx
src/storage/CompositeStorage.cxx
+1
-1
Set.cxx
src/tag/Set.cxx
+1
-1
TagPool.cxx
src/tag/TagPool.cxx
+1
-1
Cast.hxx
src/util/Cast.hxx
+2
-2
Manual.hxx
src/util/Manual.hxx
+2
-2
No files found.
src/Compiler.h
View file @
ba69ade0
...
@@ -32,6 +32,13 @@
...
@@ -32,6 +32,13 @@
(defined(__GNUC__) && GCC_VERSION >= GCC_MAKE_VERSION(major, minor, 0))
(defined(__GNUC__) && GCC_VERSION >= GCC_MAKE_VERSION(major, minor, 0))
/**
/**
* Are we building with clang (any version) or at least the specified
* gcc version?
*/
#define CLANG_OR_GCC_VERSION(major, minor) \
(defined(__clang__) || GCC_CHECK_VERSION(major, minor))
/**
* Are we building with gcc (not clang or any other compiler) and a
* Are we building with gcc (not clang or any other compiler) and a
* version older than the specified one?
* version older than the specified one?
*/
*/
...
@@ -59,7 +66,7 @@
...
@@ -59,7 +66,7 @@
(defined(__clang__) && \
(defined(__clang__) && \
CLANG_VERSION >= GCC_MAKE_VERSION(major, minor, 0))
CLANG_VERSION >= GCC_MAKE_VERSION(major, minor, 0))
#if
GCC_CHECK
_VERSION(4,0)
#if
CLANG_OR_GCC
_VERSION(4,0)
/* GCC 4.x */
/* GCC 4.x */
...
@@ -119,7 +126,7 @@
...
@@ -119,7 +126,7 @@
#endif
#endif
#if
GCC_CHECK
_VERSION(4,3)
#if
CLANG_OR_GCC
_VERSION(4,3)
#define gcc_hot __attribute__((hot))
#define gcc_hot __attribute__((hot))
#define gcc_cold __attribute__((cold))
#define gcc_cold __attribute__((cold))
...
@@ -140,7 +147,7 @@
...
@@ -140,7 +147,7 @@
#ifndef __cplusplus
#ifndef __cplusplus
/* plain C99 has "restrict" */
/* plain C99 has "restrict" */
#define gcc_restrict restrict
#define gcc_restrict restrict
#elif
GCC_CHECK
_VERSION(4,0)
#elif
CLANG_OR_GCC
_VERSION(4,0)
/* "__restrict__" is a GCC extension for C++ */
/* "__restrict__" is a GCC extension for C++ */
#define gcc_restrict __restrict__
#define gcc_restrict __restrict__
#else
#else
...
@@ -158,7 +165,7 @@
...
@@ -158,7 +165,7 @@
#define final
#define final
#endif
#endif
#if
defined(__clang__) || GCC_CHECK
_VERSION(4,8)
#if
CLANG_OR_GCC
_VERSION(4,8)
#define gcc_alignas(T, fallback) alignas(T)
#define gcc_alignas(T, fallback) alignas(T)
#else
#else
#define gcc_alignas(T, fallback) gcc_aligned(fallback)
#define gcc_alignas(T, fallback) gcc_aligned(fallback)
...
...
src/db/Helpers.cxx
View file @
ba69ade0
...
@@ -46,7 +46,7 @@ StatsVisitTag(DatabaseStats &stats, StringSet &artists, StringSet &albums,
...
@@ -46,7 +46,7 @@ StatsVisitTag(DatabaseStats &stats, StringSet &artists, StringSet &albums,
for
(
const
auto
&
item
:
tag
)
{
for
(
const
auto
&
item
:
tag
)
{
switch
(
item
.
type
)
{
switch
(
item
.
type
)
{
case
TAG_ARTIST
:
case
TAG_ARTIST
:
#if
defined(__clang__) || GCC_CHECK
_VERSION(4,8)
#if
CLANG_OR_GCC
_VERSION(4,8)
artists
.
emplace
(
item
.
value
);
artists
.
emplace
(
item
.
value
);
#else
#else
artists
.
insert
(
item
.
value
);
artists
.
insert
(
item
.
value
);
...
@@ -54,7 +54,7 @@ StatsVisitTag(DatabaseStats &stats, StringSet &artists, StringSet &albums,
...
@@ -54,7 +54,7 @@ StatsVisitTag(DatabaseStats &stats, StringSet &artists, StringSet &albums,
break
;
break
;
case
TAG_ALBUM
:
case
TAG_ALBUM
:
#if
defined(__clang__) || GCC_CHECK
_VERSION(4,8)
#if
CLANG_OR_GCC
_VERSION(4,8)
albums
.
emplace
(
item
.
value
);
albums
.
emplace
(
item
.
value
);
#else
#else
albums
.
insert
(
item
.
value
);
albums
.
insert
(
item
.
value
);
...
...
src/db/plugins/upnp/UpnpDatabasePlugin.cxx
View file @
ba69ade0
...
@@ -749,7 +749,7 @@ UpnpDatabase::VisitUniqueTags(const DatabaseSelection &selection,
...
@@ -749,7 +749,7 @@ UpnpDatabase::VisitUniqueTags(const DatabaseSelection &selection,
const
char
*
value
=
dirent
.
tag
.
GetValue
(
tag
);
const
char
*
value
=
dirent
.
tag
.
GetValue
(
tag
);
if
(
value
!=
nullptr
)
{
if
(
value
!=
nullptr
)
{
#if
defined(__clang__) || GCC_CHECK
_VERSION(4,8)
#if
CLANG_OR_GCC
_VERSION(4,8)
values
.
emplace
(
value
);
values
.
emplace
(
value
);
#else
#else
values
.
insert
(
value
);
values
.
insert
(
value
);
...
...
src/neighbor/plugins/SmbclientNeighborPlugin.cxx
View file @
ba69ade0
...
@@ -216,7 +216,7 @@ SmbclientNeighborExplorer::Run()
...
@@ -216,7 +216,7 @@ SmbclientNeighborExplorer::Run()
prev
=
i
;
prev
=
i
;
}
else
{
}
else
{
/* can't see it anymore: move to "lost" */
/* can't see it anymore: move to "lost" */
#if
defined(__clang__) || GCC_CHECK
_VERSION(4,7)
#if
CLANG_OR_GCC
_VERSION(4,7)
lost
.
splice_after
(
lost
.
before_begin
(),
list
,
prev
);
lost
.
splice_after
(
lost
.
before_begin
(),
list
,
prev
);
#else
#else
/* the forward_list::splice_after() lvalue
/* the forward_list::splice_after() lvalue
...
...
src/output/plugins/httpd/HttpdInternal.hxx
View file @
ba69ade0
...
@@ -153,7 +153,7 @@ public:
...
@@ -153,7 +153,7 @@ public:
HttpdOutput
(
EventLoop
&
_loop
);
HttpdOutput
(
EventLoop
&
_loop
);
~
HttpdOutput
();
~
HttpdOutput
();
#if
defined(__clang__) || GCC_CHECK
_VERSION(4,7)
#if
CLANG_OR_GCC
_VERSION(4,7)
constexpr
constexpr
#endif
#endif
static
HttpdOutput
*
Cast
(
AudioOutput
*
ao
)
{
static
HttpdOutput
*
Cast
(
AudioOutput
*
ao
)
{
...
...
src/storage/CompositeStorage.cxx
View file @
ba69ade0
...
@@ -137,7 +137,7 @@ CompositeStorage::Directory::Make(const char *uri)
...
@@ -137,7 +137,7 @@ CompositeStorage::Directory::Make(const char *uri)
Directory
*
directory
=
this
;
Directory
*
directory
=
this
;
while
(
*
uri
!=
0
)
{
while
(
*
uri
!=
0
)
{
const
std
::
string
name
=
NextSegment
(
uri
);
const
std
::
string
name
=
NextSegment
(
uri
);
#if
defined(__clang__) || GCC_CHECK
_VERSION(4,8)
#if
CLANG_OR_GCC
_VERSION(4,8)
auto
i
=
directory
->
children
.
emplace
(
std
::
move
(
name
),
auto
i
=
directory
->
children
.
emplace
(
std
::
move
(
name
),
Directory
());
Directory
());
#else
#else
...
...
src/tag/Set.cxx
View file @
ba69ade0
...
@@ -75,7 +75,7 @@ TagSet::InsertUnique(const Tag &src, TagType type, const char *value,
...
@@ -75,7 +75,7 @@ TagSet::InsertUnique(const Tag &src, TagType type, const char *value,
else
else
builder
.
AddItem
(
type
,
value
);
builder
.
AddItem
(
type
,
value
);
CopyTagMask
(
builder
,
src
,
group_mask
);
CopyTagMask
(
builder
,
src
,
group_mask
);
#if
defined(__clang__) || GCC_CHECK
_VERSION(4,8)
#if
CLANG_OR_GCC
_VERSION(4,8)
emplace
(
builder
.
Commit
());
emplace
(
builder
.
Commit
());
#else
#else
insert
(
builder
.
Commit
());
insert
(
builder
.
Commit
());
...
...
src/tag/TagPool.cxx
View file @
ba69ade0
...
@@ -91,7 +91,7 @@ calc_hash(TagType type, const char *p)
...
@@ -91,7 +91,7 @@ calc_hash(TagType type, const char *p)
return
hash
^
type
;
return
hash
^
type
;
}
}
#if
defined(__clang__) || GCC_CHECK
_VERSION(4,7)
#if
CLANG_OR_GCC
_VERSION(4,7)
constexpr
constexpr
#endif
#endif
static
inline
TagPoolSlot
*
static
inline
TagPoolSlot
*
...
...
src/util/Cast.hxx
View file @
ba69ade0
...
@@ -84,7 +84,7 @@ ContainerAttributeOffset(const A C::*p)
...
@@ -84,7 +84,7 @@ ContainerAttributeOffset(const A C::*p)
* Cast the given pointer to a struct member to its parent structure.
* Cast the given pointer to a struct member to its parent structure.
*/
*/
template
<
class
C
,
class
A
>
template
<
class
C
,
class
A
>
#if
defined(__clang__) || GCC_CHECK
_VERSION(4,7)
#if
CLANG_OR_GCC
_VERSION(4,7)
constexpr
constexpr
#endif
#endif
static
inline
C
&
static
inline
C
&
...
@@ -97,7 +97,7 @@ ContainerCast(A &a, A C::*member)
...
@@ -97,7 +97,7 @@ ContainerCast(A &a, A C::*member)
* Cast the given pointer to a struct member to its parent structure.
* Cast the given pointer to a struct member to its parent structure.
*/
*/
template
<
class
C
,
class
A
>
template
<
class
C
,
class
A
>
#if
defined(__clang__) || GCC_CHECK
_VERSION(4,7)
#if
CLANG_OR_GCC
_VERSION(4,7)
constexpr
constexpr
#endif
#endif
static
inline
const
C
&
static
inline
const
C
&
...
...
src/util/Manual.hxx
View file @
ba69ade0
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
#include <assert.h>
#include <assert.h>
#if
defined(__clang__) || GCC_CHECK
_VERSION(4,7)
#if
CLANG_OR_GCC
_VERSION(4,7)
#pragma GCC diagnostic push
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
#endif
...
@@ -114,7 +114,7 @@ public:
...
@@ -114,7 +114,7 @@ public:
}
}
};
};
#if
defined(__clang__) || GCC_VERSION >= 40700
#if
CLANG_OR_GCC_VERSION(4,7)
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop
#endif
#endif
...
...
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