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
8f981845
Commit
8f981845
authored
Aug 02, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switch to C++17
Time to move on, two years after 2017.
parent
c764b70b
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
103 additions
and
37 deletions
+103
-37
NEWS
NEWS
+2
-0
developer.rst
doc/developer.rst
+1
-1
meson.build
meson.build
+5
-5
MaskMonitor.hxx
src/event/MaskMonitor.hxx
+1
-1
TimerEvent.hxx
src/event/TimerEvent.hxx
+1
-1
AsyncRequest.hxx
src/lib/dbus/AsyncRequest.hxx
+1
-1
Thread.hxx
src/thread/Thread.hxx
+1
-1
BindMethod.hxx
src/util/BindMethod.hxx
+89
-27
meson.build
test/meson.build
+2
-0
No files found.
NEWS
View file @
8f981845
...
...
@@ -12,6 +12,8 @@ ver 0.22 (not yet released)
- ffmpeg: new plugin based on FFmpeg's libavfilter library
- hdcd: new plugin based on FFmpeg's "af_hdcd" for HDCD playback
- volume: convert S16 to S24 to preserve quality and reduce dithering noise
* switch to C++17
- GCC 7 or clang 4 (or newer) recommended
ver 0.21.12 (2019/08/03)
* decoder
...
...
doc/developer.rst
View file @
8f981845
...
...
@@ -12,7 +12,7 @@ Code Style
* indent with tabs (width 8)
* don't write CPP when you can write C++: use inline functions and constexpr instead of macros
* comment your code, document your APIs
* the code should be C++1
4 compliant, and must compile with :program:`GCC` 6.0 and :program:`clang` 3.
4
* the code should be C++1
7 compliant, and must compile with :program:`GCC` 7 and :program:`clang`
4
* report error conditions with C++ exceptions, preferable derived from :envvar:`std::runtime_error`
* all code must be exception-safe
* classes and functions names use CamelCase; variables are lower-case with words separated by underscore
...
...
meson.build
View file @
8f981845
...
...
@@ -5,7 +5,7 @@ project(
meson_version: '>= 0.49.0',
default_options: [
'c_std=c99',
'cpp_std=c++1
4
'
'cpp_std=c++1
7
'
],
license: 'GPLv2+',
)
...
...
@@ -15,10 +15,10 @@ version_cxx = vcs_tag(input: 'src/GitVersion.cxx', output: 'GitVersion.cxx')
compiler = meson.get_compiler('cpp')
c_compiler = meson.get_compiler('c')
if compiler.get_id() == 'gcc' and compiler.version().version_compare('<
6
')
warning('Your GCC version is too old. You need at least version
6
.')
elif compiler.get_id() == 'clang' and compiler.version().version_compare('<
3
')
warning('Your clang version is too old. You need at least version
3
.')
if compiler.get_id() == 'gcc' and compiler.version().version_compare('<
7
')
warning('Your GCC version is too old. You need at least version
7
.')
elif compiler.get_id() == 'clang' and compiler.version().version_compare('<
4
')
warning('Your clang version is too old. You need at least version
4
.')
endif
conf = configuration_data()
...
...
src/event/MaskMonitor.hxx
View file @
8f981845
...
...
@@ -34,7 +34,7 @@
class
MaskMonitor
final
{
DeferEvent
defer
;
typedef
BoundMethod
<
void
(
unsigned
)
>
Callback
;
typedef
BoundMethod
<
void
(
unsigned
)
noexcept
>
Callback
;
const
Callback
callback
;
std
::
atomic_uint
pending_mask
;
...
...
src/event/TimerEvent.hxx
View file @
8f981845
...
...
@@ -44,7 +44,7 @@ class TimerEvent final {
EventLoop
&
loop
;
typedef
BoundMethod
<
void
()
>
Callback
;
typedef
BoundMethod
<
void
()
noexcept
>
Callback
;
const
Callback
callback
;
/**
...
...
src/lib/dbus/AsyncRequest.hxx
View file @
8f981845
...
...
@@ -49,7 +49,7 @@ namespace ODBus {
class
AsyncRequest
{
PendingCall
pending_call
;
std
::
function
<
void
(
Message
)
noexcept
>
callback
;
std
::
function
<
void
(
Message
)
>
callback
;
public
:
operator
bool
()
const
noexcept
{
...
...
src/thread/Thread.hxx
View file @
8f981845
...
...
@@ -32,7 +32,7 @@
#include <assert.h>
class
Thread
{
typedef
BoundMethod
<
void
()
>
Function
;
typedef
BoundMethod
<
void
()
noexcept
>
Function
;
const
Function
f
;
#ifdef _WIN32
...
...
src/util/BindMethod.hxx
View file @
8f981845
/*
* Copyright
(C) 2016
Max Kellermann <max.kellermann@gmail.com>
* Copyright
2016-2018
Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
...
...
@@ -30,6 +30,8 @@
#ifndef BIND_METHOD_HXX
#define BIND_METHOD_HXX
#include "Compiler.h"
#include <type_traits>
#include <utility>
...
...
@@ -43,9 +45,21 @@
template
<
typename
S
=
void
()
>
class
BoundMethod
;
template
<
typename
R
,
typename
...
Args
>
class
BoundMethod
<
R
(
Args
...)
>
{
typedef
R
(
*
function_pointer
)(
void
*
instance
,
Args
...
args
);
#if GCC_OLDER_THAN(7,0)
static
constexpr
bool
NoExcept
=
false
;
#endif
template
<
typename
R
,
#if !GCC_OLDER_THAN(7,0)
bool
NoExcept
,
#endif
typename
...
Args
>
class
BoundMethod
<
R
(
Args
...)
noexcept
(
NoExcept
)
>
{
typedef
R
(
*
function_pointer
)(
void
*
instance
,
Args
...
args
)
#if !GCC_OLDER_THAN(7,0)
noexcept
(
NoExcept
)
#endif
;
void
*
instance_
;
function_pointer
function
;
...
...
@@ -91,9 +105,21 @@ namespace BindMethodDetail {
template
<
typename
T
,
typename
S
>
struct
MethodWithSignature
;
template
<
typename
T
,
typename
R
,
typename
...
Args
>
struct
MethodWithSignature
<
T
,
R
(
Args
...)
>
{
typedef
R
(
T
::*
method_pointer
)(
Args
...);
template
<
typename
T
,
#if !GCC_OLDER_THAN(7,0)
bool
NoExcept
,
#endif
typename
R
,
typename
...
Args
>
struct
MethodWithSignature
<
T
,
R
(
Args
...)
#if !GCC_OLDER_THAN(7,0)
noexcept
(
NoExcept
)
#endif
>
{
typedef
R
(
T
::*
method_pointer
)(
Args
...)
#if !GCC_OLDER_THAN(7,0)
noexcept
(
NoExcept
)
#endif
;
};
/**
...
...
@@ -104,8 +130,12 @@ struct MethodWithSignature<T, R(Args...)> {
template
<
typename
M
>
struct
MethodSignatureHelper
;
template
<
typename
R
,
typename
T
,
typename
...
Args
>
struct
MethodSignatureHelper
<
R
(
T
::*
)(
Args
...)
>
{
template
<
typename
R
,
#if !GCC_OLDER_THAN(7,0)
bool
NoExcept
,
#endif
typename
T
,
typename
...
Args
>
struct
MethodSignatureHelper
<
R
(
T
::*
)(
Args
...)
noexcept
(
NoExcept
)
>
{
/**
* The class which contains the given method (signature).
*/
...
...
@@ -115,7 +145,11 @@ struct MethodSignatureHelper<R (T::*)(Args...)> {
* A function type which describes the "plain" function
* signature.
*/
typedef
R
plain_signature
(
Args
...);
typedef
R
plain_signature
(
Args
...)
#if !GCC_OLDER_THAN(7,0)
noexcept
(
NoExcept
)
#endif
;
};
/**
...
...
@@ -125,9 +159,17 @@ struct MethodSignatureHelper<R (T::*)(Args...)> {
template
<
typename
S
>
struct
MethodWrapperWithSignature
;
template
<
typename
R
,
typename
...
Args
>
struct
MethodWrapperWithSignature
<
R
(
Args
...)
>
{
typedef
R
(
*
function_pointer
)(
void
*
instance
,
Args
...);
template
<
typename
R
,
#if !GCC_OLDER_THAN(7,0)
bool
NoExcept
,
#endif
typename
...
Args
>
struct
MethodWrapperWithSignature
<
R
(
Args
...)
noexcept
(
NoExcept
)
>
{
typedef
R
(
*
function_pointer
)(
void
*
instance
,
Args
...)
#if !GCC_OLDER_THAN(7,0)
noexcept
(
NoExcept
)
#endif
;
};
/**
...
...
@@ -140,9 +182,9 @@ struct MethodWrapperWithSignature<R(Args...)> {
* @param R the return type
* @param Args the method arguments
*/
template
<
typename
T
,
typename
M
,
M
method
,
typename
R
,
typename
...
Args
>
template
<
typename
T
,
bool
NoExcept
,
typename
M
,
M
method
,
typename
R
,
typename
...
Args
>
struct
BindMethodWrapperGenerator2
{
static
R
Invoke
(
void
*
_instance
,
Args
...
args
)
{
static
R
Invoke
(
void
*
_instance
,
Args
...
args
)
noexcept
(
NoExcept
)
{
auto
&
t
=
*
(
T
*
)
_instance
;
return
(
t
.
*
method
)(
std
::
forward
<
Args
>
(
args
)...);
}
...
...
@@ -159,9 +201,13 @@ struct BindMethodWrapperGenerator2 {
template
<
typename
T
,
typename
M
,
M
method
,
typename
S
>
struct
BindMethodWrapperGenerator
;
template
<
typename
T
,
typename
M
,
M
method
,
typename
R
,
typename
...
Args
>
struct
BindMethodWrapperGenerator
<
T
,
M
,
method
,
R
(
Args
...)
>
:
BindMethodWrapperGenerator2
<
T
,
M
,
method
,
R
,
Args
...
>
{
template
<
typename
T
,
#if !GCC_OLDER_THAN(7,0)
bool
NoExcept
,
#endif
typename
M
,
M
method
,
typename
R
,
typename
...
Args
>
struct
BindMethodWrapperGenerator
<
T
,
M
,
method
,
R
(
Args
...)
noexcept
(
NoExcept
)
>
:
BindMethodWrapperGenerator2
<
T
,
NoExcept
,
M
,
method
,
R
,
Args
...
>
{
};
template
<
typename
T
,
typename
S
,
...
...
@@ -180,19 +226,31 @@ MakeBindMethodWrapper() noexcept
template
<
typename
S
>
struct
FunctionTraits
;
template
<
typename
R
,
typename
...
Args
>
struct
FunctionTraits
<
R
(
Args
...)
>
{
template
<
typename
R
,
#if !GCC_OLDER_THAN(7,0)
bool
NoExcept
,
#endif
typename
...
Args
>
struct
FunctionTraits
<
R
(
Args
...)
noexcept
(
NoExcept
)
>
{
/**
* A function type which describes the "plain" function
* signature.
*/
typedef
R
function_type
(
Args
...);
typedef
R
function_type
(
Args
...)
#if !GCC_OLDER_THAN(7,0)
noexcept
(
NoExcept
)
#endif
;
/**
* A function pointer type which describes the "plain"
* function signature.
*/
typedef
R
(
*
pointer_type
)(
Args
...);
typedef
R
(
*
pointer_type
)(
Args
...)
#if !GCC_OLDER_THAN(7,0)
noexcept
(
NoExcept
)
#endif
;
};
/**
...
...
@@ -205,9 +263,9 @@ struct FunctionTraits<R(Args...)> {
* @param R the return type
* @param Args the function arguments
*/
template
<
typename
F
,
F
function
,
typename
R
,
typename
...
Args
>
template
<
bool
NoExcept
,
typename
F
,
F
function
,
typename
R
,
typename
...
Args
>
struct
BindFunctionWrapperGenerator2
{
static
R
Invoke
(
void
*
,
Args
...
args
)
{
static
R
Invoke
(
void
*
,
Args
...
args
)
noexcept
(
NoExcept
)
{
return
function
(
std
::
forward
<
Args
>
(
args
)...);
}
};
...
...
@@ -222,9 +280,13 @@ struct BindFunctionWrapperGenerator2 {
template
<
typename
S
,
typename
P
,
P
function
>
struct
BindFunctionWrapperGenerator
;
template
<
typename
P
,
P
function
,
typename
R
,
typename
...
Args
>
struct
BindFunctionWrapperGenerator
<
R
(
Args
...),
P
,
function
>
:
BindFunctionWrapperGenerator2
<
P
,
function
,
R
,
Args
...
>
{
template
<
typename
P
,
P
function
,
#if !GCC_OLDER_THAN(7,0)
bool
NoExcept
,
#endif
typename
R
,
typename
...
Args
>
struct
BindFunctionWrapperGenerator
<
R
(
Args
...)
noexcept
(
NoExcept
),
P
,
function
>
:
BindFunctionWrapperGenerator2
<
NoExcept
,
P
,
function
,
R
,
Args
...
>
{
};
template
<
typename
T
,
typename
T
::
pointer_type
function
>
...
...
test/meson.build
View file @
8f981845
...
...
@@ -49,6 +49,8 @@ test('TestUtil', executable(
test('TestRewindInputStream', executable(
'TestRewindInputStream',
'TestRewindInputStream.cxx',
'../src/Log.cxx',
'../src/LogBackend.cxx',
include_directories: inc,
dependencies: [
input_glue_dep,
...
...
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