bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Pass command line location to skeleton_arg and language_argmatch


From: Akim Demaille
Subject: [PATCH] Pass command line location to skeleton_arg and language_argmatch.
Date: Fri, 07 Nov 2008 20:38:43 -0000

        * src/getargs.h, src/getargs.c (skeleton_arg, language_argmatch):
        The location argument is now mandatory.
        Adjust all dependencies.
        (getargs): Use command_line_location.
---
 ChangeLog        |    8 ++++++++
 src/getargs.c    |   18 ++++++------------
 src/getargs.h    |    6 +++---
 src/parse-gram.c |    4 ++--
 src/parse-gram.y |    4 ++--
 5 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3bcc555..6359479 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2008-11-07  Akim Demaille  <address@hidden>
 
+       Pass command line location to skeleton_arg and language_argmatch.
+       * src/getargs.h, src/getargs.c (skeleton_arg, language_argmatch):
+       The location argument is now mandatory.
+       Adjust all dependencies.
+       (getargs): Use command_line_location.
+
+2008-11-07  Akim Demaille  <address@hidden>
+
        -D, --define.
        * src/getargs.c (usage): Document -D.
        Fix help string for --locations.
diff --git a/src/getargs.c b/src/getargs.c
index 34cb587..c36cabf 100644
--- a/src/getargs.c
+++ b/src/getargs.c
@@ -361,7 +361,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A 
PARTICULAR PURPOSE.\n\
 `--------------------------------------*/
 
 void
-skeleton_arg (char const *arg, int prio, location const *loc)
+skeleton_arg (char const *arg, int prio, location loc)
 {
   if (prio < skeleton_prio)
     {
@@ -372,15 +372,12 @@ skeleton_arg (char const *arg, int prio, location const 
*loc)
     {
       char const *msg =
        _("multiple skeleton declarations are invalid");
-      if (loc)
-       complain_at (*loc, msg);
-      else
-       complain (msg);
+      complain_at (loc, msg);
     }
 }
 
 void
-language_argmatch (char const *arg, int prio, location const *loc)
+language_argmatch (char const *arg, int prio, location loc)
 {
   char const *msg;
 
@@ -401,10 +398,7 @@ language_argmatch (char const *arg, int prio, location 
const *loc)
   else
     return;
 
-  if (loc)
-    complain_at (*loc, msg, arg);
-  else
-    complain (msg, arg);
+  complain_at (loc, msg, arg);
 }
 
 /*----------------------.
@@ -546,11 +540,11 @@ getargs (int argc, char *argv[])
        break;
 
       case 'L':
-       language_argmatch (optarg, 0, NULL);
+       language_argmatch (optarg, 0, command_line_location ());
        break;
 
       case 'S':
-       skeleton_arg (AS_FILE_NAME (optarg), 0, NULL);
+       skeleton_arg (AS_FILE_NAME (optarg), 0, command_line_location ());
        break;
 
       case 'T':
diff --git a/src/getargs.h b/src/getargs.h
index 8449626..c9e3f48 100644
--- a/src/getargs.h
+++ b/src/getargs.h
@@ -1,7 +1,7 @@
 /* Parse command line arguments for bison.
 
    Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002, 2003, 2004,
-   2005, 2006, 2007 Free Software Foundation, Inc.
+   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
    This file is part of Bison, the GNU Compiler Compiler.
 
@@ -132,7 +132,7 @@ extern int warnings_flag;
 void getargs (int argc, char *argv[]);
 
 /* Used by parse-gram.y.  */
-void language_argmatch (char const *arg, int prio, location const *loc);
-void skeleton_arg (const char *arg, int prio, location const *loc);
+void language_argmatch (char const *arg, int prio, location loc);
+void skeleton_arg (const char *arg, int prio, location loc);
 
 #endif /* !GETARGS_H_ */
diff --git a/src/parse-gram.c b/src/parse-gram.c
index 3ad4218..76d25ef 100644
--- a/src/parse-gram.c
+++ b/src/parse-gram.c
@@ -2029,7 +2029,7 @@ yyreduce:
 
 /* Line 1457 of yacc.c  */
 #line 257 "parse-gram.y"
-    { language_argmatch ((yyvsp[(2) - (2)].chars), 1, &(yylsp[(1) - (2)])); }
+    { language_argmatch ((yyvsp[(2) - (2)].chars), 1, (yylsp[(1) - (2)])); }
 
 /* Line 1457 of yacc.c  */
 #line 2036 "../../../src/parse-gram.c"
@@ -2181,7 +2181,7 @@ yyreduce:
           skeleton_user = uniqstr_new (skeleton_build);
           free (skeleton_build);
         }
-      skeleton_arg (skeleton_user, 1, &(yylsp[(1) - (2)]));
+      skeleton_arg (skeleton_user, 1, (yylsp[(1) - (2)]));
     }
 
 /* Line 1457 of yacc.c  */
diff --git a/src/parse-gram.y b/src/parse-gram.y
index 745dbc4..a1740e7 100644
--- a/src/parse-gram.y
+++ b/src/parse-gram.y
@@ -254,7 +254,7 @@ prologue_declaration:
       muscle_code_grow ("initial_action", action.code, @2);
       code_scanner_last_string_free ();
     }
-| "%language" STRING           { language_argmatch ($2, 1, &@1); }
+| "%language" STRING           { language_argmatch ($2, 1, @1); }
 | "%lex-param" "{...}"         { add_param ("lex_param", $2, @2); }
 | "%locations"                  { locations_flag = true; }
 | "%name-prefix" STRING         { spec_name_prefix = $2; }
@@ -300,7 +300,7 @@ prologue_declaration:
           skeleton_user = uniqstr_new (skeleton_build);
           free (skeleton_build);
         }
-      skeleton_arg (skeleton_user, 1, &@1);
+      skeleton_arg (skeleton_user, 1, @1);
     }
 | "%token-table"                { token_table_flag = true; }
 | "%verbose"                    { report_flag |= report_states; }
-- 
1.6.0.2.588.g3102





reply via email to

[Prev in Thread] Current Thread [Next in Thread]