bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Avoid having GNULIB_NAMESPACE::func always inject references


From: Bruno Haible
Subject: Re: [PATCH] Avoid having GNULIB_NAMESPACE::func always inject references to rpl_func
Date: Tue, 22 Nov 2016 00:27:11 +0100
User-agent: KMail/4.8.5 (Linux/3.8.0-44-generic; KDE/4.8.5; x86_64; ; )

Pedro Alves wrote:
> How about breaking this line like the rpl method was breaking it, in order
> to avoid overly-long lines?
> 
>            inline operator type () const
>            { return reinterpret_cast<type>((rettype2 (*) 
> parameters2)(::func)); }
> 
> Likewise the other similar cases.

If line breaking it needed, I prefer the GNU style for functions,
and do it systematically. It takes more vertical space, but it
make is easier to compare the different variants of _gl_ ## func ## _wrapper.

--- a/build-aux/snippet/c++defs.h
+++ b/build-aux/snippet/c++defs.h
@@ -133,7 +133,11 @@
       static const struct _gl_ ## func ## _wrapper            \
       {                                                       \
         typedef rettype (*type) parameters;                   \
-        inline operator type () const { return ::rpl_func; }  \
+                                                              \
+        inline operator type () const                         \
+        {                                                     \
+          return ::rpl_func;                                  \
+        }                                                     \
       } func = {};                                            \
     }                                                         \
     _GL_EXTERN_C int _gl_cxxalias_dummy
@@ -154,7 +158,11 @@
       static const struct _gl_ ## func ## _wrapper                 \
       {                                                            \
         typedef rettype (*type) parameters;                        \
-        inline operator type () const { return 
reinterpret_cast<type>(::rpl_func); } \
+                                                                   \
+        inline operator type () const                              \
+        {                                                          \
+          return reinterpret_cast<type>(::rpl_func);               \
+        }                                                          \
       } func = {};                                                 \
     }                                                              \
     _GL_EXTERN_C int _gl_cxxalias_dummy
@@ -180,7 +188,11 @@
       static const struct _gl_ ## func ## _wrapper            \
       {                                                       \
         typedef rettype (*type) parameters;                   \
-        inline operator type () const { return ::func; }      \
+                                                              \
+        inline operator type () const                         \
+        {                                                     \
+          return ::func;                                      \
+        }                                                     \
       } func = {};                                            \
     }                                                         \
     _GL_EXTERN_C int _gl_cxxalias_dummy
@@ -201,7 +213,11 @@
       static const struct _gl_ ## func ## _wrapper      \
       {                                                 \
         typedef rettype (*type) parameters;             \
-        inline operator type () const { return reinterpret_cast<type>(::func); 
} \
+                                                        \
+        inline operator type () const                   \
+        {                                               \
+          return reinterpret_cast<type>(::func);        \
+        }                                               \
       } func = {};                                      \
     }                                                   \
     _GL_EXTERN_C int _gl_cxxalias_dummy
@@ -228,7 +244,11 @@
       static const struct _gl_ ## func ## _wrapper                            \
       {                                                                       \
         typedef rettype (*type) parameters;                                   \
-        inline operator type () const { return 
reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); } \
+                                                                              \
+        inline operator type () const                                         \
+        {                                                                     \
+          return reinterpret_cast<type>((rettype2 (*) parameters2)(::func));  \
+        }                                                                     \
       } func = {};                                                            \
     }                                                                         \
     _GL_EXTERN_C int _gl_cxxalias_dummy


Pushed with this style change.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]