[Mesa-dev] [PATCH 1/2] mesa: use a prefix for the program lex

Kenneth Graunke kenneth at whitecape.org
Thu Sep 13 23:42:24 PDT 2012


On 09/13/2012 05:13 PM, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
> 
> This avoids us making a global yylex symbol which will interfere will
> all sorts of apps.
> 
> with libdricore which can't do symbol visibility currently we pollute
> the namespace with this.
> 
> This is a candidate for 9.0 & stable branches.
> 
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/mesa/Makefile.am             |    2 +-
>  src/mesa/program/program_lexer.l |    1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
> index 57325af..8e4530d 100644
> --- a/src/mesa/Makefile.am
> +++ b/src/mesa/Makefile.am
> @@ -73,7 +73,7 @@ main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py m
>  
>  program/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y
>  	$(MKDIR_P) program
> -	$(AM_V_GEN) $(YACC) -v -d --output=program/program_parse.tab.c $<
> +	$(AM_V_GEN) $(YACC) -p "_mesa_program_" -v -d --output=program/program_parse.tab.c $<
>  
>  program/lex.yy.c: program/program_lexer.l
>  	$(MKDIR_P) program
> diff --git a/src/mesa/program/program_lexer.l b/src/mesa/program/program_lexer.l
> index 0a50dab..0947bb0 100644
> --- a/src/mesa/program/program_lexer.l
> +++ b/src/mesa/program/program_lexer.l
> @@ -165,6 +165,7 @@ szf    [HR]?
>  cc     C?
>  sat    (_SAT)?
>  
> +%option prefix="_mesa_program_"
>  %option bison-bridge bison-locations reentrant noyywrap
>  %%

Yeah, even if this wasn't exposed, calling things yylex is just mean.  I
definitely hit symbol collisions a long time ago and it's just silly
given how easy it is to avoid.

This patch is:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

A word of precaution: I needed to do a clean build after applying this
patch to get anything to run.


More information about the mesa-dev mailing list