mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Jens Gustedt <Jens.Gustedt@inria.fr>
To: musl@lists.openwall.com
Subject: [PATCH 4/5] add three macros for empty dummy functions that do nothing
Date: Sat, 16 Feb 2013 00:24:30 +0100	[thread overview]
Message-ID: <f69aec145bafa5df1636274b0703778dfb203ef5.1360968989.git.Jens.Gustedt@inria.fr> (raw)
In-Reply-To: <cover.1360968989.git.Jens.Gustedt@inria.fr>

these are functions that receive arguments according to three different
interfaces, void, void* or int.

31	0	src/internal/libc.h

diff --git a/src/internal/libc.h b/src/internal/libc.h
index a097a66..1f15f4d 100644
--- a/src/internal/libc.h
+++ b/src/internal/libc.h
@@ -73,6 +73,37 @@ extern char **__environ;
 #define weak_alias(old, new) \
 	extern __typeof(old) new __attribute__((weak, alias(#old)))
 
+/* provide a weak function symbol for a function that receives no
+   arguments */
+#define WEAK_PROVIDE_VOID                       \
+_Weak                                           \
+void __weak_dummy_void(void) {                  \
+  /* empty */                                   \
+}                                               \
+/* syntax sugar */                              \
+_Weak void __weak_dummy_void(void)
+
+/* provide a weak function symbol for a function that receives a void
+   pointer argument */
+#define WEAK_PROVIDE_VOIDP                      \
+_Weak                                           \
+void __weak_dummy_voidp(void* _ign) {           \
+  /* empty */                                   \
+}                                               \
+/* syntax sugar */                              \
+_Weak void __weak_dummy_voidp(void*)
+
+/* provide a weak function symbol for a function that receives an int
+   argument */
+#define WEAK_PROVIDE_INT                        \
+_Weak                                           \
+void __weak_dummy_int(int _ign) {               \
+  /* empty */                                   \
+}                                               \
+/* syntax sugar */                              \
+_Weak void __weak_dummy_int(int _ign)
+
+
 #undef LFS64_2
 #define LFS64_2(x, y) weak_alias(x, y)
 
-- 
1.7.9.5



  parent reply	other threads:[~2013-02-15 23:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-15 23:22 [PATCH 0/5] reorganize the use of weak symbols Jens Gustedt
2013-02-15 23:23 ` [PATCH 1/5] Clearly identify the readonly replacement symbols that serve as 'dummies' that could (or could not) be provided by other compilation units Jens Gustedt
2013-02-15 23:23 ` [PATCH 2/5] Clarify the implementation of the dummy alias used for pthread_self Jens Gustedt
2013-02-15 23:24 ` [PATCH 3/5] identify the weak function symbols that provide a real default action Jens Gustedt
2013-02-15 23:24 ` Jens Gustedt [this message]
2013-02-15 23:25 ` [PATCH 5/5] Use the weak functions that do nothing as aliases for the default actions Jens Gustedt
2013-02-16  5:59 ` [PATCH 0/5] reorganize the use of weak symbols Rich Felker
2013-02-16  8:16   ` Jens Gustedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f69aec145bafa5df1636274b0703778dfb203ef5.1360968989.git.Jens.Gustedt@inria.fr \
    --to=jens.gustedt@inria.fr \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).