Commit Graph

258 Commits

Author SHA1 Message Date
pierre
239944f8d0 + Use DLL name in assembler labels used to import DLL functions/variables
in Windows, Emx and OS2 targets.
    This fixes test failures: test/library/tlib1b.pp and lib2b.pp

    link unit TLinker.AddImportSymbol: Added symmangledname parameter.
    ogbase unit TImportSymbol.Create: Add AMangledName parameter.
    fmodule unit TModule.AddExternalImport: Add symmangledname parameter.
    fppu unit: Also put mangled name string for imported symbol.
    ppu unit: Increase PPUVersion
    utils/ppudump.pp: Adapt to PPU change above.
    systems/T_OS units: Use ImportSymbol.MangledName property to create
    import libraries or .idata sections.

git-svn-id: trunk@17804 -
2011-06-23 11:38:57 +00:00
pierre
09e9d922c7 * Reset F to NIL after freeing in tempclose
git-svn-id: trunk@17683 -
2011-06-07 16:10:25 +00:00
pierre
82ffdb48c9 * Fix tppufile.tempopen method needed for go32v2 cycle
git-svn-id: trunk@17674 -
2011-06-06 16:11:19 +00:00
florian
d19d8de8fe * packed column writing/reading for token recorder, reduces size of fgl.ppu by approx. 10%
git-svn-id: trunk@17512 -
2011-05-20 17:43:11 +00:00
florian
41c18adaf4 * patch by Sven Barth, handle idtoken correctly in the token recorder, resolves #19277
git-svn-id: trunk@17506 -
2011-05-19 19:31:08 +00:00
paul
d21bbc4548 compiler: reduce amount of hints and warnings
git-svn-id: trunk@17350 -
2011-04-20 02:58:52 +00:00
svenbarth
35b47e491c Rebase to revision 17306
git-svn-id: branches/svenbarth/classhelpers@17314 -
2011-04-13 10:04:14 +00:00
florian
c97869bd89 * merge user sections support branch
git-svn-id: trunk@17285 -
2011-04-10 18:08:59 +00:00
florian
0c62133d38 * patch by Mattias Gaertner to allow to override how the compiler reads source/ppu files, resolves #18740
git-svn-id: trunk@17255 -
2011-04-05 20:10:09 +00:00
florian
e4656050a7 + get/putansistring
git-svn-id: branches/usersections@17153 -
2011-03-20 15:39:33 +00:00
svenbarth
80e6498921 Rebase to revision 17096
git-svn-id: branches/svenbarth/classhelpers@17099 -
2011-03-09 16:29:47 +00:00
florian
26fbfaf5a7 + introduce the usage of asizeint/asizeuint for cpus with sizeof("alu")<>sizeof(pointer)
git-svn-id: trunk@17011 -
2011-02-26 20:10:03 +00:00
svenbarth
e19bcfae38 Added a flag set to TSymtable that tells whether it contains a class helper symbol, which is currently only used for static- and globalsymtables.
symconst.pas: added new enum tsymtableoption with set tsymtableoptions; currently it contains only sto_has_classhelper, but refactoring tstoredsymtable.b_needs_init_final is on the todo list
ppu.pas: added a new entry type that will hold the symtable options (91)
symbase.pas: added a new field "tableoptions" to TSymtable which will hold the flags of the symtable (only saved by tstoredsymtable)
symdef.pas: when a tobjectdef is created as a odt_classhelper or odt_objccategory the flag sto_has_classhelper is added to its owning global- or staticsymtable
symtable.pas: 
* load and write the symtable's options as a small set to an entry before the definition entries
* tabstractlocalsymtable needed to annoy me by not calling "inherited writeppu" which does the same as tabstractsymtable did before
* search_last_objectpascal_classhelper: check whether the static- or globalsymtable contains a class helper at all; if not then just continue with the next
utils/ppudump.pas:
* added reading of symtableoptions entry (as readsymtableoptions) based on the reading of tsym options
* added the reading of symtableoptions before every read of the contents of a TSymtable (definitions, symbols)

