Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Jun 2015 16:09:48 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Pedro Giffuni <pfg@freebsd.org>
Cc:        Bruce Evans <brde@optusnet.com.au>, Dimitry Andric <dim@freebsd.org>,  David Chisnall <theraven@freebsd.org>, src-committers@freebsd.org,  svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r268137 - head/sys/sys
Message-ID:  <20150621154332.U976@besplex.bde.org>
In-Reply-To: <55861046.4050501@FreeBSD.org>
References:  <201407020845.s628jRG5031824@svn.freebsd.org> <5BE3492F-86A0-4CE3-A27C-8DB5EB662C64@FreeBSD.org> <55842F16.5040608@FreeBSD.org> <D58BE060-870A-4D5E-AE46-D915D9CD6A0C@FreeBSD.org> <20150620023835.N2562@besplex.bde.org> <55861046.4050501@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 20 Jun 2015, Pedro Giffuni wrote:

> On 06/19/15 12:23, Bruce Evans wrote:
>> On Fri, 19 Jun 2015, Dimitry Andric wrote:
>>=20
>>> On 19 Jun 2015, at 17:02, Pedro Giffuni <pfg@freebsd.org> wrote:
>>>>=20
>>>>> On 19/06/2015 05:16 a.m., David Chisnall wrote:
>>>>>> I only just caught this (having seen the fallout from NetBSD doing t=
he=20
>>>>>> same thing in a shipping release and the pain that it=E2=80=99s caus=
ed):
>>>>>> __weak is a reserved keyword in Objective-C, please pick another nam=
e=20
>>>>>> for this.  This in cdefs.h makes it impossible to include any FreeBS=
D=20
>>>>>> standard headers in Objective-C programs (of which we have a couple =
of=20
>>>>>> hundred in ports) if they use any of the modern Objective-C language=
=20
>>>>>> modes.
>>> ...
>>>> Closely related to this, we are redefining _Noreturn, which is a reser=
ved=20
>>>> keyword in C11.
>>>=20
>>> No, sys/cdefs.h has:
>>>=20
>>>   254  /*
>>>   255   * Keywords added in C11.
>>>   256   */
>>>   257
>>>   258  #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L ||=
=20
>>> defined(lint)
>>> [...]
>>>   284  #if defined(__cplusplus) && __cplusplus >=3D 201103L
>>>   285  #define _Noreturn               [[noreturn]]
>>>   286  #else
>>>   287  #define _Noreturn               __dead2
>>>   288  #endif
>>> [...]
>>>   320  #endif /* __STDC_VERSION__ || __STDC_VERSION__ < 201112L */
>>>=20
>>> So the whole block redefining all the _Xxx identifiers is skipped for
>>> C11 and higher.
>>=20
>> I probably pointed this out incorrectly to Pedro.
>>=20
>> All uses of _Noreturn are still broken, and also ugly.  __dead2 is the
>> gcc-2 compatible version of the gcc-1 compatible macro __dead.  It is
>> syntactically different from __dead and _Noreturn.  It must be placed
>> after the function parameter list instead of in the function type
>> declarator because old versions of gcc only accept attributes there.
>> __dead and presumably _Noreturn must be placed in the function type
>> declarator.  This is incompatible, and also uglier.
>>=20
> I was thinking that _Noreturn can be fixed for older compilers
> less disruptively.
>
> I haven't tested the attached patch the idea is to resurrect
> __dead and use it for _Noreturn.
>
>> Correct version with ugly declarations:
>>=20
>> __dead void
>>     foo(void) __dead2;
>>=20
>
> With the patch we would use:
>
> __Noreturn void
>   foo(void) _dead2;
>
> Which is still ugly but C11-ish.

That asks for the same problems as defining __weak.

Why not just don't use _Noreturn?  It is an unimprovement on the gcc
attribute.  The attribute works at the beginning or end, while Noreturn
only works at the end.  I checked this:

pts/23:bde@freefall:~/s> cc -O -S a.c -std=3Dc11
a.c:3:26: error: '_Noreturn' keyword must precede function declarator
_Noreturn void bar(void) _Noreturn;
                          ^

I also checked if __dead2 works at the beginning in gcc-2.95.4.  It
does, but other headers are broken, so the support for gcc-2.95.4 in
sys/cdefs.h is almost useless:

pts/23:bde@freefall:~/s> gcc295 -O -S a.c
In file included from /usr/include/machine/_types.h:6,
                  from /usr/include/sys/_types.h:33,
                  from /usr/include/x86/endian.h:37,
                  from /usr/include/machine/endian.h:6,
                  from /usr/include/sys/types.h:44,
                  from a.c:1:
