From patchwork Tue Aug 11 12:59:23 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamil Dudka X-Patchwork-Id: 40635 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7BD0NtB007566 for ; Tue, 11 Aug 2009 13:00:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751371AbZHKM77 (ORCPT ); Tue, 11 Aug 2009 08:59:59 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752983AbZHKM77 (ORCPT ); Tue, 11 Aug 2009 08:59:59 -0400 Received: from mx2.redhat.com ([66.187.237.31]:42913 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751371AbZHKM76 (ORCPT ); Tue, 11 Aug 2009 08:59:58 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7BCxwkB010029; Tue, 11 Aug 2009 08:59:58 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n7BCxvR4007998; Tue, 11 Aug 2009 08:59:57 -0400 Received: from vpn2-8-83.ams2.redhat.com (vpn2-8-83.ams2.redhat.com [10.36.8.83]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n7BCxtKe005583; Tue, 11 Aug 2009 08:59:56 -0400 From: Kamil Dudka To: Hannes Eder Subject: Re: [PATCH] make sparse headers self-compilable... Date: Tue, 11 Aug 2009 14:59:23 +0200 User-Agent: KMail/1.9.7 Cc: Christopher Li , sparse References: <200908072227.08652.kdudka@redhat.com> <70318cbf0908110240w5067933dv92e92829c0bb2e8f@mail.gmail.com> <154e089b0908110548t33b9114ej4bf3a019ee6ab80e@mail.gmail.com> In-Reply-To: <154e089b0908110548t33b9114ej4bf3a019ee6ab80e@mail.gmail.com> MIME-Version: 1.0 Message-Id: <200908111459.23341.kdudka@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org On Tuesday 11 of August 2009 14:48:39 Hannes Eder wrote: > What about just using some forward decls instead of including the header > files? > > e.g. for compile.h it is enough to have a "struct symbol;" there > instead of the "#include " to make it self-compilable. Thanks for the hint! It's definitely better, though not sufficient in all cases. The amended patch is attached. Kamil From 93455c6fe7dc84e1519bec70a9fd8625a879d791 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Tue, 11 Aug 2009 14:56:53 +0200 Subject: [PATCH] make sparse headers self-compilable... ... and thus possible to include them in arbitrary order and without any external dependencies. Signed-off-by: Kamil Dudka --- compile.h | 2 ++ flow.h | 5 +++++ ptrlist.h | 2 ++ scope.h | 2 ++ storage.h | 3 +++ 5 files changed, 14 insertions(+), 0 deletions(-) diff --git a/compile.h b/compile.h index 0db8fdb..177363a 100644 --- a/compile.h +++ b/compile.h @@ -1,6 +1,8 @@ #ifndef COMPILE_H #define COMPILE_H +struct symbol; + extern void emit_one_symbol(struct symbol *); extern void emit_unit_begin(const char *); extern void emit_unit_end(void); diff --git a/flow.h b/flow.h index fbc9505..370aadd 100644 --- a/flow.h +++ b/flow.h @@ -1,11 +1,16 @@ #ifndef FLOW_H #define FLOW_H +#include "lib.h" + extern unsigned long bb_generation; #define REPEAT_CSE 1 #define REPEAT_SYMBOL_CLEANUP 2 +struct entrypoint; +struct instruction; + extern int simplify_flow(struct entrypoint *ep); extern void simplify_symbol_usage(struct entrypoint *ep); diff --git a/ptrlist.h b/ptrlist.h index dae0906..fbfc080 100644 --- a/ptrlist.h +++ b/ptrlist.h @@ -1,6 +1,8 @@ #ifndef PTR_LIST_H #define PTR_LIST_H +#include + /* * Generic pointer list manipulation code. * diff --git a/scope.h b/scope.h index 5f1f232..0fab286 100644 --- a/scope.h +++ b/scope.h @@ -9,6 +9,8 @@ * Licensed under the Open Software License version 1.1 */ +struct symbol; + struct scope { struct token *token; /* Scope start information */ struct symbol_list *symbols; /* List of symbols in this scope */ diff --git a/storage.h b/storage.h index 610cbfd..e049e23 100644 --- a/storage.h +++ b/storage.h @@ -1,6 +1,9 @@ #ifndef STORAGE_H #define STORAGE_H +#include "allocate.h" +#include "lib.h" + /* * The "storage" that underlies an incoming/outgoing pseudo. It's * basically the backing store for a pseudo, and may be a real hardware -- 1.6.4