git-svn-id: branches/svenbarth/classhelpers@16845 -
2011-01-30 09:19:59 +00:00
svenbarth
a7d99a5561 Increased PPU version again so it differs from that in trunk
git-svn-id: branches/svenbarth/classhelpers@16834 -
2011-01-29 10:23:43 +00:00
sergei
58f37dc952 Improvements to dispinterface property handling:
* Create implicit access methods, which hold type information for property parameters and allow parsing/typechecking occur the same way as for regular (non-dispinterface) properties.
+ Introduce separate proctypeoptions for property access methods. They are translated into correct dispatch call types and used to distinguish property access from regular method calls.
* Bump PPU version because new information has been introduced.
- Code specific to dispinterface properties in expression parser is no longer necessary, removed.
* Allow access to default property with [] for dispinterfaces.
+ Extended the test with basic correctness checks for property dispatching.

git-svn-id: trunk@16810 -
2011-01-24 20:30:48 +00:00
svenbarth
d4be11cb42 Implement advanced class helper syntax which allows "inheritance" of class helpers. This is not the same as normal class inheritance as its only used to extend the scope to other class helpers (that pseudo heritage line) when searching for a symbol. The real parent is always the extended class.
- compiler/symdef.pas: add "helperparent" which contains the class helper the current class helper "inherits" from (its real parent is the extended class); it's saved to ppu as well
- compiler/ppu.pas: increase ppu version
- compiler/pdecobj.pas: 
* parse the "parent" of a class helper before parsing the extended class (the real parent)
* also disallow to inherit from class helpers for normal class (and to extend class helpers for class helpers)
* disallow the declarations of fields
* disallow the use of destructors
* don't parse abstract/sealed for class helpers
- compiler/ptyp.pas: _FOR is now parsed inside pdecobj.pas
- compiler/msg*: 
* extended some messages for class helpers
* added some class helper related messages (perhaps the one or other will vanish again...)

git-svn-id: branches/svenbarth/classhelpers@16792 -
2011-01-19 19:39:47 +00:00
paul
55a0fefb1f compiler: implement generic array type:
- add tarraysymtable to store generic type symbols
  - process generic and specialize declarations similar to generic records and classes
  - fix insert_generic_parameter_types to use def passed in argument instead of current_structdef because generic array type can't be assigned to the current_structdef variable
  - increase ppu version because of arraydef changes
  - tests

git-svn-id: trunk@16681 -
2011-01-02 13:16:17 +00:00
paul
86d3e41442 compiler: replace MODESWTICH POINTERARITHMETICS with $POINTERMATH directive, disable pointer arithmetic in delphi mode by default (compatible with delphi), enable pointer arithmetic in fpc/objfpc modes as they had it enabled by default before, add has_pointer_math field to tpointerdef to allow pointer arithmetic with such pointer even if pointer math mode is off (delphi compatible) + tests
git-svn-id: trunk@16651 -
2010-12-29 03:24:28 +00:00
paul
ee6fe6c4f5 compiler: add unary plus node, search for unary plus operator if a type cannot be handled by compiler, increase ppu version because of node types change
git-svn-id: trunk@16640 -
2010-12-26 12:19:28 +00:00
paul
4f274b157c compiler: move objectoptions to tabstractrecorddef because it will be needed for records too
git-svn-id: branches/paul/extended_records@16541 -
2010-12-11 06:48:08 +00:00
paul
26cef34005 compiler:
- move objname, objrealname fields from tobjectdef to tabstractrecorddef, 
  - load and save them from/to ppu file, 
  - use tabstarctrecorddef in some more places where previously code worked for tobjectdef
  - change push_nested_hierarchy, pop_nested_hierarchy to handle records too

