Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77519 - trunk/tools/build/v2/engine
From: steven_at_[hidden]
Date: 2012-03-24 17:49:13


Author: steven_watanabe
Date: 2012-03-24 17:49:12 EDT (Sat, 24 Mar 2012)
New Revision: 77519
URL: http://svn.boost.org/trac/boost/changeset/77519

Log:
Make sure that the arguments of built-in rules are actually checked.
Text files modified:
   trunk/tools/build/v2/engine/function.c | 13 ++++++++++---
   1 files changed, 10 insertions(+), 3 deletions(-)

Modified: trunk/tools/build/v2/engine/function.c
==============================================================================
--- trunk/tools/build/v2/engine/function.c (original)
+++ trunk/tools/build/v2/engine/function.c 2012-03-24 17:49:12 EDT (Sat, 24 Mar 2012)
@@ -2547,14 +2547,15 @@
     }
 }
 
+static struct arg_list * arg_list_compile_builtin( const char * * args, int * num_arguments );
+
 FUNCTION * function_builtin( LIST * ( * func )( FRAME * frame, int flags ), int flags, const char * * args )
 {
     BUILTIN_FUNCTION * result = BJAM_MALLOC( sizeof( BUILTIN_FUNCTION ) );
     result->base.type = FUNCTION_BUILTIN;
     result->base.reference_count = 1;
     result->base.rulename = 0;
- result->base.formal_arguments = 0;
- result->base.num_formal_arguments = 0;
+ result->base.formal_arguments = arg_list_compile_builtin( args, &result->base.num_formal_arguments );
     result->func = func;
     result->flags = flags;
     return (FUNCTION *)result;
@@ -2741,6 +2742,7 @@
             case ARG_STAR:
                  type_check_range( formal_arg->type_name, actual_iter, actual_end, frame, function, formal_arg->arg_name );
                 actual_iter = actual_end;
+ break;
             case ARG_VARIADIC:
                 return;
             }
@@ -3063,8 +3065,13 @@
             struct argument_compiler arg_comp[ 1 ];
             struct arg_list arg;
             argument_compiler_init( arg_comp );
- for ( ; *args && !strcmp( *args, ":" ); ++args )
+ for ( ; *args; ++args )
             {
+ if ( strcmp( *args, ":" ) == 0 )
+ {
+ ++args;
+ break;
+ }
                 argument_compiler_add( arg_comp, object_new( *args ), constant_builtin, -1 );
             }
             arg = arg_compile_impl( arg_comp, constant_builtin, -1 );


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk