mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-03 05:32:48 +01:00
This change became necessary of the following reasons:
- Records don't support inheritance, thus for "record helpers" some creativity would have been necessary to implement them; with the new implementation this is more easily
- the new approach allows for easy checks regarding virtual methods and their overrides which would have been more complicated in the old variant
- if someone feels the need the types of helpers (object, interface) can be added rather easily
- unnecessary things like VMT generation can be disabled now
details:
- msg*:
* moved some messages from parser to type
* adjusted a message ("class helper" => "helper")
- symdef.pas:
* renamed "helperparent" to "extendeddef" and changed its type from "tobjectdef" to "tabstractrecorddef", so records can be extended as well (somewhen in the near future)
* removed "finish_class_helper" method as it isn't necessary (luckily I haven't yet adjusted the ObjC variant)
* changed name of "is_objectpascal_classhelper" to "is_objectpascal_helper" to reflect that this function applies to all helper types
* tobjectdef.create: ImplementedInterfaces isn't created for odt_helper anymore
* tobjectdef.alignment: for helpers it's the same as for classes although this shouldn't be used anywhere...
* tobjectdef.vmtmethodoffset: set to 0 for helpers to be sure...
* tobjectdef.needs_inittable: not needed for helpers (no fields allowed)
* is_objectpascal_helper: only needs check for "odt_helper" object type
- symconst.pas:
* changed odt_classhelper to more general odt_helper
* added new type "thelpertype" which is used to check that "(record|class) helper" corresponds with the given extended type (as Delphi XE checks this as well this strict solution can be kept for modes Delphi and ObjFPC)
- symtable.pas:
* extended "searchsym_in_class" with the possibility to disable the search for helper methods (needed for inherited) => this implies changing all occurences of "searchsym_in_class" with a "true" except some special locations
* renamed "search_objectpascal_classhelper" to "search_objectpascal_helper"
* searchsym_in_class:
** when an extended method is defined with "overload" it can be that a same named method of the extended class might be called (sadly this means that this search was unnecessary...)
** contextclassh is the def of the helper in the case of an inherited call inside the helper's implementation
** when methods inside a helper are searched, it must be searched in the extended type first
- ptype.pas:
* single_type is used to parse the parent of a helper as well, so allow a helper if the stoParseClassParent is given (needs check in pdecobj.pas/parse_class_parents for normal classes)
* read_named_type: currently the only case when something <> ht_none is passed to the modified parse_objdec (see below) is when the combination "class helper" is encountered ("record helper" will be another one)
- pinline.pas: adjustment for extended "searchsym_in_class"
- pexpr.pas:
* adjustments regarding "searchsym_in_class" and "is_objectpascal_helper"
* factor/factor_read_id: moved the check for "TSomeClassType.SomeMethod" outside of the "is_class" check
* factor:
** in case of an inherited we need to search inside the extended type first (Note: this needs to be extended to find methods in the helper parent if no method is found in the extended type)
** we also need to disable the search for helper methods when searching for an inherited method (Note: it might be better to introduce a enum to decide whether a helper method should search before or after the methods of the extended type or even never)
- pdecsub.pas:
* insert_self_and_vmt_para: in a helper the type of Self is of the extended type
* pd_abstract, pd_final: more nice error message
* pd_override, pd_message, pd_reintroduce: adjusted checks because now "is_class" is no longer true for helpers
* proc_direcdata: allowed "abstract" for helpers (only to produce a more nice error message)
* parse_proc_direc: adjustment because of "is_objectpascal_helper"
- pdecobj.pas:
* adjustments regarding "is_objectpascal_helper"
* adjusted object_dec to take the type of the helper (class, record) as a parameter to be able to check whether the correct extended type was given
* struct_property_dec: properties are allowed in helpers
* parse_object_options: nothing to be parsed for helpers (at least I hope so ^^)
* parse_parent_classes:
** the parent of a helper is now parsed as a normal parent, the extended type is parsed in an extra procedure
** check for "sealed" no longer needed
** added check that the parsed parent of a helper is indeed a helper
** allow to parse the closing ")" of the helper's parent
* parse_extended_class:
** new procedure that parses the type which is extended
** it checks that the extended type is a class for "class helper" and a record for "record helper"
** it checks that a helper extends the same class or a subclass for class helpers
** it checks that a helper extends the same record for record helpers
* parse_object_members:
** "type", "const", "var" is allowed in helpers
** don't exclude flags regarding virtual methods, they are needed for the checks in mode Delphi (this implies that VMT loading must be disabled for helpers)
* object_dec:
** don't change "odt_helper" to "odt_class", but still include the "oo_is_classhelper" flag
** allow the parsing of object options (there are none)
** parse the extended type for helpers
- pdecl.pas
* adjustment because of extension of object_dec
* types_dec: remove the call to finish_classhelper
- objcdef.pas
* objcaddencodedtype, objcdochecktype: add references to helpers as implicit pointers although that should not be used in any way...
- nld.pas
* tloadnode.pass_typecheck: self is a reference to the extended type
- nflw.pas
* create_for_in_loop: adjustment because of changed procedure and inheritance type
- ncgrtti.pas
* TRTTIWriter.write_rtti_data: disable for helpers for now (I need to check what Delphi does here)
- ncgld.pas
* tcgloadnode.pass_generate_code: virtual methods of helpers are treated as normal methods
- ncgcal.pas
* tcgcallnode.pass_generate_code: virtual methods of helpers are treated as normal methods
- ncal.pas
* tcallnode.pass_typecheck: adjust for extension of tcallcandidates constructor
- htypechk.pas
* tcallcandidates declaration: extend some methods to (dis)allow the search for helper methods (needed for inherited)
* tcallcandidates.collect_overloads_in_struct:
** search first in helpers for methods and stop if none carries the "overload" flag
** move the addition of the procsyms to an extra nested procedure because it's used for helper methods and normal struct methods
git-svn-id: branches/svenbarth/classhelpers@16947 -
|
||
|---|---|---|
| .. | ||
| alpha | ||
| arm | ||
| avr | ||
| html | ||
| i386 | ||
| ia64 | ||
| m68k | ||
| mips | ||
| msg | ||
| powerpc | ||
| powerpc64 | ||
| ppcgen | ||
| sparc | ||
| systems | ||
| utils | ||
| vis | ||
| x86 | ||
| x86_64 | ||
| aasmbase.pas | ||
| aasmdata.pas | ||
| aasmsym.pas | ||
| aasmtai.pas | ||
| aggas.pas | ||
| aopt.pas | ||
| aoptbase.pas | ||
| aoptcs.pas | ||
| aoptda.pas | ||
| aoptobj.pas | ||
| asmutils.pas | ||
| assemble.pas | ||
| browcol.pas | ||
| bsdcompile | ||
| catch.pas | ||
| ccharset.pas | ||
| cclasses.pas | ||
| cfidwarf.pas | ||
| cfileutl.pas | ||
| cg64f32.pas | ||
| cgbase.pas | ||
| cgobj.pas | ||
| cgutils.pas | ||
| cmsgs.pas | ||
| comphook.pas | ||
| compiler.pas | ||
| compinnr.inc | ||
| comprsrc.pas | ||
| constexp.pas | ||
| COPYING.txt | ||
| cp437.pas | ||
| cp850.pas | ||
| cp866.pas | ||
| cp1251.pas | ||
| cp8859_1.pas | ||
| cp8859_5.pas | ||
| crefs.pas | ||
| cresstr.pas | ||
| cstreams.pas | ||
| cutils.pas | ||
| dbgbase.pas | ||
| dbgdwarf.pas | ||
| dbgstabs.pas | ||
| defcmp.pas | ||
| defutil.pas | ||
| export.pas | ||
| expunix.pas | ||
| finput.pas | ||
| fmodule.pas | ||
| fpccrc.pas | ||
| fpcdefs.inc | ||
| fppu.pas | ||
| gendef.pas | ||
| globals.pas | ||
| globtype.pas | ||
| htypechk.pas | ||
| impdef.pas | ||
| import.pas | ||
| link.pas | ||
| macho.pas | ||
| machoutils.pas | ||
| Makefile | ||
| Makefile.fpc | ||
| MPWMake | ||
| msgidx.inc | ||
| msgtxt.inc | ||
| nadd.pas | ||
| nbas.pas | ||
| ncal.pas | ||
| ncgadd.pas | ||
| ncgbas.pas | ||
| ncgcal.pas | ||
| ncgcnv.pas | ||
| ncgcon.pas | ||
| ncgflw.pas | ||
| ncginl.pas | ||
| ncgld.pas | ||
| ncgmat.pas | ||
| ncgmem.pas | ||
| ncgobjc.pas | ||
| ncgopt.pas | ||
| ncgrtti.pas | ||
| ncgset.pas | ||
| ncgutil.pas | ||
| ncnv.pas | ||
| ncon.pas | ||
| nflw.pas | ||
| ninl.pas | ||
| nld.pas | ||
| nmat.pas | ||
| nmem.pas | ||
| nobj.pas | ||
| nobjc.pas | ||
| node.pas | ||
| nopt.pas | ||
| nset.pas | ||
| nstate.pas | ||
| nutils.pas | ||
| objcdef.pas | ||
| objcgutl.pas | ||
| objcutil.pas | ||
| ogbase.pas | ||
| ogcoff.pas | ||
| ogelf.pas | ||
| oglx.pas | ||
| ogmacho.pas | ||
| ogmap.pas | ||
| optbase.pas | ||
| optcse.pas | ||
| optdead.pas | ||
| optdfa.pas | ||
| options.pas | ||
| optloop.pas | ||
| opttail.pas | ||
| optutils.pas | ||
| optvirt.pas | ||
| owar.pas | ||
| owbase.pas | ||
| parabase.pas | ||
| paramgr.pas | ||
| parser.pas | ||
| pass_1.pas | ||
| pass_2.pas | ||
| pbase.pas | ||
| pdecl.pas | ||
| pdecobj.pas | ||
| pdecsub.pas | ||
| pdecvar.pas | ||
| pexports.pas | ||
| pexpr.pas | ||
| pinline.pas | ||
| pmodules.pas | ||
| pp.lpi | ||
| pp.pas | ||
| ppc68k.lpi | ||
| ppc.cfg | ||
| ppc.conf | ||
| ppc.dof | ||
| ppcarm.lpi | ||
| ppcavr.lpi | ||
| ppcmipsel.lpi | ||
| ppcppc.lpi | ||
| ppcsparc.lpi | ||
| ppheap.pas | ||
| ppu.pas | ||
| ppx86_64.lpi | ||
| procinfo.pas | ||
| pstatmnt.pas | ||
| psub.pas | ||
| psystem.pas | ||
| ptconst.pas | ||
| ptype.pas | ||
| raatt.pas | ||
| rabase.pas | ||
| rasm.pas | ||
| rautils.pas | ||
| README.txt | ||
| regvars.pas | ||
| rescmn.pas | ||
| rgbase.pas | ||
| rgobj.pas | ||
| scandir.pas | ||
| scanner.pas | ||
| script.pas | ||
| switches.pas | ||
| symbase.pas | ||
| symconst.pas | ||
| symdef.pas | ||
| symnot.pas | ||
| symsym.pas | ||
| symtable.pas | ||
| symtype.pas | ||
| symutil.pas | ||
| systems.pas | ||
| tgobj.pas | ||
| tokens.pas | ||
| verbose.pas | ||
| version.pas | ||
| widestr.pas | ||
| wpo.pas | ||
| wpobase.pas | ||
| wpoinfo.pas | ||
This directory contains the sources of the Free Pascal Compiler
If you want to compile/modify the compiler, please read first the
programmers manual.
To recompile the compiler, you can use the batch files :
+ mppc386.bat if you want to build a cross compiler from i386 to m68k
+ mppcsparc if you want to build a cross compiler from i386 to SPARC
or
Use the make utility as following
make OS_TARGET="compiler OS target" \
CPU_TARGET="compiler CPU target" \
FPCCPUOPT="Optimization level" \
PP="compiler used to compile FPC" \
COMPILER_OPTIONS="Options passed to compiler" \
If an option is omitted, then target CPU/OS will be same as current CPU/OS
Possibles targets are : linux go32v2 win32 os2 freebsd beos netbsd amiga haiku
atari sunos qnx netware openbsd wdosx palmos macos macosx emx
Possible compiler switches (* marks a currently required switch):
-----------------------------------------------------------------
GDB* support of the GNU Debugger
I386 generate a compiler for the Intel i386+
x86_64 generate a compiler for the AMD x86-64 architecture
M68K generate a compiler for the M68000
SPARC generate a compiler for SPARC
POWERPC generate a compiler for the PowerPC
VIS generate a compile for the VIS
DEBUG version with debug code is generated
EXTDEBUG some extra debug code is executed
SUPPORT_MMX only i386: releases the compiler switch
MMX which allows the compiler to generate
MMX instructions
EXTERN_MSG Don't compile the msgfiles in the compiler, always
use external messagefiles, default for TP
NOAG386INT no Intel Assembler output
NOAG386NSM no NASM output
NOAG386BIN leaves out the binary writer, default for TP
NORA386DIR No direct i386 assembler reader
TEST_GENERIC Test Generic version of code generator
(uses generic RTL calls)
-----------------------------------------------------------------
cpuflags The target processor has status flags (on by default)
cpufpemu The target compiler will also support emitting software
floating point operations
cpu64bitaddr The targets use a 64-bit address space (pointers and
the default integer type are 64 bit)
cpu64bitalu The target cpu has 64-bit registers available (unless
cpu64bitaddr is also defined, pointers and default
integer type remain 32 bit, but the cpu can perform
64 bit calculations directly without needing helpers)
-----------------------------------------------------------------
Required switches for a i386 compiler be compiled by Free Pascal Compiler:
GDB;I386
to build a compiler to SPARC target using a Win32/i386 you just use :
make CPU_TARGET=SPARC