netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nftables] fix parser.h recursive inclusion
@ 2014-01-16 18:04 Patrick McHardy
  2014-01-16 18:15 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick McHardy @ 2014-01-16 18:04 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

This the recursive parser.h inclusion that happens occasionally when
regenerating the parser files. Amazingly bison, despite its age, is
not using header sandwiches to protect against this *sigh*

Slightly ugly, but fixes the problem.


diff --git a/Makefile.rules.in b/Makefile.rules.in
index 25988dd..ae563a5 100644
--- a/Makefile.rules.in
+++ b/Makefile.rules.in
@@ -22,7 +22,14 @@ configure:		configure.ac
 
 %.c %.h:		%.y	$(makedeps)
 			@echo -e "  YACC\t\t$<"
-			$(YACC) $(YACCFLAGS) -d -o $@ $<
+			$(YACC) $(YACCFLAGS) --defines=$*.h.tmp -o $@ $<
+			( \
+				echo "#ifndef __$(*F)_H"; \
+				echo "#define __$(*F)_H"; \
+				cat $*.h.tmp; \
+				echo "#endif /* __$(*F)_H */" \
+			) > $*.h
+			$(RM) $*.h.tmp
 
 %.c %.h:		%.l	$(makedeps)
 			@echo -e "  LEX\t\t$<"

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-16 18:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-16 18:04 [PATCH nftables] fix parser.h recursive inclusion Patrick McHardy
2014-01-16 18:15 ` Pablo Neira Ayuso
2014-01-16 18:38   ` Patrick McHardy

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).