From owner-freebsd-arch@FreeBSD.ORG Thu Mar 10 17:42:30 2011 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF9841065678 for ; Thu, 10 Mar 2011 17:42:30 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 570BB8FC18 for ; Thu, 10 Mar 2011 17:42:29 +0000 (UTC) Received: by wyf23 with SMTP id 23so2025563wyf.13 for ; Thu, 10 Mar 2011 09:42:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:date:x-google-sender-auth :message-id:subject:from:to:content-type; bh=RwscBag9zn0vfNoIUT9pe/1iwrFpfYciBQRuWy5oumQ=; b=I4/QvEyOf1R9Oj+YyLuPzujTW6wB0nar0gSH2/vDcjrCs+ip9uh/clQ7WfcrmhdTrc NIMp0v9DSdzzvE2iPtZyWGpFtdaskVkBDC5wAIrhb788mGGUESwc683PHlg16mIBn1W2 /4YFiRuCrDaZDZlpWKhpp45HbLG6U4LSPtZCc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=PXQun78APoQck1BX/IOBIrnTSUEjyB0rek4h3tA22zhbPAI4cUoGVjpOZQB/tPwW4O faKfFLs8KR7rVqtmFHF8LbFVoG0n/s9oFBxeYyBpgfZ6kIvkU8MxDLa+ZlXNi1uCkvJ6 dDzdBJGOjj+venE+lfBp3lUwFR4hX+1urFwPs= MIME-Version: 1.0 Received: by 10.216.203.168 with SMTP id f40mr6168380weo.25.1299777448735; Thu, 10 Mar 2011 09:17:28 -0800 (PST) Sender: mdf356@gmail.com Received: by 10.216.62.130 with HTTP; Thu, 10 Mar 2011 09:17:28 -0800 (PST) Date: Thu, 10 Mar 2011 09:17:28 -0800 X-Google-Sender-Auth: pj_7MtP0Ov5sxdSTjDg4fhdplxg Message-ID: From: mdf@FreeBSD.org To: FreeBSD Arch Content-Type: text/plain; charset=ISO-8859-1 Subject: style(9) rules for nested includes X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Mar 2011 17:42:30 -0000 I recall a recent discussion/PR about nested includes in the context of and being a few of the only ones allowed. However, I don't see anything in style(9) about this. One rule for nested includes I've heard (that FreeBSD doesn't use, but just mentioning it for variety) is that every header file should compile on its own; that is, a .c file with nothing but #include should compile without errors. This rule also makes some sense with the FreeBSD style convention of alphabetizing includes; otherwise it's kinda just happenstance that e.g. comes alphabetically before , , and , and barely before . Now we come to the reason I ask. I'm working on a patch to change the static sysctl code to use the standard SYSININT/SYSUNINIT code rather than have special treatment in kern_linker.c, but to do this I need to either change quite a few places that include , or include instead of in sysctl.h, as the SI_SUB_SYSCTLS value isn't visible otherwise. This, though, shows a bug in , where it uses the constant MAXPATHLEN in the extern declaration of kernelname[] (which itself I think is not standard C, IIRC, but there are several uses of sizeof(kernelname) that don't work otherwise). So then needs to build. So, which files are okay to include in an include file? Does someone (I'll do it if we can agree on a list) want to put this in style(9)? Thanks, matthew