pike.git/
src/
language.yacc
Branch:
Tag:
Non-build tags
All tags
No tags
2008-04-25
2008-04-25 13:04:15 by Henrik Grubbström (Grubba) <grubba@grubba.org>
4d889f6457a4ec90a34d3336b0f28a5af5b58e8b (
28
lines) (+
17
/-
11
)
[
Show
|
Annotate
]
Branch:
7.9
Don't warn about unused voidable variables.
Rev: src/language.yacc:1.415
2:
|| 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: language.yacc,v 1.
414
2008/04/
18
19
:
57
:
13
grubba Exp $
+
|| $Id: language.yacc,v 1.
415
2008/04/
25
13
:
04
:
15
grubba Exp $
*/ %pure_parser
3833:
} | TOK_PREDEF TOK_COLON_COLON TOK_IDENTIFIER {
+
struct compilation *c = THIS_COMPILATION;
node *tmp2;
-
extern dynamic_buffer used_modules;
+
-
if(Pike_compiler->last_identifier) free_string(Pike_compiler->last_identifier);
+
if(Pike_compiler->last_identifier)
+
free_string(Pike_compiler->last_identifier);
copy_shared_string(Pike_compiler->last_identifier, $3->u.sval.u.string);
-
tmp2=mkconstantsvaluenode(
(struct svalue *) used
_
modules.s.str
);
-
$$=index_node(tmp2, "predef", $3->u.sval.u.string);
+
tmp2
=
mkconstantsvaluenode(
&c->default
_
module
);
+
$$
=
index_node(tmp2, "predef", $3->u.sval.u.string);
if(!$$->name) add_ref( $$->name=$3->u.sval.u.string ); free_node(tmp2);
3852:
} | TOK_VERSION TOK_COLON_COLON TOK_IDENTIFIER {
+
struct compilation *c = THIS_COMPILATION;
int old_major = Pike_compiler->compat_major; int old_minor = Pike_compiler->compat_minor;
-
extern dynamic_buffer used_modules;
-
struct svalue *predef = (struct svalue *)used_modules.s.str;
+
struct svalue *efun = NULL; change_compiler_compatibility($1->u.integer.a, $1->u.integer.b);
3865:
copy_shared_string(Pike_compiler->last_identifier, $3->u.sval.u.string); /* Check predef:: first, and then the modules. */
-
if (
Pike_compiler->num_used_modules &&
-
(
predef
->type == T_MAPPING) &&
-
(efun = low_mapping_lookup(
predef
->u.mapping, &($3->u.sval)))) {
+
if (
(c
->
default
_
module.
type == T_MAPPING) &&
+
(efun = low_mapping_lookup(
c
->
default_module.
u.mapping,
+
&($3->u.sval)))) {
$$ = mkconstantsvaluenode(efun); } else if (!($$ = resolve_identifier(Pike_compiler->last_identifier))) { if((Pike_compiler->flags & COMPILATION_FORCE_RESOLVE) ||
4443:
copy_shared_string(frame->variable[var].file, THIS_COMPILATION->lex.current_file);
+
if (pike_types_le(void_type_string, type)) {
+
/* Don't warn about unused voidable variables. */
+
frame->variable[var].flags = LOCAL_VAR_IS_USED;
+
} else {
frame->variable[var].flags = 0;
-
+
}
frame->current_number_of_locals++; if(frame->current_number_of_locals > frame->max_number_of_locals)