Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
code
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ReadMailReallyFast
code
Commits
4e82034d
Verified
Commit
4e82034d
authored
4 years ago
by
Benny Baumann
Browse files
Options
Downloads
Patches
Plain Diff
chg: Use attribute macros from central location
parent
0f5c758c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/macros.hpp
+22
-1
22 additions, 1 deletion
src/macros.hpp
src/net/tcp_server_socket.cpp
+9
-7
9 additions, 7 deletions
src/net/tcp_server_socket.cpp
with
31 additions
and
8 deletions
src/macros.hpp
+
22
−
1
View file @
4e82034d
#pragma once
#ifdef __GNUC__
#define ATTR_NONNULL_ALL __attribute__((nonnull))
#define ATTR_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
...
...
@@ -7,8 +9,27 @@
#define ATTR_STRFTIME(fmtpos) __attribute__(( format(strftime, (fmtpos), 0 ) ))
#define ATTR_PACKED __attribute__((packed))
#define ATTR_UNUSED __attribute__((unused))
#define ATTR_WEAK __attribute__((weak))
#define ATTR_LIKELY(x) __builtin_expect((x), 1)
#define ATTR_UNLIKELY(x) __builtin_expect((x), 0)
#else
#define ATTR_NONNULL_ALL
#define ATTR_NONNULL(...)
#define ATTR_PRINTF(fmtpos, argpos)
#define ATTR_STRFTIME(fmtpos)
#define ATTR_PACKED
#define ATTR_UNUSED
#define ATTR_WEAK
#define ATTR_LIKELY(x) (x)
#define ATTR_UNLIKELY(x) (x)
#endif
#define MARK_UNUSED(x) (void)(x)
This diff is collapsed.
Click to expand it.
src/net/tcp_server_socket.cpp
+
9
−
7
View file @
4e82034d
...
...
@@ -18,6 +18,9 @@
#include
<sys/stat.h>
#include
<netinet/in.h>
#include
"macros.hpp"
namespace
rmrf
::
net
{
tcp_server_socket
::
tcp_server_socket
(
uint16_t
port
,
incoming_client_listener_type
client_listener_
)
:
...
...
@@ -54,13 +57,10 @@ tcp_server_socket::tcp_server_socket(uint16_t port, incoming_client_listener_typ
// As we're not depending on the actual async server object we need to suppress the warning that we're not using it.
#ifdef __GNUC__
#define UNUSED __attribute__ ((unused))
#else
#define UNUSED
#endif
void
tcp_server_socket
::
await_raw_socket_incomming
(
async_server_socket
::
self_ptr_type
ass
UNUSED
,
const
auto_fd
&
socket
)
{
void
tcp_server_socket
::
await_raw_socket_incomming
(
async_server_socket
::
self_ptr_type
ass
,
const
auto_fd
&
socket
)
{
MARK_UNUSED
(
ass
);
struct
sockaddr_in
client_addr
;
socklen_t
client_len
=
sizeof
(
client_addr
);
int
client_fd_raw
=
accept
(
socket
.
get
(),
(
struct
sockaddr
*
)
&
client_addr
,
&
client_len
);
...
...
@@ -84,7 +84,9 @@ int tcp_server_socket::get_number_of_connected_clients() {
return
this
->
number_of_connected_clients
;
}
void
tcp_server_socket
::
client_destructed_cb
(
tcp_client
::
exit_status
exit_status
UNUSED
)
{
void
tcp_server_socket
::
client_destructed_cb
(
tcp_client
::
exit_status
exit_status
)
{
MARK_UNUSED
(
exit_status
);
this
->
number_of_connected_clients
--
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment