git: fb09dfccc7a6 - main - devel/gaa: Fix build with bison 3.8.0+

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Mon, 07 Mar 2022 18:27:32 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=fb09dfccc7a67894656655f38db5849e4ea91ac9

commit fb09dfccc7a67894656655f38db5849e4ea91ac9
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2022-03-07 18:08:04 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2022-03-07 18:13:22 +0000

    devel/gaa: Fix build with bison 3.8.0+
    
    PR:             262252
---
 devel/gaa/files/patch-bison     | 73 +++++++++++++++++++++++++++++++++++++++++
 devel/gaa/files/patch-configure |  8 ++---
 2 files changed, 77 insertions(+), 4 deletions(-)

diff --git a/devel/gaa/files/patch-bison b/devel/gaa/files/patch-bison
new file mode 100644
index 000000000000..bf822d359dfd
--- /dev/null
+++ b/devel/gaa/files/patch-bison
@@ -0,0 +1,73 @@
+--- source/gaa_parser.y.orig	2004-04-15 10:52:42 UTC
++++ source/gaa_parser.y
+@@ -22,7 +22,6 @@
+ 
+ /* needed in newer bisons for yytoknum.
+  */
+-#define YYPRINT
+ #define YYERROR_VERBOSE
+ 
+ #include <stdio.h>
+@@ -373,8 +372,6 @@ void copy_str(FILE* fd, int offset, FILE* out, const c
+ %token AS "as"
+ %token OPTIONAL "optional"
+ 
+-%token_table
+-
+ %%
+ 
+ input:
+@@ -636,6 +633,32 @@ line:
+ 
+ %%
+ 
++struct token_table_struct {
++    const char *str;
++    int token;
++};
++
++static struct token_table_struct token_table[] = {
++    {"IDENTIFIER", IDENTIFIER},
++    {"ACTION", ACTION},
++    {"TERMINATE", TERMINATE},
++    {"CSOURCE", CSOURCE},
++    {"CPART", CPART},
++    {"TYPE", TYPE},
++    {"STRING", STRING},
++    {"UNDERSCORE_STRINGS", UNDERSCORE_STRINGS},
++    {"init", INIT},
++    {"defitem", DEFITEM},
++    {"option", OPTION},
++    {"rest", REST},
++    {"helpnode", HELPNODE},
++    {"obligat", OBLIGATORY},
++    {"incomp", INCOMPATIBLE},
++    {"data", DATA},
++    {"as", AS},
++    {"optional", OPTIONAL},
++};
++
+ extern int loc_index;
+ 
+ struct _idStruct;
+@@ -720,17 +743,9 @@ int length(char *a)
+ 
+ int getTokenNum( char* str) {
+ int i;
+-     for (i = 0; i < YYNTOKENS; i++)
+-     {
+-     	   if (yytname[i] != 0
+-		&& yytname[i][0] == '"'
+-    	        && strncasecmp (yytname[i] + 1, str, strlen (str)) == 0
+- 	        && yytname[i][strlen (str) + 1] == '"'
+-                && yytname[i][strlen (str) + 2] == 0)
+-	   {
+-	       return yytoknum[i];
+-	   }
+-     }
++     for (i = 0; i < (sizeof(token_table)/sizeof(token_table[0])); i++)
++        if (!strcmp (token_table[i].str, str))
++            return token_table[i].token;
+      return -1;
+ }
+ 
diff --git a/devel/gaa/files/patch-configure b/devel/gaa/files/patch-configure
index e78a9b95b650..6a0567bc53e4 100644
--- a/devel/gaa/files/patch-configure
+++ b/devel/gaa/files/patch-configure
@@ -1,6 +1,6 @@
---- configure.orig	Thu May  3 12:06:58 2007
-+++ configure	Thu May  3 12:07:01 2007
-@@ -1265,7 +1265,7 @@
+--- configure.orig	2004-07-20 09:30:46 UTC
++++ configure
+@@ -1265,7 +1265,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
  
  gaadatadir=$datadir/gaa
  gaadocdir=$datadir/doc/gaa
@@ -9,7 +9,7 @@
  
  
  
-@@ -2888,7 +2888,7 @@
+@@ -2888,7 +2888,7 @@ fi
  
  
  if test $ac_cv_c_compiler_gnu != no; then