pike.git / src / program.c

version» Context lines:

pike.git/src/program.c:7181:       /* If this is an lfun, match against the predefined type. */    if ((lfun_type = low_mapping_string_lookup(lfun_types, name))) {    int orig_pragmas = c->lex.pragmas;   #ifdef PIKE_DEBUG    if (TYPEOF(*lfun_type) != T_TYPE) {    Pike_fatal("Bad entry in lfun_types for key \"%s\"\n", name->str);    }   #endif /* PIKE_DEBUG */    if (Pike_compiler->compiler_pass == COMPILER_PASS_LAST) { +  struct svalue *lfun_id = low_mapping_string_lookup(lfun_ids, name); +  if (lfun_id && (TYPEOF(*lfun_id) == PIKE_T_INT)) { +  if (lfun_compat_strings[lfun_id->u.integer] == name) { +  /* Compat lfun. +  * +  * Check if we actually have an lfun. +  * +  * NB: We're in the last pass, so all symbols should be +  * present (at least for the Pike code case). +  */ +  if ((lfun >= LFUN__ITERATOR_NEXT_FUN) && +  (lfun <= LFUN__ITERATOR_VALUE_FUN)) { +  /* Only fallback and warn if all three are implemented in old style. +  * +  * Otherwise the symbols are probably used for some +  * other purpose. +  * +  * Cf Calendar.TimeRanges.TimeRange. +  */ +  int iterator_lfun; +  for (iterator_lfun = LFUN__ITERATOR_NEXT_FUN; +  iterator_lfun <= LFUN__ITERATOR_VALUE_FUN; +  iterator_lfun++) { +  if (really_low_find_shared_string_identifier( +  lfun_compat_strings[iterator_lfun], +  dmalloc_touch(struct program *, p), +  SEE_PROTECTED) < 0) { +  /* One of them is missing. */ +  goto skip_special_cases; +  } +  } +  } +  } +  }    /* Inhibit deprecation warnings during the comparison. */    c->lex.pragmas |= ID_NO_DEPRECATION_WARNINGS;    if (!pike_types_le(type, lfun_type->u.type)) {    int level = REPORT_NOTICE;    if (!match_types(type, lfun_type->u.type)) {    level = REPORT_ERROR;    } else if (c->lex.pragmas & ID_STRICT_TYPES) {    level = REPORT_WARNING;    }    if (level != REPORT_NOTICE) {
pike.git/src/program.c:7203:    "Type mismatch for callback function %S:", name);    }    }    c->lex.pragmas = orig_pragmas;       /* NB: define_function() is called multiple times... */    if (((flags & (ID_PROTECTED|ID_PRIVATE)) != ID_PROTECTED) && func &&    !(orig_pragmas & ID_NO_DEPRECATION_WARNINGS) &&    !deprecated_typep(type)) {    if (!(flags & (ID_PROTECTED|ID_PRIVATE))) { -  yywarning("Lfun %S is public.", name); +  yywarning("Lfun %S() is public.", name);    } else { -  yywarning("Lfun %S is private.", name); +  yywarning("Lfun %S() is private.", name);    }    }    }    } else if (((name->len > 3) &&    (index_shared_string(name, 0) == '`') &&    (index_shared_string(name, 1) == '-') &&    (index_shared_string(name, 2) == '>')) ||    ((name->len > 1) &&    (index_shared_string(name, 0) == '`') &&    wide_isidchar(index_shared_string(name, 1)))) {
pike.git/src/program.c:7303:    * as expected.    *    * FIXME: Force PRIVATE?    */    flags |= ID_PROTECTED /* | ID_PRIVATE | ID_INLINE | ID_USED */;    free_type(symbol_type);    free_string(symbol);    }    }    +  skip_special_cases: +     if(IDENTIFIER_IS_C_FUNCTION(function_flags))    prog->flags |= PROGRAM_HAS_C_METHODS;       if (Pike_compiler->compiler_pass == COMPILER_PASS_FIRST) {    /* Mark the type as tentative by setting the runtime-type    * to T_MIXED.    *    * NOTE: This should be reset to T_FUNCTION in pass 2.    */    run_time_type = T_MIXED;