Skip to content
  • Sven/Sarah Barth's avatar
    Add support for Default() intrinsic. For now this is only (fully) supported · bd19a16b
    Sven/Sarah Barth authored
    in code and not in constants. In the case of primitive types constant nodes
    are used while complex types like arrays, records and objects use a local
    variable which is initialized to zero once at the entry of the method (the
    variable is reused if Default() is used for the same type multiple times in
    the same method). For this a new compilerproc was added which uses FillChar
    to initialize the given memory area to zero.
    This fixes Mantis #9420.
    
    + psystem.pas: Added Default symbol to system unit
    + htypechk.pas: Added function "is_valid_for_default" which checks recursively
                    whether the given type can be used with Default at all. 
                    Forbidden types are files, helpers, ObjC and C++ types. This
                    check is used for records, arrays and objects only if the mode
                    is a non-Delphi one, as Delphi ignores these types on lower
                    levels.
    + msg/errore.msg: Added error message for unsupported types for Default()
    + symconst.pas: Added a new enum value vo_is_default_var which is used for the
                    local variables utilized by Default() so their initalization
                    and finalization can be avoided.
    + pexpr.pas: Add handling of Default() intrinsic to "statement_syssym"
    + ninl.pas: Extended tinlinenode by a method which returns the correct node for
                a Default() and used that method in handle_typecheck.
    * ncgutil.pas: Check for new flag "vo_is_default_var" when initializing and
                   finalizing local variables.
    * ppu.pas: increase PPU version
    + psub.pas: 
      * Added a new routine which zeros defaultvars of a symtable.
      * Use this routine inside "initializevars".
      * Also use this routine to initialize the staticsymtable of the unit/program.
    * Adjusted ppudump, because of the new enum value.
    + Added implementation of fpc_zeromem to system unit.
    + Added tests for Default()
    
    git-svn-id: trunk@20629 -
    bd19a16b