From f252166690f537cdf6853e45a6dc21ed058d0360 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Wed, 15 May 2024 08:11:47 +0200 Subject: Define all function attributes in a centralized header. --- src/common/Makefile.am | 1 + src/common/compiler.h | 38 ++++++++++++++++++++++++++++++++++++++ src/core/logs.c | 3 ++- src/plugins/self.h | 3 +-- 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 src/common/compiler.h diff --git a/src/common/Makefile.am b/src/common/Makefile.am index 9d0885e..af18ab8 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -55,6 +55,7 @@ endif libcommon4_la_SOURCES = \ asm.h asm.c \ bits.h bits.c \ + compiler.h \ extstr.h extstr.c \ pathname.h pathname.c \ xdg.h xdg.c diff --git a/src/common/compiler.h b/src/common/compiler.h new file mode 100644 index 0000000..2585e47 --- /dev/null +++ b/src/common/compiler.h @@ -0,0 +1,38 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * compiler.h - prototypes pour le regroupement d'astuces à destination du compilateur + * + * Copyright (C) 2024 Cyrille Bagard + * + * This file is part of Chrysalide. + * + * Chrysalide is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Chrysalide 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Chrysalide. If not, see . + */ + + +#ifndef _COMMON_COMPILER_H +#define _COMMON_COMPILER_H + + +/** + * Raccourcis d'attributs communs. + */ + +#define __private __attribute__((visibility("hidden"))) + +#define __weak __attribute__((weak)) + + + +#endif /* _COMMON_COMPILER_H */ diff --git a/src/core/logs.c b/src/core/logs.c index 453eaff..8319f4c 100644 --- a/src/core/logs.c +++ b/src/core/logs.c @@ -28,6 +28,7 @@ #include +#include "../common/compiler.h" #include "../common/extstr.h" @@ -42,7 +43,7 @@ static LogMessageType _verbosity = LMT_COUNT; /* Affiche un message dans le terminal courant. */ -__attribute__((weak)) void do_log_message_alt(LogMessageType, const char *); +__weak void do_log_message_alt(LogMessageType, const char *); /* Affiche un message dans le terminal courant. */ static void do_log_message_nox(LogMessageType, const char *); diff --git a/src/plugins/self.h b/src/plugins/self.h index 3c14a0a..4d5ddb0 100644 --- a/src/plugins/self.h +++ b/src/plugins/self.h @@ -29,6 +29,7 @@ #ifndef _PLUGINS_PLUGIN_H # include "plugin.h" #endif +#include "../common/compiler.h" @@ -53,8 +54,6 @@ /* Composants d'interface */ -#define __private __attribute__((visibility("hidden"))) - #define PLUGIN_CORE_SELF \ static GPluginModule *_this_plugin = NULL; \ G_MODULE_EXPORT void chrysalide_plugin_set_self(GPluginModule *p); \ -- cgit v0.11.2-87-g4458