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
6cdb3ff2
Commit
6cdb3ff2
authored
Feb 08, 2021
by
Max Kellermann
Committed by
Max Kellermann
Feb 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use [[gnu::pure]] instead of gcc_pure
This is semi-standard and doesn't require the util/Compiler.h header.
parent
01af2778
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
61 additions
and
80 deletions
+61
-80
FileDescriptor.hxx
src/io/FileDescriptor.hxx
+7
-9
AddressInfo.cxx
src/net/AddressInfo.cxx
+1
-1
AddressInfo.hxx
src/net/AddressInfo.hxx
+2
-3
AllocatedSocketAddress.cxx
src/net/AllocatedSocketAddress.cxx
+1
-1
AllocatedSocketAddress.hxx
src/net/AllocatedSocketAddress.hxx
+7
-8
HostParser.hxx
src/net/HostParser.hxx
+1
-2
IPv6Address.hxx
src/net/IPv6Address.hxx
+3
-4
SocketAddress.cxx
src/net/SocketAddress.cxx
+1
-1
SocketAddress.hxx
src/net/SocketAddress.hxx
+9
-10
SocketDescriptor.hxx
src/net/SocketDescriptor.hxx
+6
-6
SocketError.hxx
src/net/SocketError.hxx
+5
-6
StaticSocketAddress.hxx
src/net/StaticSocketAddress.hxx
+4
-5
Error.hxx
src/system/Error.hxx
+4
-6
KernelVersion.cxx
src/system/KernelVersion.cxx
+1
-1
KernelVersion.hxx
src/system/KernelVersion.hxx
+1
-3
ClockCache.hxx
src/time/ClockCache.hxx
+1
-1
Convert.cxx
src/time/Convert.cxx
+1
-1
Convert.hxx
src/time/Convert.hxx
+3
-5
ISO8601.hxx
src/time/ISO8601.hxx
+2
-4
Math.hxx
src/time/Math.hxx
+1
-3
No files found.
src/io/FileDescriptor.hxx
View file @
6cdb3ff2
...
...
@@ -30,8 +30,6 @@
#ifndef FILE_DESCRIPTOR_HXX
#define FILE_DESCRIPTOR_HXX
#include "util/Compiler.h"
#include <cstddef>
#include <utility>
...
...
@@ -76,25 +74,25 @@ public:
/**
* Ask the kernel whether this is a valid file descriptor.
*/
gcc_pure
[[
gnu
::
pure
]]
bool
IsValid
()
const
noexcept
;
/**
* Ask the kernel whether this is a regular file.
*/
gcc_pure
[[
gnu
::
pure
]]
bool
IsRegularFile
()
const
noexcept
;
/**
* Ask the kernel whether this is a pipe.
*/
gcc_pure
[[
gnu
::
pure
]]
bool
IsPipe
()
const
noexcept
;
/**
* Ask the kernel whether this is a socket descriptor.
*/
gcc_pure
[[
gnu
::
pure
]]
bool
IsSocket
()
const
noexcept
;
#endif
...
...
@@ -219,7 +217,7 @@ public:
return
lseek
(
Get
(),
offset
,
SEEK_CUR
);
}
gcc_pure
[[
gnu
::
pure
]]
off_t
Tell
()
const
noexcept
{
return
lseek
(
Get
(),
0
,
SEEK_CUR
);
}
...
...
@@ -227,7 +225,7 @@ public:
/**
* Returns the size of the file in bytes, or -1 on error.
*/
gcc_pure
[[
gnu
::
pure
]]
off_t
GetSize
()
const
noexcept
;
ssize_t
Read
(
void
*
buffer
,
std
::
size_t
length
)
noexcept
{
...
...
@@ -256,7 +254,7 @@ public:
int
WaitReadable
(
int
timeout
)
const
noexcept
;
int
WaitWritable
(
int
timeout
)
const
noexcept
;
gcc_pure
[[
gnu
::
pure
]]
bool
IsReadyForWriting
()
const
noexcept
;
#endif
};
...
...
src/net/AddressInfo.cxx
View file @
6cdb3ff2
/*
* Copyright 2016-20
19
Max Kellermann <max.kellermann@gmail.com>
* Copyright 2016-20
21
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
...
...
src/net/AddressInfo.hxx
View file @
6cdb3ff2
/*
* Copyright 2016-202
0
Max Kellermann <max.kellermann@gmail.com>
* Copyright 2016-202
1
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
...
...
@@ -31,7 +31,6 @@
#define NET_ADDRESS_INFO_HXX
#include "SocketAddress.hxx"
#include "util/Compiler.h"
#include <utility>
...
...
@@ -109,7 +108,7 @@ public:
* to an IPv6 wildcard address also allows accepting IPv4
* connections.
*/
gcc_pure
[[
gnu
::
pure
]]
const
AddressInfo
&
GetBest
()
const
;
class
const_iterator
{
...
...
src/net/AllocatedSocketAddress.cxx
View file @
6cdb3ff2
/*
* Copyright 2012-20
19
Max Kellermann <max.kellermann@gmail.com>
* Copyright 2012-20
21
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
...
...
src/net/AllocatedSocketAddress.hxx
View file @
6cdb3ff2
/*
* Copyright 2012-202
0
Max Kellermann <max.kellermann@gmail.com>
* Copyright 2012-202
1
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
...
...
@@ -32,7 +32,6 @@
#include "SocketAddress.hxx" // IWYU pragma: export
#include "Features.hxx"
#include "util/Compiler.h"
#include <utility>
...
...
@@ -87,18 +86,18 @@ public:
}
template
<
typename
T
>
gcc_pure
[[
gnu
::
pure
]]
bool
operator
==
(
T
&&
other
)
const
noexcept
{
return
(
SocketAddress
)
*
this
==
std
::
forward
<
T
>
(
other
);
}
template
<
typename
T
>
gcc_pure
[[
gnu
::
pure
]]
bool
operator
!=
(
T
&&
other
)
const
noexcept
{
return
!
(
*
this
==
std
::
forward
<
T
>
(
other
));
}
gcc_const
[[
gnu
::
const
]]
static
AllocatedSocketAddress
Null
()
noexcept
{
return
AllocatedSocketAddress
(
nullptr
,
0
);
}
...
...
@@ -145,13 +144,13 @@ public:
/**
* @see SocketAddress::GetLocalRaw()
*/
gcc_pure
[[
gnu
::
pure
]]
StringView
GetLocalRaw
()
const
noexcept
;
/**
* @see SocketAddress::GetLocalPath()
*/
gcc_pure
[[
gnu
::
pure
]]
const
char
*
GetLocalPath
()
const
noexcept
{
return
((
SocketAddress
)
*
this
).
GetLocalPath
();
}
...
...
@@ -176,7 +175,7 @@ public:
/**
* Extract the port number. Returns 0 if not applicable.
*/
gcc_pure
[[
gnu
::
pure
]]
unsigned
GetPort
()
const
noexcept
{
return
((
SocketAddress
)
*
this
).
GetPort
();
}
...
...
src/net/HostParser.hxx
View file @
6cdb3ff2
...
...
@@ -34,7 +34,6 @@
#define NET_HOST_PARSER_HXX
#include "util/StringView.hxx"
#include "util/Compiler.h"
/**
* Result type for ExtractHost().
...
...
@@ -69,7 +68,7 @@ struct ExtractHostResult {
*
* @param src the input string
*/
gcc_pure
[[
gnu
::
pure
]]
ExtractHostResult
ExtractHost
(
const
char
*
src
)
noexcept
;
...
...
src/net/IPv6Address.hxx
View file @
6cdb3ff2
...
...
@@ -32,7 +32,6 @@
#include "SocketAddress.hxx"
#include "util/ByteOrder.hxx"
#include "util/Compiler.h"
#include <cstdint>
...
...
@@ -179,7 +178,7 @@ public:
/**
* Is this the IPv6 wildcard address (in6addr_any)?
*/
gcc_pure
[[
gnu
::
pure
]]
bool
IsAny
()
const
noexcept
;
/**
...
...
@@ -195,14 +194,14 @@ public:
/**
* Convert "::ffff:127.0.0.1" to "127.0.0.1".
*/
gcc_pure
[[
gnu
::
pure
]]
IPv4Address
UnmapV4
()
const
noexcept
;
/**
* Bit-wise AND of two addresses. This is useful for netmask
* calculations.
*/
gcc_pure
[[
gnu
::
pure
]]
IPv6Address
operator
&
(
const
IPv6Address
&
other
)
const
;
private
:
...
...
src/net/SocketAddress.cxx
View file @
6cdb3ff2
/*
* Copyright 2012-202
0
Max Kellermann <max.kellermann@gmail.com>
* Copyright 2012-202
1
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
...
...
src/net/SocketAddress.hxx
View file @
6cdb3ff2
/*
* Copyright 2012-202
0
Max Kellermann <max.kellermann@gmail.com>
* Copyright 2012-202
1
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
...
...
@@ -31,7 +31,6 @@
#define SOCKET_ADDRESS_HXX
#include "Features.hxx"
#include "util/Compiler.h"
#include <cstddef>
...
...
@@ -118,14 +117,14 @@ public:
* "size" attribute includes the null terminator. Returns
* nullptr if not applicable.
*/
gcc_pure
[[
gnu
::
pure
]]
StringView
GetLocalRaw
()
const
noexcept
;
/**
* Returns the local socket path or nullptr if not applicable
* (or if the path is corrupt).
*/
gcc_pure
[[
gnu
::
pure
]]
const
char
*
GetLocalPath
()
const
noexcept
;
#endif
...
...
@@ -133,25 +132,25 @@ public:
/**
* Is this the IPv6 wildcard address (in6addr_any)?
*/
gcc_pure
[[
gnu
::
pure
]]
bool
IsV6Any
()
const
noexcept
;
/**
* Is this an IPv4 address mapped inside struct sockaddr_in6?
*/
gcc_pure
[[
gnu
::
pure
]]
bool
IsV4Mapped
()
const
noexcept
;
/**
* Convert "::ffff:127.0.0.1" to "127.0.0.1".
*/
gcc_pure
[[
gnu
::
pure
]]
IPv4Address
UnmapV4
()
const
noexcept
;
/**
* Extract the port number. Returns 0 if not applicable.
*/
gcc_pure
[[
gnu
::
pure
]]
unsigned
GetPort
()
const
noexcept
;
#endif
...
...
@@ -162,10 +161,10 @@ public:
* much for anything else. Returns nullptr if the address is
* not supported.
*/
gcc_pure
[[
gnu
::
pure
]]
ConstBuffer
<
void
>
GetSteadyPart
()
const
noexcept
;
gcc_pure
[[
gnu
::
pure
]]
bool
operator
==
(
const
SocketAddress
other
)
const
noexcept
;
bool
operator
!=
(
const
SocketAddress
other
)
const
noexcept
{
...
...
src/net/SocketDescriptor.hxx
View file @
6cdb3ff2
/*
* Copyright 2012-20
19
Max Kellermann <max.kellermann@gmail.com>
* Copyright 2012-20
21
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
...
...
@@ -90,13 +90,13 @@ public:
* Determine the socket type, i.e. SOCK_STREAM, SOCK_DGRAM or
* SOCK_SEQPACKET. Returns -1 on error.
*/
gcc_pure
[[
gnu
::
pure
]]
int
GetType
()
const
noexcept
;
/**
* Is this a stream socket?
*/
gcc_pure
[[
gnu
::
pure
]]
bool
IsStream
()
const
noexcept
;
using
FileDescriptor
::
Get
;
...
...
@@ -167,7 +167,7 @@ public:
* Receive peer credentials (SO_PEERCRED). On error, the pid
* is -1.
*/
gcc_pure
[[
gnu
::
pure
]]
struct
ucred
GetPeerCredentials
()
const
noexcept
;
#endif
...
...
@@ -226,10 +226,10 @@ public:
bool
Connect
(
SocketAddress
address
)
noexcept
;
gcc_pure
[[
gnu
::
pure
]]
StaticSocketAddress
GetLocalAddress
()
const
noexcept
;
gcc_pure
[[
gnu
::
pure
]]
StaticSocketAddress
GetPeerAddress
()
const
noexcept
;
ssize_t
Read
(
void
*
buffer
,
size_t
length
)
noexcept
;
...
...
src/net/SocketError.hxx
View file @
6cdb3ff2
...
...
@@ -30,7 +30,6 @@
#ifndef SOCKET_ERROR_HXX
#define SOCKET_ERROR_HXX
#include "util/Compiler.h"
#include "system/Error.hxx"
#ifdef _WIN32
...
...
@@ -41,7 +40,7 @@ typedef DWORD socket_error_t;
typedef
int
socket_error_t
;
#endif
gcc_pure
[[
gnu
::
pure
]]
static
inline
socket_error_t
GetSocketError
()
noexcept
{
...
...
@@ -128,7 +127,7 @@ IsSocketErrorAcceptWouldBlock(socket_error_t code) noexcept
#endif
}
gcc_const
[[
gnu
::
const
]]
static
inline
bool
IsSocketErrorInterruped
(
socket_error_t
code
)
noexcept
{
...
...
@@ -139,7 +138,7 @@ IsSocketErrorInterruped(socket_error_t code) noexcept
#endif
}
gcc_const
[[
gnu
::
const
]]
static
inline
bool
IsSocketErrorClosed
(
socket_error_t
code
)
noexcept
{
...
...
@@ -171,7 +170,7 @@ public:
}
};
gcc_const
[[
gnu
::
const
]]
static
inline
std
::
system_error
MakeSocketError
(
socket_error_t
code
,
const
char
*
msg
)
noexcept
{
...
...
@@ -182,7 +181,7 @@ MakeSocketError(socket_error_t code, const char *msg) noexcept
#endif
}
gcc_pure
[[
gnu
::
pure
]]
static
inline
std
::
system_error
MakeSocketError
(
const
char
*
msg
)
noexcept
{
...
...
src/net/StaticSocketAddress.hxx
View file @
6cdb3ff2
/*
* Copyright 2012-202
0
Max Kellermann <max.kellermann@gmail.com>
* Copyright 2012-202
1
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
...
...
@@ -32,7 +32,6 @@
#include "SocketAddress.hxx" // IWYU pragma: export
#include "Features.hxx"
#include "util/Compiler.h"
#include <cassert>
...
...
@@ -120,7 +119,7 @@ public:
/**
* @see SocketAddress::GetLocalRaw()
*/
gcc_pure
[[
gnu
::
pure
]]
StringView
GetLocalRaw
()
const
noexcept
;
#endif
...
...
@@ -128,7 +127,7 @@ public:
/**
* Extract the port number. Returns 0 if not applicable.
*/
gcc_pure
[[
gnu
::
pure
]]
unsigned
GetPort
()
const
noexcept
{
return
((
SocketAddress
)
*
this
).
GetPort
();
}
...
...
@@ -140,7 +139,7 @@ public:
bool
SetPort
(
unsigned
port
)
noexcept
;
#endif
gcc_pure
[[
gnu
::
pure
]]
bool
operator
==
(
SocketAddress
other
)
const
noexcept
{
return
(
SocketAddress
)
*
this
==
other
;
}
...
...
src/system/Error.hxx
View file @
6cdb3ff2
...
...
@@ -30,8 +30,6 @@
#ifndef SYSTEM_ERROR_HXX
#define SYSTEM_ERROR_HXX
#include "util/Compiler.h"
#include <system_error> // IWYU pragma: export
#include <utility>
...
...
@@ -160,7 +158,7 @@ FormatFileNotFound(const char *fmt, Args&&... args) noexcept
#endif
}
gcc_pure
[[
gnu
::
pure
]]
inline
bool
IsErrno
(
const
std
::
system_error
&
e
,
int
code
)
noexcept
{
...
...
@@ -168,7 +166,7 @@ IsErrno(const std::system_error &e, int code) noexcept
e
.
code
().
value
()
==
code
;
}
gcc_pure
[[
gnu
::
pure
]]
static
inline
bool
IsFileNotFound
(
const
std
::
system_error
&
e
)
noexcept
{
...
...
@@ -180,7 +178,7 @@ IsFileNotFound(const std::system_error &e) noexcept
#endif
}
gcc_pure
[[
gnu
::
pure
]]
static
inline
bool
IsPathNotFound
(
const
std
::
system_error
&
e
)
noexcept
{
...
...
@@ -192,7 +190,7 @@ IsPathNotFound(const std::system_error &e) noexcept
#endif
}
gcc_pure
[[
gnu
::
pure
]]
static
inline
bool
IsAccessDenied
(
const
std
::
system_error
&
e
)
noexcept
{
...
...
src/system/KernelVersion.cxx
View file @
6cdb3ff2
...
...
@@ -35,7 +35,7 @@
#include <sys/utsname.h>
#include <stdio.h>
gcc_const
[[
gnu
::
const
]]
static
KernelVersionCode
GetKernelVersionCode
()
noexcept
{
...
...
src/system/KernelVersion.hxx
View file @
6cdb3ff2
...
...
@@ -32,8 +32,6 @@
#pragma once
#include "util/Compiler.h"
class
KernelVersionCode
{
unsigned
value
=
0
;
...
...
@@ -53,6 +51,6 @@ public:
/**
* Is the currently running Linux kernel at least the given version?
*/
gcc_const
[[
gnu
::
const
]]
bool
IsKernelVersionOrNewer
(
KernelVersionCode
v
)
noexcept
;
src/time/ClockCache.hxx
View file @
6cdb3ff2
...
...
@@ -47,7 +47,7 @@ public:
ClockCache
(
const
ClockCache
&
)
=
delete
;
ClockCache
&
operator
=
(
const
ClockCache
&
)
=
delete
;
gcc_pure
[[
gnu
::
pure
]]
const
auto
&
now
()
const
noexcept
{
if
(
value
<=
value_type
())
value
=
Clock
::
now
();
...
...
src/time/Convert.cxx
View file @
6cdb3ff2
...
...
@@ -72,7 +72,7 @@ LocalTime(std::chrono::system_clock::time_point tp)
/**
* Determine the time zone offset in a portable way.
*/
gcc_const
[[
gnu
::
const
]]
static
time_t
GetTimeZoneOffset
()
noexcept
{
...
...
src/time/Convert.hxx
View file @
6cdb3ff2
...
...
@@ -33,8 +33,6 @@
#ifndef TIME_CONVERT_HXX
#define TIME_CONVERT_HXX
#include "util/Compiler.h"
#include <chrono>
/**
...
...
@@ -56,18 +54,18 @@ LocalTime(std::chrono::system_clock::time_point tp);
/**
* Convert a UTC-based "struct tm" to a UTC-based time point.
*/
gcc_pure
[[
gnu
::
pure
]]
std
::
chrono
::
system_clock
::
time_point
TimeGm
(
struct
tm
&
tm
)
noexcept
;
/**
* Convert a local "struct tm" to a UTC-based time point.
*/
gcc_pure
[[
gnu
::
pure
]]
std
::
chrono
::
system_clock
::
time_point
MakeTime
(
struct
tm
&
tm
)
noexcept
;
gcc_pure
[[
gnu
::
pure
]]
std
::
chrono
::
steady_clock
::
duration
ToSteadyClockDuration
(
const
struct
timeval
&
tv
)
noexcept
;
...
...
src/time/ISO8601.hxx
View file @
6cdb3ff2
...
...
@@ -33,8 +33,6 @@
#ifndef TIME_ISO8601_HXX
#define TIME_ISO8601_HXX
#include "util/Compiler.h"
#include <chrono>
#include <cstddef>
#include <utility>
...
...
@@ -42,11 +40,11 @@
struct
tm
;
template
<
size_t
CAPACITY
>
class
StringBuffer
;
gcc_pure
[[
gnu
::
pure
]]
StringBuffer
<
64
>
FormatISO8601
(
const
struct
tm
&
tm
)
noexcept
;
gcc_pure
[[
gnu
::
pure
]]
StringBuffer
<
64
>
FormatISO8601
(
std
::
chrono
::
system_clock
::
time_point
tp
);
...
...
src/time/Math.hxx
View file @
6cdb3ff2
...
...
@@ -32,8 +32,6 @@
#pragma once
#include "util/Compiler.h"
#include <chrono>
struct
tm
;
...
...
@@ -42,7 +40,7 @@ struct tm;
* Calculates the preceding midnight time point in the current time
* zone.
*/
gcc_const
[[
gnu
::
const
]]
std
::
chrono
::
system_clock
::
time_point
PrecedingMidnightLocal
(
std
::
chrono
::
system_clock
::
time_point
t
)
noexcept
;
...
...
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