/usr/include/x86/_types.h:161: syntax error before `__gnuc_va_list'
/usr/include/x86/_types.h:161: warning: data definition has no type or stor=
age c
lass

Here is the broken part of x86/_types.h:

%%%
#ifdef __GNUCLIKE_BUILTIN_VARARGS
typedef __builtin_va_list=09__va_list;=09/* internally known to gcc */
#elif defined(lint)
typedef char *=09=09=09__va_list;=09/* pretend */
#endif
#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \
     && !defined(__NO_GNUC_VA_LIST)
#define __GNUC_VA_LIST
meta: next is line 161:
typedef __va_list=09=09__gnuc_va_list; /* compatibility w/GNU headers*/
#endif
%%%

Despite (rather, because of) mounds of ifdefs to support old gcc, it doesn'=
t
actually work.

<stdarg.h> is honestly broken.  It knows that it depends on the gcc feature
__GNUCLIKE_BUILTIN_STDARG, and aborts with an #error when it is not availab=
le.
All of the _GNUCLIKE_BUILTIN_* macros for variadic args are controlled by
sys/cdefs.h.  They are defined when the compiler is either gcc newer than
gcc-2.95 or is icc.

Bruce
From owner-svn-src-head@FreeBSD.ORG  Sun Jun 21 06:52:04 2015
Return-Path: <owner-svn-src-head@FreeBSD.ORG>
Delivered-To: svn-src-head@hub.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id 176AE461;
 Sun, 21 Jun 2015 06:52:04 +0000 (UTC)
 (envelope-from cperciva@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 05308896;
 Sun, 21 Jun 2015 06:52:04 +0000 (UTC)
 (envelope-from cperciva@FreeBSD.org)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5L6q3DC060562;
 Sun, 21 Jun 2015 06:52:03 GMT (envelope-from cperciva@FreeBSD.org)
Received: (from cperciva@localhost)
 by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5L6q3qO060561;
 Sun, 21 Jun 2015 06:52:03 GMT (envelope-from cperciva@FreeBSD.org)
Message-Id: <201506210652.t5L6q3qO060561@svn.freebsd.org>
X-Authentication-Warning: svn.freebsd.org: cperciva set sender to
 cperciva@FreeBSD.org using -f
From: Colin Percival <cperciva@FreeBSD.org>
Date: Sun, 21 Jun 2015 06:52:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r284670 - head/sys/dev/xen/blkfront
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.20
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>;
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 21 Jun 2015 06:52:04 -0000

Author: cperciva
Date: Sun Jun 21 06:52:03 2015
New Revision: 284670
URL: https://svnweb.freebsd.org/changeset/base/284670

Log:
  Garbage collect comments and a macro which related to the pre-r284296
  support for a "segment block" extension in FreeBSD's Xen blkfront/blkback
  drivers.
  
  This commit should not result in any functional changes.

Modified:
  head/sys/dev/xen/blkfront/block.h

Modified: head/sys/dev/xen/blkfront/block.h
==============================================================================
--- head/sys/dev/xen/blkfront/block.h	Sun Jun 21 06:49:44 2015	(r284669)
+++ head/sys/dev/xen/blkfront/block.h	Sun Jun 21 06:52:03 2015	(r284670)
@@ -68,9 +68,8 @@
 #define XBD_MAX_RING_PAGES		32
 
 /**
- * The maximum number of outstanding requests blocks (request headers plus
- * additional segment blocks) we will allow in a negotiated block-front/back
- * communication channel.
+ * The maximum number of outstanding requests we will allow in a negotiated
+ * block-front/back communication channel.
  */
 #define XBD_MAX_REQUESTS						\
 	__CONST_RING_SIZE(blkif, PAGE_SIZE * XBD_MAX_RING_PAGES)
@@ -82,15 +81,6 @@
 #define	XBD_MAX_REQUEST_SIZE						\
 	MIN(MAXPHYS, XBD_SEGS_TO_SIZE(BLKIF_MAX_SEGMENTS_PER_REQUEST))
 
-/**
- * The maximum number of segments (within a request header and accompanying
- * segment blocks) per request we will allow in a negotiated block-front/back
- * communication channel.
- */
-#define	XBD_MAX_SEGMENTS_PER_REQUEST					\
-	(MIN(BLKIF_MAX_SEGMENTS_PER_REQUEST,				\
-	     XBD_SIZE_TO_SEGS(XBD_MAX_REQUEST_SIZE)))
-
 typedef enum {
 	XBDCF_Q_MASK		= 0xFF,
 	/* This command has contributed to xbd_qfrozen_cnt. */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150621154332.U976>