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

2019-06-13 Thread Dmitry Chagin
Hi, All! thanks for reply,

I will be back in a week and fix it, I am rafting in Eastern Siberia))



чт, 13 июня 2019 г. в 11:43, Tijl Coosemans :

> On Wed, 12 Jun 2019 16:51:03 -0600 Warner Losh  wrote:
> > On Wed, Jun 12, 2019 at 4:49 PM Gleb Smirnoff 
> wrote:
> >> On Mon, Jun 10, 2019 at 11:09:09AM +0200, Tijl Coosemans wrote:
>  Date: Mon Jun 10 05:28:03 2019
>  New Revision: 348847
>  URL: https://svnweb.freebsd.org/changeset/base/348847
> 
>  Log:
>    Use C11 anonymous unions.
> 
>    PR:  215202
>    Reported by: glebius
>    MFC after:   2 weeks
> 
>  Modified:
>    head/sys/sys/ucred.h
> 
>  Modified: head/sys/sys/ucred.h
> 
> 
> ==
>
>  --- head/sys/sys/ucred.h   Mon Jun 10 05:09:34 2019(r348846)
>  +++ head/sys/sys/ucred.h   Mon Jun 10 05:28:03 2019(r348847)
>  @@ -89,12 +89,11 @@ struct xucred {
> gid_t   cr_groups[XU_NGROUPS];  /* groups */
> union {
> void*_cr_unused1;   /* compatibility with old ucred */
>  -  pid_t   _pid;
>  -  } _cr;
>  +  pid_t   cr_pid;
>  +  };
>   };
>   #define   XUCRED_VERSION  0
> 
>  -#define   cr_pid _cr._pid
>   /* This can be used for both ucred and xucred structures. */
>   #define   cr_gid cr_groups[0]
> >>>
> >>> Isn't this a userland header that should work with non-C11 compilers?
> >>
> >> It could make sense to keep such low bar for standard headers, but
> ucred.h
> >> is BSD-specific header and struct xucred is FreeBSD specific.
> >
> > This is solvable with proper visibility, I'd think..
>
> I think "union {" should be replaced with "__extension__ union {".  That
> seems to kill this warning:
>
> /usr/include/sys/ucred.h:90:2: warning: anonymous unions are a C11
> extension
>   [-Wc11-extensions]
> union {
> ^
> 1 warning generated.
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2019-06-13 Thread Tijl Coosemans
On Wed, 12 Jun 2019 16:51:03 -0600 Warner Losh  wrote:
> On Wed, Jun 12, 2019 at 4:49 PM Gleb Smirnoff  wrote:
>> On Mon, Jun 10, 2019 at 11:09:09AM +0200, Tijl Coosemans wrote:  
 Date: Mon Jun 10 05:28:03 2019
 New Revision: 348847
 URL: https://svnweb.freebsd.org/changeset/base/348847

 Log:
   Use C11 anonymous unions.

   PR:  215202
   Reported by: glebius
   MFC after:   2 weeks

 Modified:
   head/sys/sys/ucred.h

 Modified: head/sys/sys/ucred.h
  
 ==
   
 --- head/sys/sys/ucred.h   Mon Jun 10 05:09:34 2019(r348846)
 +++ head/sys/sys/ucred.h   Mon Jun 10 05:28:03 2019(r348847)
 @@ -89,12 +89,11 @@ struct xucred {
gid_t   cr_groups[XU_NGROUPS];  /* groups */
union {
void*_cr_unused1;   /* compatibility with old ucred */
 -  pid_t   _pid;
 -  } _cr;
 +  pid_t   cr_pid;
 +  };
  };
  #define   XUCRED_VERSION  0

 -#define   cr_pid _cr._pid
  /* This can be used for both ucred and xucred structures. */
  #define   cr_gid cr_groups[0]  
>>>
>>> Isn't this a userland header that should work with non-C11 compilers?  
>>
>> It could make sense to keep such low bar for standard headers, but ucred.h
>> is BSD-specific header and struct xucred is FreeBSD specific.
> 
> This is solvable with proper visibility, I'd think..

I think "union {" should be replaced with "__extension__ union {".  That
seems to kill this warning:

/usr/include/sys/ucred.h:90:2: warning: anonymous unions are a C11 extension
  [-Wc11-extensions]