git-svn-id: branches/paul/extended_records@16519 -
2010-12-08 06:58:48 +00:00
Jonas Maebe
92997a0249 * store/load tloopnode.loopflags to/from ppu files so that for/repeat/while
loops are correctly inlined (mantis #17493)

git-svn-id: trunk@16106 -
2010-10-08 13:01:25 +00:00
Jonas Maebe
57bd6d2685 + merged nestedprocvars branch
+ support for nested procedural variables:
    o activate using {$modeswitch nestedprocvars} (compatible with all
      regular syntax modes, enabled by default for MacPas mode)
    o activating this mode switch changes the way the frame pointer is
      passed to nested routines into the same way that Delphi uses (always
      passed via the stack, and if necessary removed from the stack by
      the caller) -- Todo: possibly also allow using this parameter
      passing convention without enabling nested procvars, maybe even
      by default in Delphi mode, see mantis #9432
    o both global and nested routines can be passed to/assigned to a
      nested procvar (and called via them). Note that converting global
      *procvars* to nested procvars is intentionally not supported, so
      that this functionality can also be implemented via compile-time
      generated trampolines if necessary (e.g. for LLVM or CIL backends
      as long as they don't support the aforementioned parameter passing
      convention)
    o a nested procvar can both be declared using a Mac/ISO Pascal style
      "inline" type declaration as a parameter type, or as a stand-alone
      type (in the latter case, add "is nested" at the end in analogy to
      "of object" for method pointers -- note that using variables of
      such a type is dangerous, because if you call them once the enclosing
      stack frame no longer exists on the stack, the results are
      undefined; this is however allowed for Metaware Pascal compatibility)

git-svn-id: trunk@15694 -
2010-08-02 22:20:36 +00:00
Jonas Maebe
25561d0f71 - removed unnecessary string copy form tppufile.getstring
git-svn-id: trunk@15459 -
2010-06-20 12:31:27 +00:00
Jonas Maebe
15e9c54b44 * fixed ABI compliance for parameter passing and function returning on all
x86-64 platforms (except for win64, which uses another ABI and which
    already complied to it) + test
  * fixed returning records containing 1 single or double field on darwin/i386,
    these have to be returned via ST0 instead of as a regular record
  * added support for LOC_FPUREGISTER and LOC_MMREGISTER in several places
    where they can now occur due to the previous two changes
  * made a few internalerrors unique

git-svn-id: trunk@15368 -
2010-06-03 20:08:50 +00:00
Jonas Maebe
72bec41317 * increased ppu version after r15350, because the explicit paralocations
are now stored in a different way

git-svn-id: trunk@15354 -
2010-05-31 16:13:34 +00:00
paul
ceccce93f5 compiler: add class constructors, class destructors to the initfinal table as regular initialization/finalization sections (class constructors is still not striped away with the class)
git-svn-id: trunk@15143 -
2010-04-15 07:37:41 +00:00
paul
1b614b526a compiler:
- add own symbol table for enumeration to store enumeration elements
  - reimplement enumeration member traverse using symbol table instead of firstenum/nextenum - that members are removed
  - implement TEnum.Element access syntax - element is searched in the enumeration symtable in this case instead of global/local symtables
  - implement {$SCOPEDENUM ON/OFF} local switch
  + tests

git-svn-id: trunk@15051 -
2010-03-25 05:46:53 +00:00
Jonas Maebe
0cfc6e1cac + support for "univ" in macpas mode: a parameter modifier that allows
passing any value to that parameter which has the same size as the
    parameter (it basically acts as if there is an explicit type conversion
    to the parameter type around the value at the caller side). If a procvar
    has an univ parameter, all procvars whose corresponding parameter
    has the same size as that univ parameter are similarly compatible.

    This transparent compatibility can however cause crashes in case of
    of the procvars when one of the types is passed on the stack and the
    other isn't (because then the called routine will a) load the parameter
    from a wrong location and b) pop the wrong amount off of the stack at
    then end). Therefore FPC will warn in most cases where this can happen.
    (mantis #15777)

git-svn-id: trunk@15010 -
2010-03-13 22:13:20 +00:00
Jonas Maebe
7201d61d20 * forgotten, part of r14912
git-svn-id: trunk@14913 -
2010-02-14 13:53:37 +00:00
paul
25298fbcd9 compiler: allow hint modifier for 'unit' keyword (reason - delphi compatibility) + test
git-svn-id: trunk@14767 -
2010-01-22 07:15:09 +00:00
paul
1ae0cebc1a compiler: implement dispinterface properties + modified test
git-svn-id: trunk@14747 -
2010-01-19 09:58:08 +00:00
paul
77a2c316dd compiler: use sp_internal instead of vo_is_internal for internal symbols used for static fields, remove vo_is_internal
git-svn-id: trunk@14631 -
2010-01-14 03:50:01 +00:00
paul
c9987c296e compiler: don't show notes for symbols which are created by static class fields, update ppudump and ppu version
git-svn-id: trunk@14608 -
2010-01-11 06:38:40 +00:00
florian
79f084167a * increased ppu version due to r14596
git-svn-id: trunk@14599 -
2010-01-10 14:11:28 +00:00
Jonas Maebe
b3a1833e0f * lowered symbol length at which we start shortening it with a crc so
tw15203 also compiles on darwin

git-svn-id: trunk@14517 -
2010-01-02 11:54:16 +00:00
florian
81f34dd4bb * avoid too long prefixes of manglednames by using a CRC like for long parameter name lists, resolves #15203
git-svn-id: trunk@14515 -
2010-01-01 21:56:55 +00:00
Jonas Maebe
1743c6f1a8 * also recompile a unit if class/object definitions in indirectly used
units have changed, because these can influence the code of the
    current unit in case method signatures changed (mantis #13840)
    + manual test
  * fixed some recompilation crashes related to WPO info
  * clarified the unit_u_add_depend_to message

git-svn-id: trunk@14503 -
2009-12-30 14:03:31 +00:00
florian
b5e7b3e1e7 o patch by Sergei Gorelkin which basically resolves #14308 (still misses some tests):
* constant widestrings must be allocated and copied at program start up through an api call else they couldn't be passed between progam/dlls

git-svn-id: trunk@14432 -
2009-12-13 10:03:30 +00:00
Jonas Maebe
280f27b45c * store/restore trttinode.rttidatatype to/from ppu file, and also copy it in
rttidatatype.getcopy (fixes mantis #15207)

git-svn-id: trunk@14318 -
2009-12-03 23:03:25 +00:00
Jonas Maebe
60a9ef963d * finished basic support for calling methods from external C++ classes
(slightly modified patch by Sven Barth, mantis #15082)

git-svn-id: trunk@14185 -
2009-11-15 14:55:40 +00:00
Jonas Maebe
c1cdf1e087 * merged objc branch:
+ basic support for Objective-Pascal: objcclass, objcprotocol,
      objcselector on all Darwin platforms (ppc32/64, i386, x86_64, ARM),
      see http://wiki.freepascal.org/FPC_PasCocoa and
      http://wiki.freepascal.org/FPC_PasCocoa/Differences for some dialect
      details. Use {$modeswitch objectivec1} to activate
    + Cocoa, iPhone/UIKit and WebKit interfaces for use with the new
      syntax mode

git-svn-id: trunk@14068 -
2009-11-05 16:48:28 +00:00
paul
aa5a5e79ce merge revisions: 13909,13923,13924,13934,13935,13942,13943,13944,13946,13948,13950,13951,13952,13983,13994:
rtl: add enumerators to the basic classes
tests: add enumerators test which compiles and work both by fpc and dcc
compiler: 
  + start for-in loop implementation: implement for-in loop for types (enumerations and ranges), strings, arrays and sets. todo: perform type checking, optimize array and string loops - use temp for expression, implement for-in loop for classes
test:
  + add a simple test for the 'for-in' loop
compiler: fix string for-in loop. now it uses a temp variable to store string expression result
complier: fix for-in array loop. use a temp variable for the loop expression only if loop is not an open array loop
complier: continue enumerator implementation:
  + add operator enumerator which give an ability to add enumerator for an existent type (for example to override builtin string enumerator)
  + add class enumerator support via delphi compatible GetEnumerator method + enumerator class/object template (function MoveNext: Boolean; property Current)
  + tests
compiler: fix for-in loop for arrays. delphi does not copy arrays to a temp variable and it is possible to change array during loop. + test
compiler: add reference for the enumerator operator when it is used + another test for operator enumerator for a class
compiler: add reference for the enumerator operator when it is used + another test for operator enumerator for a class
compiler: enumerator directive support:
  + allow to mark methods and properties by 'enumerator MoveNext' and 'enumerator Current' modifiers. Parser checks return types and duplicates.
  + prefer *marked* by enumerator directive methods and properties than GetEnumerator and Current builtin symbols
  + increase ppu version
  + test
rtl: add IEnumerator and IEnumerable interfaces declarations
tests: for-in loop tests:
  + add small comment at the top of test program
compiler: allow 'enumerator MoveNext' for the interface function declaration + test
compiler: move all for-in loop helpers to the nflw unit
compiler: don't allow the compiler to choose the non-valid enumerator operator for the for-in loop

git-svn-id: trunk@14008 -
2009-11-02 03:24:48 +00:00
paul
e784ec1079 merge revisions 13898-13899:
- compiler: allow message after the *deprecated* keyword
 - compiler: raise an internal error if deprecated message is trying to set to a non clear string pointer

git-svn-id: trunk@13997 -
2009-11-01 14:06:30 +00:00
florian
eb433d1bdd * merged sealed and abstract support by Paul Ishenin
-- Zusammenführen von r13884 in ».«:
U    compiler/msgtxt.inc
U    compiler/msgidx.inc
U    compiler/pdecsub.pas
U    compiler/pdecobj.pas
U    compiler/tokens.pas
U    compiler/ppu.pas
U    compiler/symconst.pas
U    compiler/msg/errore.msg
U    compiler/utils/ppudump.pp
-- Zusammenführen von r13885 in ».«:
A    tests/test/tsealed1.pp
A    tests/test/tabstract1.pp
A    tests/test/tsealed2.pp
-- Zusammenführen von r13893 in ».«:
A    tests/test/tsealed3.pp
A    tests/test/tsealed4.pp

git-svn-id: trunk@13908 -
2009-10-18 20:05:29 +00:00
Jonas Maebe
3660bf7f98 * integrated the transformation of an Objective-C method call into a call
to objc_msgSend* into the callnode. This allows reusing the current
    call node rather than having to create a new one, and is in particular
    necessary because even though the objc_msgSend* functions are declared
    as varargs, you're supposed to typecast them to the function type
    describing the method before calling them (so they should *not* use
    varargs calling conventions!)
  * for the above, a field called fobjcforcedprocname has been added to the
    callnode, which can be set to a string that will be used as the (mangled)
    name of the function to call instead of the mangled name of the procsym
  -> fixes calling obj-c methods with floating point arguments on ppc

git-svn-id: branches/objc@13783 -
2009-10-01 12:05:11 +00:00
Jonas Maebe
4c57a5f504 + support multiple inheritance for obj-c protocols
* don't allocate tobjectdef.implementedinterfaces for corba interfaces
    since the compiler doesn't support multiple inheritance for them
  * extended/corrected related tobjc22 test
  * increased ppu version, because implementedinterfaces is now
    present in different cases

git-svn-id: branches/objc@13738 -
2009-09-18 11:35:13 +00:00
Jonas Maebe
a149674a75 Merged revisions 13458-13596 via svnmerge from
svn+ssh://jonas@svn.freepascal.org/FPC/svn/fpc/trunk

git-svn-id: branches/objc@13598 -
2009-08-25 19:47:36 +00:00
Jonas Maebe
0eec337a00 - removed SUPPORT_UNALIGNED, FPC_SUPPORTS_UNALIGNED and FPC_UNALIGNED_FIXED
defines and ifdefs (already all defined by 2.2.4)

git-svn-id: trunk@13581 -
2009-08-23 07:51:26 +00:00
Jonas Maebe
10aa7f40cd * made ppu version again different from trunk version, because the format
is also different

git-svn-id: branches/objc@13459 -
2009-07-26 14:40:30 +00:00