Compiler: Remove some unused local variables.
Compiler: Adjust naming of local variable nodes.
Compiler: Add format attribute to yywarning() and my_yyerror().
Compiler: Changed API for index_node(). index_node() now uses the name of the indexed node to describe the node and to detect indexing of predef::. Also adds a few calls of set_node_name().
{safe_,}pike_fprintf: Add format attribute
Compiler [ADT]: Fix typo.
Compiler [AST]: Fix NULL-deref.
Compiler [AST]: Set the name of nodes in some common cases. Preparation for changing the index_node() API.
Compiler [AST]: Add set_node_name(). This function sets the (previously unused) name field for a node, and is intended to be a description of the parsetree rooted in the node useable for compiler diagnostics. Eg: The name for an F_CONSTANT node could be set to the symbol used to lookup the constant. This is in preparation for some further grammar adjustments.
Compiler: Update handling of scoped variables for generator functions. For generator functions all local variables need to be scoped. Also: mklocalnode(V, -1) now causes the variable to be marked as scoped. Fixes testsuite failures for the generator function tests.
Compiler: Clean up handling of shared local variables. The compiler_frame now keeps track of the shared local variables explicitly. This makes the code much simpler; emit_save_locals() is now almost trivial.
Compiler: Clean up copy_node(). Now that the node hash is no more, there's no reason to perform actual copying of F_LOCAL and F_TRAMPOLINE nodes. Note also that the copying of F_LOCAL_INDIRECT nodes was a bad idea, since then the copy would not get bound to the same F_LOCAL as the original. Fixes "Indexing the NULL value" when eg using the dynamic dot operator on an unbound local variable. Fixes multiple testsuite failures.
Compiler: Fix support for F_LOCAL_INDIRECT nodes in F_CLEAR_LOCAL. Fixes lots of erroneous compilation errors like eg "Argument 1 to foreach() does not match loop variable type.". Needed for #10098.
Compiler: Allocate local variables in two stages. Enables use of F_LOCAL_INDIRECT nodes. Needed for #10098.
Compiler: Add parse-tree node F_VOLATILE_RETURN. This avoids the need (for now) to track the types for the active local variables during docode(). Fixes testsuite failure.
Compiler: Remove redundat fields from struct local_name. Removes the fields `type`, `file` and `line` as the information that was held in them is all available via the `def` node.
Compiler: Restore clearing of local variables when they go out of scope. Fixes issue caused by #10098. Fixes testsuite failure.
Compiler: Local variables now also have a def node. {,low_}add_local_name() now sets an F_LOCAL node as the def for local variables. This simplifies finding all the local variable nodes when we move allocation of the stack frame to docode(). Needed for #10098.
Compiler [Optimizer]: Do not optimize away RETURN_IF_TRUE statements...
Compiler: Fix reference counting bug in copy_node(). The number of references for the new node was copied from the originating node, resulting in leaks if the originating node had more than one reference.
Compiler: Move marking of local lexical scopes to mklocalnode().
Compiler: Rename struct local_variable to struct local_name. Also rename the corresponding field in struct compiler_frame from variable to local_names. This is to make it clearer that the struct is also used for stuff (like eg local functions) other than local variables.
Compiler: Remove some dead code. F_SET_LOCAL_TYPE and F_SET_LOCAL_FLAGS nodes are no more.
Compiler: Resolve local bindings in mklocalnode(). mklocalnode() now returns the definition node directly (if any), rather than returning a F_LOCAL which got converted later by lexical_islocal() et al. NB: F_CLEAR_LOCAL is only valid for F_LOCAL-nodes. Preparation for implementing deferred binding of local variables as required by #10098.
Work in progress: Sakura master
Compiler [Typechecker]: Disabled strict types warning for operator assignment. Disabled due to there not being any syntax to cast the originating value type. Consider: int(2bit) i = 1; i--; // Warning that int(-1..2) can't be assigned to i. See also #10033.
Compiler [Typechecker]: Check that ++ and -- operations are valid. To simplify implementation, F_INC, F_DEC, F_POST_INC and F_POST_DEC nodes now have an int node with a 1 in CDR. Update treeopt.in rules accordingly. Fixes #10033.
Compiler: Use F_CLEAR_LOCAL to mark local variables for clearing. This removes the need for mklocalnode(var, -1). Preparation for having late binding of local variables to stack frame offsets.
Compiler: Retain flags for local vars used in scope We require the LOCAL_VAR_USED_IN_SCOPE flag during optimization. Previously, during optimization, we checked uninitialized memory when decoding dumped modules to decide if certain optimizations apply. Now we initialize the local variable information to zero and dump the flags to local variables when required, so that they can be re-applied when decoding.
Compiler [Typechecker]: Fix optimizer breaking type check. The optimizer converted code like: object(Foo) foo = base_obj; foo++; into object(Foo) foo = base_obj + 1; This caused the type checker to (erroneously) complain about assigning 1 to foo if base_obj was typed as an object that did not have an lfun::`+(). Now it is instead converted into: object(Foo) foo = ([object(Foo)] base_obj) + 1; Also removes the warning about no-op soft casts.
Compiler [Typechecker]: Use fun_name from call_state.
Compiler [Typechecker]: Add function name field to call_state.
Compiler [Typechecker]: Update some more calls of new_get_return_type().
Compiler [Typechecker]: Fix leak of the type zero.
Compiler [Optimizer]: Set OPT_ASSIGNMENT on F_CLEAR_LOCAL nodes. Fixes the optimizer removing clearing of locals at end of block. Fixes testsuite failure.
Compiler [Typechecker]: Update missed call of check_splice_call().
EFUNs: Added Pike 8.0 compat variant of sscanf and array_sscanf().
Compiler [Typechecker]: Add struct call_state. This struct is intended to contain state that is to be propagated between arguments during typechecking of function calls.
Compiler [Typechecker]: Fix multi-reporting of bad assignments mk II.
Compiler [Typechecker]: Complain about bad assignments only in the last pass. Fixes double reporting of "Bad type in assignment.".
Compiler [Typechecker]: Use the correct flags in check_node_type().
Compiler: Improved #pragma compiler_trace.
Compiler [Typechecker]: Never complain about return 0. Do not complain about return 0 that the compiler may have added implicitly.
Compiler [Typechecker]: Fix type for deep automap expressions. Fixes the type for expressions like ({ ({ 1, 2 }), ({ 3,4 }) })[*][*] + 10; Also updated las.cmod::is_automap_arg_list() to return the automap depth. Fixes some testsuite failures.
Compiler [Typechecker]: Fix NULL-deref.
Compiler [Typechecker]: Changed type for F_PUSH_ARRAY nodes. This is in preparation of having check_splice_call() account for any array length restrictions.
Compiler [Typechecker]: Improved checking of assignments.
Compiler [Typechecker]: Document some special cases.
Compiler: Support F_CLEAR_LOCAL in the parse tree. This node is equivalent to F_ASSIGN with 0, but only valid for F_LOCAL variables, and only when the variable will NOT be used afterwards. The intent is to simplify avoiding of errors from the type system for the case where the variable has a type that does not include zero.
Compiler [Typechecker]: Improved checking of splice operator some more.
Compiler [Typechecker]: Improved type check for the splice operator.
Compiler [Typechecker]: Improved type checking of foreach(). Also swaps the expected and got types in some related diagnostics to be more intuitive.
Compiler [Typechecker]: Improved checking of foreach.
Compiler [Typechecker]: Improved zero handling in check_node_type(). Fixes several issues where nullable types match only for zero.
Compiler: Make print_tree() available also --without-debug.
Compiler: Some cosmetic fixes.
Compiler: Move cumulative_parse_error to struct compilation. Fixes spurious erroneous warnings --with-debug about leaked nodes. This appears to have been due to the destruct order and the use of a global variable getting out of phase.
Compiler: Register nodes --with-dmalloc.
Compiler [Typechecker]: Reduce strict type warnings somewhat.
Compiler [Typechecker]: Fixed NULL-deref on specific syntax error. Fixes [LysLysKOM 24260957].
Compiler [Typechecker]: Improved typechecking of assignments. The checker is now informed that void values are converted into UNDEFINED/zero on assignment. Fixes several warnings.
Compiler [Typechecker]: Added flags to pike_types_le().
Compiler [Typechecker]: Second go at fixing some warnings. las.cmod:fix_type_field() is called by optimize() from the leaves going up. This means that the expression in eg `?` has typically already been typechecked when it is received by fix_type_field(). Move the special case to mknode(). CAVEAT EMPTOR: Calling fix_type_field() from mknode() in early compiler passes may cause strange and unexpected failures. The special case type adjustment is therefore only performed in the last compiler pass. Fixes warnings from eg Getopt.
Compiler [Typechecker]: Reduce number of warnings. Do not warn about the type not containing zero in the special case if (string foo = expr) { xxx } as foo will never be zero even though expr may very well be zero.
Compiler: Added F_INITIALIZER node type. This node type behaves identically to F_ASSIGN, but is only used in the case where it is the initializer assignment in a local variable declaration.
Compiler: Swap CAR and CDR for F_DO nodes. This change causes the conditional be in CAR, analogous to '?' and F_FOR nodes, reducing the number of special cases in some upcoming code.
Compiler [Typechecker]: Improved result type for logical or. Fixes some warnings.
Compiler [Typechecker]: Fix some warning messages.
Compiler [Typechecker]: Reduce strictness a bit more.
Compiler [Typechecker]: Fix lots of warnings about assigning zero.
Compiler: Use weaker typecheck when casting result from eval_low(). Fixes issue with attempts to (soft) cast zero to eg string.
Compiler [Typechecker]: Use type_binop() in check_node_type().
Compiler [Typechecker]: Fix checking of foreach().
Compiler: Survive --without-rtl-debug again. low_get_f_name() is only present --with-debug...
Compiler: Added type checking for operator-assignment. Fixes most of bug #10033.
Compiler: Don't attempt to constant-fold automap markers. Attempting to get a constant from an expression like ({ "abc", "cde" })[*] is not possible and generates the compilation error "[*] not supported here", so don't attempt to. Fixes #10039.
Compiler: Reduce the number of soft cast warnings. Fixes some of #10006.
Compiler [Typechecker]: Added DWIM kludge.
Compiler [Typechecker]: Improved type checking. Fixed issue where constant expressions after evaluation sometimes got a partially weaker type. Eg: The expression ({ 0, 1, 2, 3 }) gets the type array(int(4bit)) from evaluating the type, but the type array(4: int) from generating a type from the value. The code generator now adds a soft-cast to the original type, causing the resulting type to be array(4: int(4bit)). Fixes testsuite failures for undumped pikes from eg SSL.Context.
Compiler: Adjusted type checking for foreach.
Compiler: Added push_unlimited_array_type(). This is in preparation for adding support for length-limited array types.
Compiler: print_tree() now knows about continue return and yield.
Compiler: count_memory_in_node_ss() now survives Pike_compiler_base. Pike_compiler_base has no active compiler. Also adds some PIKE_DEBUG checks.
Compiler: Move node_allocator to struct compilation. Allocated nodes may need to live during an entire translation unit. This moves the allocator from struct Pike_compiler (ie compilation.h) to struct compilation (aka CompilationEnvironment.PikeCompiler). Fixes use of already freed nodes after certain syntax errors.
Compiler [generators]: Fix compiler crash F_GENERATOR does not use CDR, so don't try to access it as a node.
Merge branch 'patches/pike221' * patches/pike221: Compiler: object->program_id only exists --with-debug.
Merge branch 'patches/pike221' * patches/pike221: Compiler: Make get_name_of_function() survive destructed functions. Compiler: Improved robustness of placeholder activation.
Compiler [generators]: Added yield().
Compiler: Fixed bug in mkgeneratornode().
Compiler: Added mkgeneratornode().