summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2024-05-15 06:11:47 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2024-05-15 06:11:47 (GMT)
commitf252166690f537cdf6853e45a6dc21ed058d0360 (patch)
treee9b6264f630034135d81e635844e8b2775345cde
parent7358dc2001d27d3c5a0c0fe39288b1a310a6d89e (diff)
Define all function attributes in a centralized header.
-rw-r--r--src/common/Makefile.am1
-rw-r--r--src/common/compiler.h38
-rw-r--r--src/core/logs.c3
-rw-r--r--src/plugins/self.h3
4 files changed, 42 insertions, 3 deletions
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 <http://www.gnu.org/licenses/>.
+ */
+
+
+#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 <string.h>
+#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); \