intel/tools: Fix build with glibc < 2.27.

Submitted by Vinson Lee on May 10, 2019, 6:28 p.m.

Details

Message ID 20190510182847.6900-1-vlee@freedesktop.org
State New
Headers show
Series "intel/tools: Fix build with glibc < 2.27." ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Vinson Lee May 10, 2019, 6:28 p.m.
glibc < 2.27 defines OVERFLOW in /usr/include/math.h.

This patch fixes this build error.

In file included from ../include/c99_math.h:37:0,
                 from ../src/util/u_math.h:44,
                 from ../src/mesa/main/macros.h:35,
                 from ../src/intel/compiler/brw_reg.h:47,
                 from ../src/intel/tools/i965_asm.h:32,
                 from ../src/intel/tools/i965_gram.y:29:
src/intel/tools/i965_gram.tab.c:562:5: error: expected identifier before numeric constant
     OVERFLOW = 412,
     ^

Fixes: 70308a5a8a80 ("intel/tools: New i965 instruction assembler tool")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110656
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
---
 src/intel/tools/i965_asm.h | 4 ++++
 1 file changed, 4 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/intel/tools/i965_asm.h b/src/intel/tools/i965_asm.h
index 7027f4e..0519ba5 100644
--- a/src/intel/tools/i965_asm.h
+++ b/src/intel/tools/i965_asm.h
@@ -36,6 +36,10 @@ 
 #include "compiler/brw_eu.h"
 #include "dev/gen_device_info.h"
 
+#ifdef OVERFLOW
+#undef OVERFLOW
+#endif
+
 void yyerror (char *);
 int yyparse(void);
 int yylex(void);

Comments

On 2019-05-10 at 19:28, Vinson Lee <vlee@freedesktop.org> wrote:
> glibc < 2.27 defines OVERFLOW in /usr/include/math.h.
> 
> This patch fixes this build error.
> 
> In file included from ../include/c99_math.h:37:0,
>                  from ../src/util/u_math.h:44,
>                  from ../src/mesa/main/macros.h:35,
>                  from ../src/intel/compiler/brw_reg.h:47,
>                  from ../src/intel/tools/i965_asm.h:32,
>                  from ../src/intel/tools/i965_gram.y:29:
> src/intel/tools/i965_gram.tab.c:562:5: error: expected identifier 
> before numeric constant
>      OVERFLOW = 412,
>      ^
> 
> Fixes: 70308a5a8a80 ("intel/tools: New i965 instruction assembler tool")
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110656
> Signed-off-by: Vinson Lee <vlee@freedesktop.org>
> ---
>  src/intel/tools/i965_asm.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/intel/tools/i965_asm.h b/src/intel/tools/i965_asm.h
> index 7027f4e..0519ba5 100644
> --- a/src/intel/tools/i965_asm.h
> +++ b/src/intel/tools/i965_asm.h
> @@ -36,6 +36,10 @@
>  #include "compiler/brw_eu.h"
>  #include "dev/gen_device_info.h"
>  
> +#ifdef OVERFLOW
> +#undef OVERFLOW
> +#endif

You don't need the #ifdef, you can just #undef.

Can you add the first line of the commit message as an online comment here?

Acked-by: Eric Engestrom <eric@engestrom.ch>

> +
>  void yyerror (char *);
>  int yyparse(void);
>  int yylex(void);
> -- 
> 2.7.4
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev