Date: Sun, 25 Jul 2010 21:12:55 +0300 From: Kostik Belousov <kostikbel@gmail.com> To: Bruce Evans <brde@optusnet.com.au> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Stefan Farfeleder <stefanf@freebsd.org>, src-committers@freebsd.org Subject: Re: svn commit: r210451 - head/sys/sys Message-ID: <20100725181255.GB22295@deviant.kiev.zoral.com.ua> In-Reply-To: <20100726013202.G11808@delplex.bde.org> References: <201007241814.o6OIEY4K099556@svn.freebsd.org> <20100724183732.GA1715@mole.fafoe.narf.at> <20100726013202.G11808@delplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--cvVnyQ+4j833TQvp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 26, 2010 at 01:36:07AM +1000, Bruce Evans wrote: > On Sat, 24 Jul 2010, Stefan Farfeleder wrote: >=20 > >declaring enums like this is not standard C code (seems to be a GCC > >extension). I don't think we should use this feature in our headers. >=20 > This is unfortunate. This is because the size of an enum variable > depends on its complete declaration. This is an error unconditionaly > with TenDRA. It takes -pedantic to get a warning from gcc. I looked at the C99, and indeed, there is an explicit sentence "A type specifier of the form enum identifier without an enumerator list shall only appear after the type it specifies is complete." I fully agree with Bruce that this is unfortunate, or rather, makes enum tag declaration completely unuseful. gcc extension greatly simplifies dealing with the headers pollution. On the other hand, I disagree with the statement that the size of the enum variable depends on the full declaration. It seems that C99 defines values of the enum to by of type int, and both i386 and amd64 ABIs define enums as represented by 4-byte integers. Yes, I am aware that C++ allows the enum to be assigned the the shortest arithmetic type that can represent all enum values. Overall, I will revert both this revision and similar part of the=20 r210431, using #include <sys/uio.h> :(. >=20 > >>Modified: head/sys/sys/imgact.h > >>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > >>--- head/sys/sys/imgact.h Sat Jul 24 18:05:10 2010 (r210450) > >>+++ head/sys/sys/imgact.h Sat Jul 24 18:14:34 2010 (r210451) > >>@@ -32,8 +32,6 @@ > >> #ifndef _SYS_IMGACT_H_ > >> #define _SYS_IMGACT_H_ > >> > >>-#include <sys/uio.h> > >>- >=20 > The rule that new pollution may not be added to old headers should have > prevented the need for this removal. >=20 > >> #define MAXSHELLCMDLEN PAGE_SIZE > >> > >> struct image_args { > >>@@ -75,6 +73,7 @@ struct image_params { > >> #ifdef _KERNEL > >> struct sysentvec; > >> struct thread; > >>+enum uio_seg; > >> > >> #define IMGACT_CORE_COMPRESS 0x01 >=20 > Bruce --cvVnyQ+4j833TQvp Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkxMfqYACgkQC3+MBN1Mb4hKDgCgjhvBlfuYNbDo/597UOX+J8yh 8dYAoJ+fCbbGoHB5ASB4iKLLAbDijsg2 =7AJN -----END PGP SIGNATURE----- --cvVnyQ+4j833TQvp--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100725181255.GB22295>