[Cmake-commits] [cmake-commits] king committed cmCommandArgumentParserHelper.cxx 1.22 1.23

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Mar 25 10:37:01 EDT 2009


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv16835/Source

Modified Files:
	cmCommandArgumentParserHelper.cxx 
Log Message:
BUG: Fix CMAKE_CURRENT_LIST_FILE in macros

The value of CMAKE_CURRENT_LIST_FILE is supposed to be the list file
currently being executed.  Before macros were introduced this was always
the context of the argument referencing the variable.

Our original implementation of macros replaced the context of command
arguments inside the macro with that of the arguments of the calling
context.  This worked recursively, but only worked when macros had at
least one argument.  Furthermore, it caused parsing errors of the
arguments to report the wrong location (calling context instead of line
with error).

The commit "Improve context for errors in macros" fixed the latter bug
by keeping the lexical context of command arguments in macros.  It broke
evaluation of CMAKE_CURRENT_LIST_FILE because the calling context was no
longer preserved in the argument referencing the variable.  However,
since our list file processing now maintains the proper value of
CMAKE_CURRENT_LIST_FILE with dynamic scope we no longer need the context
of the argument and can just evaluate the variable normally.


Index: cmCommandArgumentParserHelper.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCommandArgumentParserHelper.cxx,v
retrieving revision 1.22
retrieving revision 1.23
diff -C 2 -d -r1.22 -r1.23
*** cmCommandArgumentParserHelper.cxx	25 Sep 2008 14:21:14 -0000	1.22
--- cmCommandArgumentParserHelper.cxx	25 Mar 2009 14:36:57 -0000	1.23
***************
*** 116,124 ****
      return 0;
      }
!   if(this->FileName && strcmp(var, "CMAKE_CURRENT_LIST_FILE") == 0)
!     {
!     return this->AddString(this->FileName);
!     }
!   else if(this->FileLine >= 0 && strcmp(var, "CMAKE_CURRENT_LIST_LINE") == 0)
      {
      cmOStringStream ostr;
--- 116,120 ----
      return 0;
      }
!   if(this->FileLine >= 0 && strcmp(var, "CMAKE_CURRENT_LIST_LINE") == 0)
      {
      cmOStringStream ostr;



More information about the Cmake-commits mailing list