Reduce C++ symbols visibility

This allows the compiler to do some more optimisations on the
produced binary.
To allows possible future portability include header/footer in
some helper header files.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Frediano Ziglio 2020-03-03 14:47:53 +00:00 committed by Frediano Ziglio
parent bd4b1caeb8
commit 435ea33540
14 changed files with 67 additions and 14 deletions

View File

@ -137,6 +137,8 @@ libserver_la_SOURCES = \
net-utils.h \
pixmap-cache.cpp \
pixmap-cache.h \
pop-visibility.h \
push-visibility.h \
red-channel.cpp \
red-channel-capabilities.c \
red-channel-capabilities.h \

View File

@ -23,7 +23,7 @@
#include "red-channel.h"
#include "red-channel-client.h"
G_BEGIN_DECLS
#include "push-visibility.h"
#define COMMON_CLIENT_TIMEOUT (NSEC_PER_SEC * 30)
@ -77,6 +77,6 @@ protected:
virtual bool config_socket() override;
};
G_END_DECLS
#include "pop-visibility.h"
#endif /* COMMON_GRAPHICS_CHANNEL_H_ */

View File

@ -26,7 +26,7 @@
#include "cursor-channel.h"
#include "utils.hpp"
G_BEGIN_DECLS
#include "push-visibility.h"
struct CursorChannelClientPrivate;
@ -66,6 +66,6 @@ enum {
RED_PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE,
};
G_END_DECLS
#include "pop-visibility.h"
#endif /* CURSOR_CHANNEL_CLIENT_H_ */

View File

@ -25,6 +25,8 @@
#include "video-stream.h"
#include "red-channel-client.h"
#include "push-visibility.h"
struct DisplayChannelClientPrivate
{
SPICE_CXX_GLIB_ALLOCATOR
@ -67,4 +69,6 @@ struct DisplayChannelClientPrivate
bool gl_draw_ongoing;
};
#include "pop-visibility.h"
#endif /* DCC_PRIVATE_H_ */

View File

@ -26,7 +26,7 @@
#include "common-graphics-channel.h"
#include "utils.hpp"
G_BEGIN_DECLS
#include "push-visibility.h"
struct DisplayChannel;
struct DisplayChannelClientPrivate;
@ -197,6 +197,6 @@ gboolean dcc_is_low_bandwidth(DisplayChannelClient *dcc);
GArray *dcc_get_preferred_video_codecs_for_encoding(DisplayChannelClient *dcc);
void dcc_video_codecs_update(DisplayChannelClient *dcc);
G_END_DECLS
#include "pop-visibility.h"
#endif /* DCC_H_ */

View File

@ -21,7 +21,7 @@
#include "red-channel-client.h"
#include "inputs-channel.h"
G_BEGIN_DECLS
#include "push-visibility.h"
class InputsChannelClient final: public RedChannelClient
{
@ -65,7 +65,7 @@ RedChannelClient* inputs_channel_client_create(RedChannel *channel,
RedStream *stream,
RedChannelCapabilities *caps);
G_END_DECLS
#include "pop-visibility.h"
enum {
RED_PIPE_ITEM_INPUTS_INIT = RED_PIPE_ITEM_TYPE_CHANNEL_BASE,

View File

@ -24,7 +24,7 @@
#include "main-channel.h"
#include "utils.hpp"
G_BEGIN_DECLS
#include "push-visibility.h"
struct MainChannelClientPrivate;
@ -123,6 +123,6 @@ RedPipeItem *main_multi_media_time_item_new(uint32_t mm_time);
RedPipeItem *registered_channel_item_new(RedChannel *channel);
G_END_DECLS
#include "pop-visibility.h"
#endif /* MAIN_CHANNEL_CLIENT_H_ */

20
server/pop-visibility.h Normal file
View File

@ -0,0 +1,20 @@
/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
Copyright (C) 2020 Red Hat, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__)
#pragma GCC visibility pop
#endif

20
server/push-visibility.h Normal file
View File

@ -0,0 +1,20 @@
/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
Copyright (C) 2020 Red Hat, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__MINGW32__)
#pragma GCC visibility push(hidden)
#endif

View File

@ -25,7 +25,7 @@
#include "red-channel.h"
#include "utils.hpp"
G_BEGIN_DECLS
#include "push-visibility.h"
struct RedChannelClientPrivate;
@ -224,6 +224,6 @@ enum {
RED_PIPE_ITEM_TYPE_CHANNEL_BASE=101,
};
G_END_DECLS
#include "pop-visibility.h"
#endif /* RED_CHANNEL_CLIENT_H_ */

View File

@ -40,9 +40,11 @@ G_BEGIN_DECLS
SPICE_DECLARE_TYPE(RedChannel, red_channel, CHANNEL);
#define RED_TYPE_CHANNEL red_channel_get_type()
#include "push-visibility.h"
struct RedChannelClient;
struct RedClient;
struct MainChannelClient;
#include "pop-visibility.h"
typedef void (*channel_client_connect_proc)(RedChannel *channel, RedClient *client, RedStream *stream,
int migration, RedChannelCapabilities *caps);

View File

@ -21,7 +21,7 @@
#include "smartcard.h"
#include "utils.hpp"
G_BEGIN_DECLS
#include "push-visibility.h"
struct SmartCardChannelClientPrivate;
@ -64,6 +64,6 @@ void smartcard_channel_client_set_char_device(SmartCardChannelClient *scc,
RedCharDeviceSmartcard* smartcard_channel_client_get_char_device(SmartCardChannelClient *scc);
G_END_DECLS
#include "pop-visibility.h"
#endif /* SMARTCARD_CHANNEL_CLIENT_H_ */

View File

@ -29,6 +29,7 @@
#include "cursor-channel.h"
#include "net-utils.h"
#include "win-alarm.h"
#include "push-visibility.h"
/*
* Declare a RedTestChannel to be used for the test

View File

@ -21,6 +21,8 @@
#include <memory>
#include "push-visibility.h"
namespace red {
@ -93,3 +95,5 @@ constexpr size_t size(const T (&array)[N]) noexcept
} // namespace red
#include "pop-visibility.h"