From owner-freebsd-current@FreeBSD.ORG Tue Oct 11 19:22:05 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C5841065679 for ; Tue, 11 Oct 2011 19:22:05 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id EF9168FC1A for ; Tue, 11 Oct 2011 19:22:04 +0000 (UTC) Received: by qadz30 with SMTP id z30so6708840qad.13 for ; Tue, 11 Oct 2011 12:22:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=povrRYJJE/XwU3BU9SUqHD8aDHNVw0deXtL1Y3X+Mt0=; b=Yfk4A1nkAGa7LWrCcV+J4pquLgaKBRMkXfK1zlkCgpvDuPgOl1Mo7r1mrGmQYt80oR 5iKCb/bJWCrxZgrTRlEEVRXrqQGeqCW2OvEcEEJ4BcJ4xm7Erk9LO/DC34ocM/iKfAsS GRVv7yWA4CZyjVhMYdWd1VPKFx8yWl6hejFmE= MIME-Version: 1.0 Received: by 10.224.189.198 with SMTP id df6mr16119832qab.46.1318360924334; Tue, 11 Oct 2011 12:22:04 -0700 (PDT) Received: by 10.224.74.82 with HTTP; Tue, 11 Oct 2011 12:22:04 -0700 (PDT) In-Reply-To: References: <4E942FF1.9000805@FreeBSD.org> <4E9449F2.2000801@FreeBSD.org> Date: Tue, 11 Oct 2011 12:22:04 -0700 Message-ID: From: Garrett Cooper To: Arnaud Lacombe Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: =?ISO-8859-1?Q?Ren=E9_Ladan?= , freebsd-current@freebsd.org, Dimitry Andric , Larry Rosenman Subject: Re: System headers with clang? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2011 19:22:05 -0000 On Tue, Oct 11, 2011 at 11:40 AM, Arnaud Lacombe wrote= : > Hi, > > On Tue, Oct 11, 2011 at 9:51 AM, Dimitry Andric wrote: >> On 2011-10-11 15:31, Larry Rosenman wrote: >>> >>> On Tue, 11 Oct 2011, Dimitry Andric wrote: >> >> ... >>>> >>>> I've attached a fix for the lsof port, which also makes it build on >>>> 10.0-CURRENT (this was easy to fix here, as lsof uses its own >>>> hand-rolled configuration script). =A0Let me know if it works for you. >>>> >>> Unless the headers are fixed, Vic Abell (lsof Author) will NOT support = it. >>> >>> We need to get clang/system headers to allow warning free compilation >>> just like GCC does. >> >> The system headers compile without warning, if you use them as intended >> (e.g. from the kernel), which lsof obviously doesn't do. =A0There is no >> easy workaround here, except by modifying lsof. >> >> For example, the warning about KASSERT is because lsof's headers don't >> include the required headers for this macro. =A0And gcc is apparently no= t >> smart enough to generate warnings for this. :) >> > KASSERT() (from `sys/systm.h') is kernel only, any userland code > seeing it is not using the header properly. I'd be a strong proponent > of: > > #ifdef _KERNEL > #error "You are NOT meant to define _KERNEL in userland application" > #endif > > So this has nothing to do about smartness, but correctness. net-snmp suffers from this as well because it pokes around some kernel structures and data types to gather statistics related to IPv6, routing, etc in order to fulfill MIB-II compliance. Part of the bits are present, but not all of them, and I would really like for the need to muck around in _KERNEL to go away... Similarly, we have several utilities in base that muck around in _KERNEL that really shouldn't IMHO. Thanks, -Garrett