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

* Re: [PATCH nftables] fix parser.h recursive inclusion
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Pablo Neira Ayuso @ 2014-01-16 18:15 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: netfilter-devel

On Thu, Jan 16, 2014 at 06:04:27PM +0000, Patrick McHardy wrote:
> 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.

Ah, much nicer than the "nested too deep" warning message :)

> 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	[flat|nested] 3+ messages in thread

* Re: [PATCH nftables] fix parser.h recursive inclusion
  2014-01-16 18:15 ` Pablo Neira Ayuso
@ 2014-01-16 18:38   ` Patrick McHardy
  0 siblings, 0 replies; 3+ messages in thread
From: Patrick McHardy @ 2014-01-16 18:38 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel

On Thu, Jan 16, 2014 at 07:15:20PM +0100, Pablo Neira Ayuso wrote:
> On Thu, Jan 16, 2014 at 06:04:27PM +0000, Patrick McHardy wrote:
> > 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.
> 
> Ah, much nicer than the "nested too deep" warning message :)

Indeed. Pushed out to master.

> 
> > 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$<"
> --
> To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[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).