Re: svn commit: r209578 - head/sys/sys

2010-06-29 Thread Kostik Belousov
On Mon, Jun 28, 2010 at 02:07:02PM -0700, Matthew Fleming wrote:
 On Mon, Jun 28, 2010 at 10:59 AM, Konstantin Belousov k...@freebsd.org 
 wrote:
  Author: kib
  Date: Mon Jun 28 17:59:45 2010
  New Revision: 209578
  URL: http://svn.freebsd.org/changeset/base/209578
 
  Log:
   Use C99 initializers for the struct sysent generated by MAKE_SYSENT().
 
   MFC after:    1 week
 
  Modified:
   head/sys/sys/sysent.h
 
  Modified: head/sys/sys/sysent.h
  ==
  --- head/sys/sys/sysent.h       Mon Jun 28 17:45:00 2010        (r209577)
  +++ head/sys/sys/sysent.h       Mon Jun 28 17:59:45 2010        (r209578)
  @@ -144,10 +144,10 @@ struct syscall_module_data {
 
   #define        MAKE_SYSENT(syscallname)                                \
   static struct sysent syscallname##_sysent = {                  \
  -       (sizeof(struct syscallname ## _args )                   \
  +       .sy_narg = (sizeof(struct syscallname ## _args )        \
             / sizeof(register_t)),                              \
  -       (sy_call_t *) syscallname,                             \
  -       SYS_AUE_##syscallname                                   \
  +       .sy_call = (sy_call_t *) syscallname,                  \
  +       .sy_auevent = SYS_AUE_##syscallname,                    \
   }
 
   #define SYSCALL_MODULE(name, offset, new_sysent, evh, arg)     \
 
 
 This change prevents (I assume) the use of MAKE_SYSENT() in a C++
 kernel module, as C++ does not support the .name = value style of
 named initializers.
 
 gcc does allow name: value initializers and it's easy to patch it to
 accept .name = value, but it's not strictly conforming C++ code
 anymore.
I do not mind reverting this, I think it would be better then
having #ifdef __cplusplus and two definitions. I really wanted to
have a way to provide sparce initializator for the struct sysent.
I managed to not require it for r209579.


pgpWqOcrlYRSc.pgp
Description: PGP signature


Re: svn commit: r209578 - head/sys/sys

2010-06-29 Thread mdf
2010/6/29 Kostik Belousov kostik...@gmail.com:
 On Mon, Jun 28, 2010 at 02:07:02PM -0700, Matthew Fleming wrote:
 On Mon, Jun 28, 2010 at 10:59 AM, Konstantin Belousov k...@freebsd.org 
 wrote:
  Author: kib
  Date: Mon Jun 28 17:59:45 2010
  New Revision: 209578
  URL: http://svn.freebsd.org/changeset/base/209578
 
  Log:
   Use C99 initializers for the struct sysent generated by MAKE_SYSENT().
 
   MFC after:    1 week
 
  Modified:
   head/sys/sys/sysent.h
 
  Modified: head/sys/sys/sysent.h
  ==
  --- head/sys/sys/sysent.h       Mon Jun 28 17:45:00 2010        (r209577)
  +++ head/sys/sys/sysent.h       Mon Jun 28 17:59:45 2010        (r209578)
  @@ -144,10 +144,10 @@ struct syscall_module_data {
 
   #define        MAKE_SYSENT(syscallname)                                \
   static struct sysent syscallname##_sysent = {                  \
  -       (sizeof(struct syscallname ## _args )                   \
  +       .sy_narg = (sizeof(struct syscallname ## _args )        \
             / sizeof(register_t)),                              \
  -       (sy_call_t *) syscallname,                             \
  -       SYS_AUE_##syscallname                                   \
  +       .sy_call = (sy_call_t *) syscallname,                  \
  +       .sy_auevent = SYS_AUE_##syscallname,                    \
   }
 
   #define SYSCALL_MODULE(name, offset, new_sysent, evh, arg)     \
 

 This change prevents (I assume) the use of MAKE_SYSENT() in a C++
 kernel module, as C++ does not support the .name = value style of
 named initializers.

 gcc does allow name: value initializers and it's easy to patch it to
 accept .name = value, but it's not strictly conforming C++ code
 anymore.
 I do not mind reverting this, I think it would be better then
 having #ifdef __cplusplus and two definitions. I really wanted to
 have a way to provide sparce initializator for the struct sysent.
 I managed to not require it for r209579.

I agree it's really handy to have sparse initializers; I just haven't
thought of a way to do that and continue to allow 3rd party c++
modules.  Perhaps we'll get a new c++ standard soon that supports this
syntax. :-)

Thanks,
matthew
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r209578 - head/sys/sys

2010-06-28 Thread Konstantin Belousov
Author: kib
Date: Mon Jun 28 17:59:45 2010
New Revision: 209578
URL: http://svn.freebsd.org/changeset/base/209578

Log:
  Use C99 initializers for the struct sysent generated by MAKE_SYSENT().
  
  MFC after:1 week

Modified:
  head/sys/sys/sysent.h

Modified: head/sys/sys/sysent.h
==
--- head/sys/sys/sysent.h   Mon Jun 28 17:45:00 2010(r209577)
+++ head/sys/sys/sysent.h   Mon Jun 28 17:59:45 2010(r209578)
@@ -144,10 +144,10 @@ struct syscall_module_data {
 
 #defineMAKE_SYSENT(syscallname)\
 static struct sysent syscallname##_sysent = {  \
-   (sizeof(struct syscallname ## _args )   \
+   .sy_narg = (sizeof(struct syscallname ## _args )\
/ sizeof(register_t)),  \
-   (sy_call_t *) syscallname, \
-   SYS_AUE_##syscallname   \
+   .sy_call = (sy_call_t *) syscallname,  \
+   .sy_auevent = SYS_AUE_##syscallname,\
 }
 
 #define SYSCALL_MODULE(name, offset, new_sysent, evh, arg) \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org