pike.git / src / pike_types.c

version» Context lines:

pike.git/src/pike_types.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: pike_types.c,v 1.281 2007/04/05 16:01:35 grubba Exp $ + || $Id: pike_types.c,v 1.282 2007/04/06 11:16:33 grubba Exp $   */      #include "global.h"   #include <ctype.h>   #include "svalue.h"   #include "pike_types.h"   #include "stralloc.h"   #include "stuff.h"   #include "array.h"   #include "program.h"
pike.git/src/pike_types.c:4947:    if (!(tmp2 = low_new_check_call(fun_type, arg_type->cdr, flags))) {    free_type(tmp);    return NULL;    }    res = and_pike_types(tmp, tmp2);    free_type(tmp);    free_type(tmp2);    return res;       case T_VOID: +  if (!(flags & CALL_7_6)) {    /* Promote void arguments to zero. */    arg_type = zero_type_string; -  +  }    break;    }       if (!(tmp = lower_new_check_call(fun_type, arg_type, flags   #ifdef PIKE_TYPE_DEBUG    , 0   #endif    ))) {    return NULL;    }
pike.git/src/pike_types.c:5353:    return res;   }      /* NOTE: fun_type loses a reference. */   struct pike_type *new_check_call(struct pike_string *fun_name,    struct pike_type *fun_type,    node *args, INT32 *argno)   {    struct pike_type *tmp = NULL;    struct pike_type *res = NULL; +  int flags = 0;       debug_malloc_touch(fun_type);       while (args && (args->token == F_ARG_LIST) && fun_type) {    fun_type = new_check_call(fun_name, fun_type, CAR(args), argno);    debug_malloc_touch(fun_type);    args = CDR(args);    }       if (!args || !fun_type) {
pike.git/src/pike_types.c:5378: Inside #if defined(PIKE_DEBUG)
     #ifdef PIKE_DEBUG    if (l_flag>2) {    fprintf(stderr, " Checking argument #%d... ", *argno);    simple_describe_type(args->type);    fprintf(stderr, "\n fun_type: ");    simple_describe_type(fun_type);    }   #endif /* PIKE_DEBUG */    +  if (TEST_COMPAT(7, 6)) { +  /* Attempt to reduce strictness to Pike 7.6 levels. */ +  flags |= CALL_7_6; +  } +     if (args->token == F_PUSH_ARRAY) {    struct pike_type *prev = fun_type;    int cnt = 256;    /* This token can expand to anything between zero and MAX_ARGS args. */      #ifdef PIKE_DEBUG    if (l_flag>2) {    fprintf(stderr, "\n The argument is a splice operator.\n");    }   #endif /* PIKE_DEBUG */       copy_pike_type(res, fun_type);       /* Loop until we get a stable fun_type, or it's an invalid argument. */    while ((fun_type = low_new_check_call(debug_malloc_pass(prev), -  debug_malloc_pass(args->type), 0)) && +  debug_malloc_pass(args->type), +  flags)) &&    (fun_type != prev) && --cnt) {      #ifdef PIKE_DEBUG    if (l_flag>4) {    fprintf(stderr, "\n sub_result_type: ");    simple_describe_type(fun_type);    }   #endif /* PIKE_DEBUG */       res = dmalloc_touch(struct pike_type *,
pike.git/src/pike_types.c:5446: Inside #if defined(PIKE_DEBUG)
     #ifdef PIKE_DEBUG    if (l_flag>2) {    fprintf(stderr, "\n result: ");    simple_describe_type(res);    fprintf(stderr, " OK.\n");    }   #endif /* PIKE_DEBUG */       return res; -  } else if ((res = low_new_check_call(fun_type, args->type, 0))) { +  } else if ((res = low_new_check_call(fun_type, args->type, flags))) {    /* OK. */   #ifdef PIKE_DEBUG    if (l_flag>2) {    fprintf(stderr, " OK.\n");    }   #endif /* PIKE_DEBUG */    if (lex.pragmas & ID_STRICT_TYPES) { -  if (!(tmp = low_new_check_call(fun_type, args->type, CALL_STRICT))) { +  if (!(tmp = low_new_check_call(fun_type, args->type, +  flags|CALL_STRICT))) {    yywarning("Type mismatch in argument %d to %S.",    *argno, fun_name);    if ((tmp = get_first_arg_type(fun_type, 0))) {    yytype_error(NULL, tmp, args->type, YYTE_IS_WARNING);    free_type(tmp);    } else {    yytype_error(NULL, NULL, args->type, YYTE_IS_WARNING);    }    } else {    free_type(tmp);    }    }    free_type(fun_type);    return res;    }    -  if ((tmp = get_first_arg_type(fun_type, 0))) { +  if ((tmp = get_first_arg_type(fun_type, flags))) {    struct pike_type *tmp2;      #ifdef PIKE_DEBUG    if (l_flag>2) {    fprintf(stderr, " Bad argument.\n");    }   #endif /* PIKE_DEBUG */    my_yyerror("Bad argument %d to %S.",    *argno, fun_name);    yytype_error(NULL, tmp, args->type, 0);       /* Try advancing with the suggested type, so that we can check    * the rest of the arguments.    */ -  if ((tmp2 = low_new_check_call(fun_type, tmp, 0))) { +  if ((tmp2 = low_new_check_call(fun_type, tmp, flags))) {    /* Succeeded. */    free_type(fun_type);    free_type(tmp);   #ifdef PIKE_DEBUG    if (l_flag>2) {    fprintf(stderr, " Created continuation type: ");    simple_describe_type(tmp2);    fprintf(stderr, " OK.\n");    }   #endif /* PIKE_DEBUG */