union {
^
1 warning generated.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2019-06-12 Thread Warner Losh
On Wed, Jun 12, 2019 at 4:49 PM Gleb Smirnoff  wrote:

> On Mon, Jun 10, 2019 at 11:09:09AM +0200, Tijl Coosemans wrote:
> T> > Date: Mon Jun 10 05:28:03 2019
> T> > New Revision: 348847
> T> > URL: https://svnweb.freebsd.org/changeset/base/348847
> T> >
> T> > Log:
> T> >   Use C11 anonymous unions.
> T> >
> T> >   PR:  215202
> T> >   Reported by: glebius
> T> >   MFC after:   2 weeks
> T> >
> T> > Modified:
> T> >   head/sys/sys/ucred.h
> T> >
> T> > Modified: head/sys/sys/ucred.h
> T> >
> ==
> T> > --- head/sys/sys/ucred.h   Mon Jun 10 05:09:34 2019(r348846)
> T> > +++ head/sys/sys/ucred.h   Mon Jun 10 05:28:03 2019(r348847)
> T> > @@ -89,12 +89,11 @@ struct xucred {
> T> >gid_t   cr_groups[XU_NGROUPS];  /* groups */
> T> >union {
> T> >void*_cr_unused1;   /* compatibility with old ucred */
> T> > -  pid_t   _pid;
> T> > -  } _cr;
> T> > +  pid_t   cr_pid;
> T> > +  };
> T> >  };
> T> >  #define   XUCRED_VERSION  0
> T> >
> T> > -#define   cr_pid _cr._pid
> T> >  /* This can be used for both ucred and xucred structures. */
> T> >  #define   cr_gid cr_groups[0]
> T>
> T> Isn't this a userland header that should work with non-C11 compilers?
>
> It could make sense to keep such low bar for standard headers, but ucred.h
> is BSD-specific header and struct xucred is FreeBSD specific.
>

This is solvable with proper visibility, I'd think..

Warner
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2019-06-12 Thread Gleb Smirnoff
On Mon, Jun 10, 2019 at 11:09:09AM +0200, Tijl Coosemans wrote:
T> > Date: Mon Jun 10 05:28:03 2019
T> > New Revision: 348847
T> > URL: https://svnweb.freebsd.org/changeset/base/348847
T> > 
T> > Log:
T> >   Use C11 anonymous unions.
T> >   
T> >   PR:  215202
T> >   Reported by: glebius
T> >   MFC after:   2 weeks
T> > 
T> > Modified:
T> >   head/sys/sys/ucred.h
T> > 
T> > Modified: head/sys/sys/ucred.h
T> > 
==
T> > --- head/sys/sys/ucred.h   Mon Jun 10 05:09:34 2019(r348846)
T> > +++ head/sys/sys/ucred.h   Mon Jun 10 05:28:03 2019(r348847)
T> > @@ -89,12 +89,11 @@ struct xucred {
T> >gid_t   cr_groups[XU_NGROUPS];  /* groups */
T> >union {
T> >void*_cr_unused1;   /* compatibility with old ucred */
T> > -  pid_t   _pid;
T> > -  } _cr;
T> > +  pid_t   cr_pid;
T> > +  };
T> >  };
T> >  #define   XUCRED_VERSION  0
T> >  
T> > -#define   cr_pid _cr._pid
T> >  /* This can be used for both ucred and xucred structures. */
T> >  #define   cr_gid cr_groups[0]
T> 
T> Isn't this a userland header that should work with non-C11 compilers?

It could make sense to keep such low bar for standard headers, but ucred.h
is BSD-specific header and struct xucred is FreeBSD specific.

-- 
Gleb Smirnoff
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2019-06-10 Thread Warner Losh
On Mon, Jun 10, 2019 at 10:51 AM Conrad Meyer  wrote:

> On Mon, Jun 10, 2019 at 9:17 AM Bruce Evans  wrote:
> > Only headers and libraries should support -std=c89.   has
> > lots of support for compilers and POSIX versions going back to K&R C,
> > and only the K&R parts are completely broken.
>
> Is this due to specific policy, or just inertia?  (No one has bothered
> to remove the old bits?)  The older parts being totally broken
> suggests sheer inertia.
>

As far as I know, it's been policy because there are a number of ports that
compile with -std=c89, or used to be. I accidentally broke that a long time
ago and had to fix it to unbreak a few ports (but granted, this was a while
ago).

Warner
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2019-06-10 Thread Konstantin Belousov
On Mon, Jun 10, 2019 at 09:28:24AM -0700, Conrad Meyer wrote:
> On Mon, Jun 10, 2019 at 9:17 AM Bruce Evans  wrote:
> > Only headers and libraries should support -std=c89.   has
> > lots of support for compilers and POSIX versions going back to K&R C,
> > and only the K&R parts are completely broken.
> 
> Is this due to specific policy, or just inertia?  (No one has bothered
> to remove the old bits?)  The older parts being totally broken
> suggests sheer inertia.

This is due to very important compiler, not used by FreeBSD, still only
providing c99 features, for instance.  So people who have to write portable
C might force all compilation environment to the common standard.

