From owner-svn-src-head@freebsd.org Thu Apr 21 18:30:56 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F022B181B5 for ; Thu, 21 Apr 2016 18:30:56 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm3-vm0.bullet.mail.bf1.yahoo.com (nm3-vm0.bullet.mail.bf1.yahoo.com [98.139.212.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F51D14C7 for ; Thu, 21 Apr 2016 18:30:56 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1461263453; bh=fosNDXIpWkZRzFa/wTY11HUc42CSqySQUyotZG5yGdk=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=K6pN6QmGdv12+1dO751dLStz114zWOFtVn5WrejJKWruimgV3hgQYmmUR3mjn78bo8H9132cKA4BbyBxleHCr1d09NzwsIflydeimWrdcQvN3/krqQENDIf7GYryYkfTWPwx6ep/ukdWizBU33W4gAXzaQ/5rxxAWnveH3ICGPhJl27+CcvIyRv6AsRpYjnIKWa9AkGBUDA4KzA5lsdOp2B8/uO/vUdMx8IiNMks/oarfmoTEDtEGKseB0IsrU55ykJ/9cQbxHVrNqadkDZEjA44dyy4bCckgHx6fCPNC45QfqXNpi7JOQLKXidgFNSmrJwjiDbTDJdxIRB7CHWnSg== Received: from [66.196.81.170] by nm3.bullet.mail.bf1.yahoo.com with NNFMP; 21 Apr 2016 18:30:53 -0000 Received: from [98.139.211.198] by tm16.bullet.mail.bf1.yahoo.com with NNFMP; 21 Apr 2016 18:30:53 -0000 Received: from [127.0.0.1] by smtp207.mail.bf1.yahoo.com with NNFMP; 21 Apr 2016 18:30:53 -0000 X-Yahoo-Newman-Id: 887409.11621.bm@smtp207.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: Z041PowVM1kc5NyWT4opCOkLysyGi.yxvhPxngG4JEzRKnh _bXDgugJdCrWSAe77qnA7B0LN9BgNpPSkCwyiMcBPfKbkGUfqBBzsNHdwYqE daNPGvyOq7wONNJifum4SD45FCeM5NMNnuIH6UyltWWVOatPohuJAt00Ilhq hFNAwfcMBTV2eeVtsaPysxOtEw_jhimoMYAwkcqBMeKoUbFcQQN987cwrqzs vcMXBqlqaaYiMVQppZN6_yVjBnt99nOhrXgc7mxjbsPpJF5bLurHsILuinlL HsX50wO3MIzK5Op24bPjs3to0LCj5onCdN5SccNwot_6Z4ZAPF1pO8r.rQE8 O.nTtePBZ07J3sWD0_xyX_1mYGoLzQC4ndKXbfIVlBwCfjWYLFPWSLRZEaro uFL6Y5o0Zk.PSnVe7U0rZKqnpzTfMqRQhYX2tkFYs1Clddz2r0kZgur8kuhH 6hFxWOQ5bzjvUTnp1B9gscN0VeaZbt0KFxJSElg5jlERM6mEf_IjiLdXxEFA j7ADYKGFRCwsGQHJKbmQXRVn6azLVOdd3 X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r298412 - head/sys/ofed/drivers/infiniband/core To: Hans Petter Selasky , Juli Mallett References: <201604211604.u3LG4wmT035874@repo.freebsd.org> <57190C47.8070106@selasky.org> <5719150F.7030200@FreeBSD.org> <5719180F.90509@selasky.org> <57191B33.7070406@FreeBSD.org> Cc: Ngie Cooper , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: Pedro Giffuni Message-ID: <57191C65.2050209@FreeBSD.org> Date: Thu, 21 Apr 2016 13:31:01 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <57191B33.7070406@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2016 18:30:56 -0000 On 21/04/2016 13:25, Pedro Giffuni wrote: > > > On 21/04/2016 13:12, Hans Petter Selasky wrote: >> On 04/21/16 19:59, Pedro Giffuni wrote: >>> >>> >>> On 21/04/2016 12:52, Juli Mallett wrote: >>>> On Thu, Apr 21, 2016 at 10:22 AM, Hans Petter Selasky >>>> wrote: >>>>> On 04/21/16 19:12, Ngie Cooper wrote: >> >> Hi, >> >>>> Then there should be an assertion or something else of that sort (I >>>> forget if we have a __builtin_unreachable()-alike macro in the kernel; >>>> the lint(1)y NOTREACHED isn't as nice as actual code) so that it is >>>> apparent to a human that this case cannot be reached. The presence of >>>> a do-nothing default case is not typically indicative of unreachable >>>> code. >>> >>> We do have __unreachable() in cdefs.h >>> >>> It should work with both GCC and clang. >>> >>> Pedro. >>> >> >> I don't see anyone using __unreachable() yet in the kernel. Do you >> recommend it over a KASSERT() ? >> > > It's a rather recent addition (I added it after checking NetBSD's cdefs). > > It is meant mostly for the compiler/static analyzers. > > From the clang documentation: > "The __builtin_unreachable() builtin has completely undefined > behavior. Since it has undefined behavior, it is a statement that it > is never reached and the optimizer can take advantage of this to > produce better code. This builtin takes no arguments and produces a > void result." > Replying to myself with the better description[1]: "__builtin_unreachable is used to indicate that a specific point in the program cannot be reached, even if the compiler might otherwise think it can. This is useful to improve optimization and eliminates certain warnings. " Pedro. [1] http://clang.llvm.org/docs/LanguageExtensions.html#builtin-functions