[cmake-developers] [CMake 0013187]: ARGVx is not reset in recursive function calls

Mantis Bug Tracker mantis at public.kitware.com
Thu May 3 13:40:49 EDT 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=13187 
====================================================================== 
Reported By:                Patrick Spendrin
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13187
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-05-03 13:40 EDT
Last Modified:              2012-05-03 13:40 EDT
====================================================================== 
Summary:                    ARGVx is not reset in recursive function calls
Description: 
When recursively calling functions, ARGV0-ARGV9 are inherited by the inner
function calls - this will make it hard to decide for the inner function calls
to decide whether they got an argument or not.



Steps to Reproduce: 
run the following code:
function(testfunc1)
    message(STATUS "testfunc1: ${ARGV0} ${ARGV1} ${ARGV2}")
    testfunc2("${ARGV0}")
endfunction(testfunc1)

function(testfunc2)
    message(STATUS "testfunc2: ${ARGV0} ${ARGV1} ${ARGV2}")
endfunction(testfunc2)

testfunc1(para1 para2 para3)

expected result is 
L:\>cmake -P C:\kde\kde-stable\tmp\cmake-argv-bug\argv-bug.cmake
-- testfunc1: para1 para2 para3
-- testfunc2: para1

actual result is
L:\>cmake -P C:\kde\kde-stable\tmp\cmake-argv-bug\argv-bug.cmake
-- testfunc1: para1 para2 para3
-- testfunc2: para1 para2 para3

Additional Information: 
ARGN works as expected;
It is unclear whether anybody could rely on this bug, since it likely depends on
the order in which functions are called.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-05-03 13:40 Patrick SpendrinNew Issue                                    
======================================================================




More information about the cmake-developers mailing list