I personally think that c89 is not very important now, but still should
not be broken without serious cause.  While c99 must be fully supported.
Of course, the statements are limited to user-mode visible portion of
/usr/include/* and libs.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2019-06-10 Thread Conrad Meyer
On Mon, Jun 10, 2019 at 9:17 AM Bruce Evans  wrote:
> Only headers and libraries should support -std=c89.   has
> lots of support for compilers and POSIX versions going back to K&R C,
> and only the K&R parts are completely broken.

Is this due to specific policy, or just inertia?  (No one has bothered
to remove the old bits?)  The older parts being totally broken
suggests sheer inertia.

Best,
Conrad
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2019-06-10 Thread Bruce Evans

On Mon, 10 Jun 2019, Ian Lepore wrote:


On Mon, 2019-06-10 at 07:49 -0600, Warner Losh wrote:

On Mon, Jun 10, 2019, 7:44 AM Conrad Meyer  wrote:


On Mon, Jun 10, 2019 at 2:10 AM T??l Coosemans 
wrote:

On Mon, 10 Jun 2019 05:28:04 + (UTC) Dmitry Chagin
 wrote:

...
URL: https://svnweb.freebsd.org/changeset/base/348847
Log:
  Use C11 anonymous unions.

Modified: head/sys/sys/ucred.h


...

Isn't this a userland header that should work with non-C11
compilers?

...
Why would one expect userland headers to work with non-C11 (gnu89)
compilers?

...
Because those compilers can choose non c11 variants of the language?


Do we promise that userland will compile with -std=c89?  I hope not.


Only headers and libraries should support -std=c89.   has
lots of support for compilers and POSIX versions going back to K&R C,
and only the K&R parts are completely broken.

FreeBSD also has the c89 and c99 utilities.  These require c89 and c99
headers to work under FreeBSD.  c89 uses CFLAGS -std=iso9899:199409
-pedantic.  I don't see how a 1994 standard can be correct for c89,
but -pedantic here might avoid the bug that -std=cxx doesn't actually
gives standard cxx, especially for clang.  c99 uses -std=iso9899:1999
-pedantic.  So anonymous unions are correctly disallowed by both c89
and c99.

At least the following headers still compile with c89: sys/types.h,
stdio.h, stdlib.h, the old version of sys/ucred.h.


Anonymous unions may be a c11 feature, but they're also available with
-std=gnu99, which I think is how we compile userland.


That is only the default, only for for parts of userland controlled by us.
Non-FreeBSD makefiles get at most the POSIX CFLAGS (something like -O)
from sys.mk if they use FreeBSD make, and something similar using gmake.


I think -std=gnu99 is how we should also compile the kernel, and I
think Bruce has been trying to say that for several years (but I'm not
sure, because the emails that seem to say so are always so full of
semi-related extraneous material that it's hard to be sure what they're
saying).


-std can be forced for kernel builds and other pure FreeBSD builds, but
then it should be the correct one.

bsd.sys.mk only directly supports the user selecting the following standards:
- c89 or c90
- c94 or c95 (the c89 utility gives -std=c94, not -std=c89)
- c99
- gnu99 (default)
Newer and more useful old standards like gnu89 are hard to select.  The
user must set the undocumented variable CSTD even to change the default to
c89/90/94/95.  Adding -std=whatever to CFLAGS only works if it happens to
be added after -std=${CSTD}.

Bruce___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2019-06-10 Thread Tijl Coosemans
On Mon, 10 Jun 2019 06:43:26 -0700 Conrad Meyer  wrote:
> On Mon, Jun 10, 2019 at 2:10 AM Tijl Coosemans  wrote:
>> On Mon, 10 Jun 2019 05:28:04 + (UTC) Dmitry Chagin
>>  wrote:
>>> ...
>>> URL: https://svnweb.freebsd.org/changeset/base/348847
>>> Log:
>>>   Use C11 anonymous unions.
>>>
>>> Modified: head/sys/sys/ucred.h
>> ...
>>
>> Isn't this a userland header that should work with non-C11 compilers?
> 
> Why would one expect userland headers to work with non-C11 (gnu89)
> compilers?

I'm thinking of third party software compiled with third party
compilers.  The system headers need to work with various C and C++
standards.  struct xucred is part of a public API documented in unix(4).
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2019-06-10 Thread Ian Lepore
On Mon, 2019-06-10 at 07:49 -0600, Warner Losh wrote:
> On Mon, Jun 10, 2019, 7:44 AM Conrad Meyer  wrote:
> 
> > On Mon, Jun 10, 2019 at 2:10 AM Tijl Coosemans 
> > wrote:
> > > On Mon, 10 Jun 2019 05:28:04 + (UTC) Dmitry Chagin
> > >  wrote:
> > > > ...
> > > > URL: https://svnweb.freebsd.org/changeset/base/348847
> > > > Log:
> > > >   Use C11 anonymous unions.
> > > > 
> > > > Modified: head/sys/sys/ucred.h
> > > 
> > > ...
> > > 
> > > Isn't this a userland header that should work with non-C11
> > > compilers?
> > 
> > Hi Tijl,
> > 
> > Why would one expect userland headers to work with non-C11 (gnu89)
> > compilers?
> > 
> 
> Because those compilers can choose non c11 variants of the language?
> 
> Warner
> 

Do we promise that userland will compile with -std=c89?  I hope not. 
Anonymous unions may be a c11 feature, but they're also available with
-std=gnu99, which I think is how we compile userland.

I think -std=gnu99 is how we should also compile the kernel, and I
think Bruce has been trying to say that for several years (but I'm not
sure, because the emails that seem to say so are always so full of
semi-related extraneous material that it's hard to be sure what they're
saying).

-- Ian


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2019-06-10 Thread Conrad Meyer
Hi Warner,

That doesn't seem responsive to the question.

On Mon, Jun 10, 2019 at 6:49 AM Warner Losh  wrote:
>
>
>
> On Mon, Jun 10, 2019, 7:44 AM Conrad Meyer  wrote:
>>
>> On Mon, Jun 10, 2019 at 2:10 AM Tijl Coosemans  wrote:
>> > On Mon, 10 Jun 2019 05:28:04 + (UTC) Dmitry Chagin
>> >  wrote:
>> > > ...
>> > > URL: https://svnweb.freebsd.org/changeset/base/348847
>> > > Log:
>> > >   Use C11 anonymous unions.
>> > >
>> > > Modified: head/sys/sys/ucred.h
>> > ...
>> >
>> > Isn't this a userland header that should work with non-C11 compilers?
>>
>> Hi Tijl,
>>
>> Why would one expect userland headers to work with non-C11 (gnu89) compilers?
>
>
> Because those compilers can choose non c11 variants of the language?
>
> Warner
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2019-06-10 Thread Warner Losh
On Mon, Jun 10, 2019, 7:44 AM Conrad Meyer  wrote:

> On Mon, Jun 10, 2019 at 2:10 AM Tijl Coosemans  wrote:
> > On Mon, 10 Jun 2019 05:28:04 + (UTC) Dmitry Chagin
> >  wrote:
> > > ...
> > > URL: https://svnweb.freebsd.org/changeset/base/348847
> > > Log:
> > >   Use C11 anonymous unions.
> > >
> > > Modified: head/sys/sys/ucred.h
> > ...
> >
> > Isn't this a userland header that should work with non-C11 compilers?
>
> Hi Tijl,
>
> Why would one expect userland headers to work with non-C11 (gnu89)
> compilers?
>

Because those compilers can choose non c11 variants of the language?

Warner

>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2019-06-10 Thread Conrad Meyer
On Mon, Jun 10, 2019 at 2:10 AM Tijl Coosemans  wrote:
> On Mon, 10 Jun 2019 05:28:04 + (UTC) Dmitry Chagin
>  wrote:
> > ...
> > URL: https://svnweb.freebsd.org/changeset/base/348847
> > Log:
> >   Use C11 anonymous unions.
> >
> > Modified: head/sys/sys/ucred.h
> ...
>
> Isn't this a userland header that should work with non-C11 compilers?

Hi Tijl,

Why would one expect userland headers to work with non-C11 (gnu89) compilers?

Thanks,
Conrad
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2019-06-10 Thread Tijl Coosemans
On Mon, 10 Jun 2019 05:28:04 + (UTC) Dmitry Chagin
 wrote:
> Author: dchagin
> Date: Mon Jun 10 05:28:03 2019
> New Revision: 348847
> URL: https://svnweb.freebsd.org/changeset/base/348847
> 
> Log:
>   Use C11 anonymous unions.
>   
>   PR: 215202
>   Reported by:glebius
>   MFC after:  2 weeks
> 
> Modified:
>   head/sys/sys/ucred.h
> 
> Modified: head/sys/sys/ucred.h
> ==
> --- head/sys/sys/ucred.h  Mon Jun 10 05:09:34 2019(r348846)
> +++ head/sys/sys/ucred.h  Mon Jun 10 05:28:03 2019(r348847)
> @@ -89,12 +89,11 @@ struct xucred {
>   gid_t   cr_groups[XU_NGROUPS];  /* groups */
>   union {
>   void*_cr_unused1;   /* compatibility with old ucred */
> - pid_t   _pid;
> - } _cr;
> + pid_t   cr_pid;
> + };
>  };
>  #define  XUCRED_VERSION  0
>  
> -#define  cr_pid _cr._pid
>  /* This can be used for both ucred and xucred structures. */
>  #define  cr_gid cr_groups[0]

Isn't this a userland header that should work with non-C11 compilers?
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"