public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: Avoid gcc inline problems with vararg functions
@ 2012-05-19  7:37 Sven Eckelmann
  2012-05-20  8:55 ` [B.A.T.M.A.N.] [PATCHv2] batman-adv: Remove batadv_ vararg inline functions Sven Eckelmann
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Eckelmann @ 2012-05-19  7:37 UTC (permalink / raw)
  To: b.a.t.m.a.n

gcc doesn't support the inlining of functions using vararg. Sparse fails to
build the source when having such functions marked using the keyword "inline".

This problem was introduced in 3b896e321c49e3cbbfd540f537c007db883c3900

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 main.h |   20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/main.h b/main.h
index 977de45..4721c86 100644
--- a/main.h
+++ b/main.h
@@ -196,6 +196,17 @@ static inline void batadv_vdbg(int type, struct bat_priv *bat_priv,
 		batadv_debug_log(bat_priv, fmt, args);
 }
 
+__printf(3, 4)
+static inline void batadv_dbg(int type, struct bat_priv *bat_priv,
+			       const char *fmt, ...)
+{
+	va_list args;
+
+	va_start(args, fmt);
+	batadv_vdbg(type, bat_priv, fmt, args);
+	va_end(args);
+}
+
 #else /* !CONFIG_BATMAN_ADV_DEBUG */
 
 static inline void batadv_vdbg(int type __always_unused,
@@ -205,19 +216,14 @@ static inline void batadv_vdbg(int type __always_unused,
 {
 }
 
-#endif
-
 __printf(3, 4)
 static inline void batadv_dbg(int type, struct bat_priv *bat_priv,
 			       const char *fmt, ...)
 {
-	va_list args;
-
-	va_start(args, fmt);
-	batadv_vdbg(type, bat_priv, fmt, args);
-	va_end(args);
 }
 
+#endif
+
 #define batadv_info(net_dev, fmt, arg...)				\
 	do {								\
 		struct net_device *_netdev = (net_dev);                 \
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [B.A.T.M.A.N.] [PATCHv2] batman-adv: Remove batadv_ vararg inline functions
  2012-05-19  7:37 [B.A.T.M.A.N.] [PATCH] batman-adv: Avoid gcc inline problems with vararg functions Sven Eckelmann
@ 2012-05-20  8:55 ` Sven Eckelmann
  2012-05-22  4:43   ` Marek Lindner
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Eckelmann @ 2012-05-20  8:55 UTC (permalink / raw)
  To: b.a.t.m.a.n

gcc doesn't support the inlining of functions using vararg. Sparse fails to
build the source when having such functions marked using the keyword "inline".

This problem was introduced in 3b896e321c49e3cbbfd540f537c007db883c3900

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
I've decided that we should it revert for now and hope for a better solution in
the future. The old patch didn't worked at all for .._DEBUG=y all builds.

 bat_debugfs.c |    5 ++++-
 main.h        |   39 +++++++++++++--------------------------
 2 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/bat_debugfs.c b/bat_debugfs.c
index c3f7e2f..87349f4 100644
--- a/bat_debugfs.c
+++ b/bat_debugfs.c
@@ -74,13 +74,16 @@ static int batadv_fdebug_log(struct debug_log *debug_log, const char *fmt, ...)
 	return 0;
 }
 
-int batadv_debug_log(struct bat_priv *bat_priv, const char *fmt, va_list args)
+int batadv_debug_log(struct bat_priv *bat_priv, const char *fmt, ...)
 {
+	va_list args;
 	char tmp_log_buf[256];
 
+	va_start(args, fmt);
 	vscnprintf(tmp_log_buf, sizeof(tmp_log_buf), fmt, args);
 	batadv_fdebug_log(bat_priv->debug_log, "[%10u] %s",
 			  jiffies_to_msecs(jiffies), tmp_log_buf);
+	va_end(args);
 
 	return 0;
 }
diff --git a/main.h b/main.h
index 977de45..b850eeb 100644
--- a/main.h
+++ b/main.h
@@ -187,36 +187,23 @@ int batadv_algo_select(struct bat_priv *bat_priv, char *name);
 int batadv_algo_seq_print_text(struct seq_file *seq, void *offset);
 
 #ifdef CONFIG_BATMAN_ADV_DEBUG
-int batadv_debug_log(struct bat_priv *bat_priv, const char *fmt, va_list args);
-
-static inline void batadv_vdbg(int type, struct bat_priv *bat_priv,
-			       const char *fmt, va_list args)
-{
-	if (atomic_read(&bat_priv->log_level) & type)
-		batadv_debug_log(bat_priv, fmt, args);
-}
-
+int batadv_debug_log(struct bat_priv *bat_priv, const char *fmt, ...)
+__printf(2, 3);
+
+#define batadv_dbg(type, bat_priv, fmt, arg...)			\
+	do {							\
+		if (atomic_read(&bat_priv->log_level) & type)	\
+			batadv_debug_log(bat_priv, fmt, ## arg);\
+	}							\
+	while (0)
 #else /* !CONFIG_BATMAN_ADV_DEBUG */
-
-static inline void batadv_vdbg(int type __always_unused,
-			       struct bat_priv *bat_priv __always_unused,
-			       const char *fmt __always_unused,
-			       va_list args __always_unused)
-{
-}
-
-#endif
-
 __printf(3, 4)
-static inline void batadv_dbg(int type, struct bat_priv *bat_priv,
-			       const char *fmt, ...)
+static inline void batadv_dbg(int type __always_unused,
+			      struct bat_priv *bat_priv __always_unused,
+			      const char *fmt __always_unused, ...)
 {
-	va_list args;
-
-	va_start(args, fmt);
-	batadv_vdbg(type, bat_priv, fmt, args);
-	va_end(args);
 }
+#endif
 
 #define batadv_info(net_dev, fmt, arg...)				\
 	do {								\
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCHv2] batman-adv: Remove batadv_ vararg inline functions
  2012-05-20  8:55 ` [B.A.T.M.A.N.] [PATCHv2] batman-adv: Remove batadv_ vararg inline functions Sven Eckelmann
@ 2012-05-22  4:43   ` Marek Lindner
  0 siblings, 0 replies; 3+ messages in thread
From: Marek Lindner @ 2012-05-22  4:43 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Sunday, May 20, 2012 16:55:38 Sven Eckelmann wrote:
> gcc doesn't support the inlining of functions using vararg. Sparse fails to
> build the source when having such functions marked using the keyword
> "inline".
> 
> This problem was introduced in 3b896e321c49e3cbbfd540f537c007db883c3900
> 
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
> I've decided that we should it revert for now and hope for a better
> solution in the future. The old patch didn't worked at all for .._DEBUG=y
> all builds.
> 
>  bat_debugfs.c |    5 ++++-
>  main.h        |   39 +++++++++++++--------------------------
>  2 files changed, 17 insertions(+), 27 deletions(-)

Applied in revision dfacdc0.

Thanks,
Marek

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-22  4:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-19  7:37 [B.A.T.M.A.N.] [PATCH] batman-adv: Avoid gcc inline problems with vararg functions Sven Eckelmann
2012-05-20  8:55 ` [B.A.T.M.A.N.] [PATCHv2] batman-adv: Remove batadv_ vararg inline functions Sven Eckelmann
2012-05-22  4:43   ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox