From owner-svn-src-all@freebsd.org Thu Apr 21 18:30:52 2016 Return-Path: Delivered-To: svn-src-all@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 47CBAB1817E for ; Thu, 21 Apr 2016 18:30:52 +0000 (UTC) (envelope-from giffunip@yahoo.com) Received: from nm44-vm10.bullet.mail.bf1.yahoo.com (nm44-vm10.bullet.mail.bf1.yahoo.com [216.109.115.46]) (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 F122714A1 for ; Thu, 21 Apr 2016 18:30:51 +0000 (UTC) (envelope-from giffunip@yahoo.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1461263444; bh=fosNDXIpWkZRzFa/wTY11HUc42CSqySQUyotZG5yGdk=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=O54clxe7kWUrlBsYPUKdenXbNCKNz6QH/SK7r21E6WEI1eg3uibH8JWomQlMkKfGmYH+XIMkFhsZBZKaOu4QYOBWfYSPqxlBZzlTrf1HL5C3T7jCXUSsy1Wlu/1ScFpH2oP4vCkzQlE50+jsP5BHKzbrrVm4/6wz+EnEpaslAYCALqUexIKz2HVkzajxcSyO8nmCbbNAvzl5r4MlNZSeJhuILo2YMAjuj+Eb6Ylj196DqtgzWr6wWeK9XXvXbCYz9dDn+kQI8eezGTcxqfqI/IX2agV2iuWqgOjgugql8U0vMFH0CrszhH9bdLO9D8JoLycl3iQ36TDwCbyE4WHfpw== Received: from [98.139.215.140] by nm44.bullet.mail.bf1.yahoo.com with NNFMP; 21 Apr 2016 18:30:44 -0000 Received: from [98.139.211.195] by tm11.bullet.mail.bf1.yahoo.com with NNFMP; 21 Apr 2016 18:30:44 -0000 Received: from [127.0.0.1] by smtp204.mail.bf1.yahoo.com with NNFMP; 21 Apr 2016 18:30:44 -0000 X-Yahoo-Newman-Id: 237445.40789.bm@smtp204.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: _v8.rXAVM1kmluxo_3jlKYIibJV.m5INUrgz35fzJHyuaak asbGFNkSLHUwoLGatuLYgox71zoPTwRGc01lDtJBvajXod9RisSQcldzNDe1 8Hr7Cl4wDwkjxooHAeOd.pMGT9YK0uW5v2fay4r6vJQUPAx_.XCHc1IxEPDS RVJhoB_n1woeZgyZwbucSQQswUTb__QhjQkH1VBag5vzW5nk2mus31nyeYYn ODvJp9F9zVTU5yvpbweEGbz.7UMKSVry5qbZjD0zcnfrXIBW_Yy_SxKhU_0M 7bmRcHfU.pOEwvFCEexEvajuKuSlXbYMd1WfVEPRFNFPpPpjO.Gjyg84Bum9 R7eHjZECqAMWEdXA9cPy0L18z836a3bzjFQGnuh.K5HS5tNgXWpqyZApv17D qSWj4Ws_NY2aiLJxAbbRgw.Ji3cNF.9V43ldS.rjIVnttZYrGB5Jn4i0fO.b tQY2tVa1I_526XFjdzm9hH0iX9QuRSSiiRss0r4BEjDV1PdO3z2b.caihGNx fBfWq3ITPqk9PY8VwMgwG6crRih.dzpv6lcc- 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: <57191C5C.8020106@yahoo.com> Date: Thu, 21 Apr 2016 13:30:52 -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-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2016 18:30:52 -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