m4-commit
[Top][All Lists]
Advanced

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

Changes to m4/src/Attic/macro.c,v [branch-1_4]


From: Eric Blake
Subject: Changes to m4/src/Attic/macro.c,v [branch-1_4]
Date: Wed, 11 Oct 2006 17:07:05 +0000

CVSROOT:        /sources/m4
Module name:    m4
Branch:         branch-1_4
Changes by:     Eric Blake <ericb>      06/10/11 17:07:03

Index: src/macro.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/macro.c,v
retrieving revision 1.1.1.1.2.13
retrieving revision 1.1.1.1.2.14
diff -u -b -r1.1.1.1.2.13 -r1.1.1.1.2.14
--- src/macro.c 10 Oct 2006 16:35:23 -0000      1.1.1.1.2.13
+++ src/macro.c 11 Oct 2006 17:07:03 -0000      1.1.1.1.2.14
@@ -310,6 +310,17 @@
   boolean traced;
   int my_call_id;
 
+  /* Report errors at the location where the open parenthesis (if any)
+     was found, but after expansion, restore global state back to the
+     location of the close parenthesis.  This is safe since we
+     guarantee that macro expansion does not alter the state of
+     current_file/current_line (dnl, include, and sinclude are special
+     cased in the input engine to ensure this fact).  */
+  const char *loc_open_file = current_file;
+  int loc_open_line = current_line;
+  const char *loc_close_file;
+  int loc_close_line;
+
   SYMBOL_PENDING_EXPANSIONS (sym)++;
   expansion_level++;
   if (nesting_limit > 0 && expansion_level > nesting_limit)
@@ -342,6 +353,11 @@
          / sizeof (token_data *));
   argv = (token_data **) (obstack_base (&argv_stack) + argv_base);
 
+  loc_close_file = current_file;
+  loc_close_line = current_line;
+  current_file = loc_open_file;
+  current_line = loc_open_line;
+
   if (traced)
     trace_pre (SYMBOL_NAME (sym), my_call_id, argc, argv);
 
@@ -352,6 +368,9 @@
   if (traced)
     trace_post (SYMBOL_NAME (sym), my_call_id, argc, argv, expanded);
 
+  current_file = loc_close_file;
+  current_line = loc_close_line;
+
   --expansion_level;
   --SYMBOL_PENDING_EXPANSIONS (sym);
 




reply via email to

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