linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kamil Dudka <kdudka@redhat.com>
To: sparse <linux-sparse@vger.kernel.org>
Subject: Re: [PATCH] make sparse headers self-compilable...
Date: Sat, 8 Aug 2009 13:10:26 +0200	[thread overview]
Message-ID: <200908081310.27671.kdudka@redhat.com> (raw)
In-Reply-To: <200908072227.08652.kdudka@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1046 bytes --]

On Friday 07 of August 2009 22:27:08 Kamil Dudka wrote:
> attached is another fix for SPARSE headers improving their sanity. I am
> also attaching a simple test for the dependency tracking of headers. It's
> not enough generic and portable and therefore not really useful. Maybe
> someone skilled in writing makefiles might want to include something like
> that to the SPARSE Makefile as part of the 'check' target.

Attached are amended versions of the patch and the test. I didn't spot
some warnings before.

Kamil

diff --git a/storage.h b/storage.h
index 0d3bbc5..e049e23 100644
--- a/storage.h
+++ b/storage.h
@@ -1,6 +1,7 @@
 #ifndef STORAGE_H
 #define STORAGE_H

+#include "allocate.h"
 #include "lib.h"

 /*
diff -up Makefile.chk.orig Makefile.chk
--- Makefile.chk.orig
+++ Makefile.chk
@@ -19,9 +19,11 @@ HEADERS ?= \

 SINK ?= /dev/null

+CFLAGS += -Wall -Werror
+
 .PHONY: check $(HEADERS)

 # check whether each header is self-compilable
 check: $(HEADERS)
 $(HEADERS):
-   $(CC) -o $(SINK) -c $@
+   $(CC) $(CFLAGS) -o $(SINK) -c $@

[-- Attachment #2: Makefile.chk --]
[-- Type: text/x-makefile, Size: 467 bytes --]

# all SPARSE headers (except ident-list.h which is not an ordinary header)
HEADERS ?= \
	allocate.h \
	bitmap.h \
	compat.h \
	compile.h \
	dissect.h \
	expression.h \
	flow.h \
	lib.h \
	linearize.h \
	parse.h \
	ptrlist.h \
	scope.h \
	storage.h \
	symbol.h \
	target.h \
	token.h \

SINK ?= /dev/null

CFLAGS += -Wall -Werror

.PHONY: check $(HEADERS)

# check whether each header is self-compilable
check: $(HEADERS)
$(HEADERS):
	$(CC) $(CFLAGS) -o $(SINK) -c $@

[-- Attachment #3: 0001-make-sparse-headers-self-compilable.patch --]
[-- Type: text/x-diff, Size: 2076 bytes --]

From 619088669e2333a8c5921d99befa8d72b322004d Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Sat, 8 Aug 2009 12:58:41 +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 <kdudka@redhat.com>
---
 compile.h |    2 ++
 flow.h    |    2 ++
 ptrlist.h |    2 ++
 scope.h   |    2 ++
 storage.h |    3 +++
 5 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/compile.h b/compile.h
index 0db8fdb..6c5260d 100644
--- a/compile.h
+++ b/compile.h
@@ -1,6 +1,8 @@
 #ifndef COMPILE_H
 #define COMPILE_H
 
+#include "symbol.h"
+
 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 9f2e165..241f081 100644
--- a/flow.h
+++ b/flow.h
@@ -1,6 +1,8 @@
 #ifndef FLOW_H
 #define FLOW_H
 
+#include "symbol.h"
+
 extern unsigned long bb_generation;
 
 #define REPEAT_CSE		1
diff --git a/ptrlist.h b/ptrlist.h
index dae0906..85b23fc 100644
--- a/ptrlist.h
+++ b/ptrlist.h
@@ -7,6 +7,8 @@
  * (C) Copyright Linus Torvalds 2003-2005
  */
 
+#include <stdlib.h>
+
 #define container(ptr, type, member) \
 	(type *)((void *)(ptr) - offsetof(type, member))
 
diff --git a/scope.h b/scope.h
index 5f1f232..aff7b6b 100644
--- a/scope.h
+++ b/scope.h
@@ -9,6 +9,8 @@
  *  Licensed under the Open Software License version 1.1
  */
 
+#include "symbol.h"
+
 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


  reply	other threads:[~2009-08-08 11:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-07 20:27 [PATCH] make sparse headers self-compilable Kamil Dudka
2009-08-08 11:10 ` Kamil Dudka [this message]
2009-08-11  9:40   ` Christopher Li
2009-08-11  9:55     ` Kamil Dudka
2009-08-11 10:40       ` Kamil Dudka
2009-08-11 21:08         ` Christopher Li
2009-08-11 21:25           ` Kamil Dudka
2009-08-11 12:48     ` Hannes Eder
2009-08-11 12:59       ` Kamil Dudka
2009-08-11 21:08         ` Christopher Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200908081310.27671.kdudka@redhat.com \
    --to=kdudka@redhat.com \
    --cc=linux-sparse@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).