Commit Graph

588 Commits

Author SHA1 Message Date
svenbarth
5510b13975 * ensure that sto_has_generic is set when a generic routine has been parsed
git-svn-id: trunk@39230 -
2018-06-15 13:49:03 +00:00
florian
6d5ce55232 * unified def creation for open arrays
git-svn-id: trunk@38408 -
2018-03-04 17:59:05 +00:00
florian
31f78ea2b6 + implementation of the vectorcall calling convention by J. Gareth Moreton
+ tests

git-svn-id: trunk@38206 -
2018-02-11 17:50:37 +00:00
florian
6d072872d0 * fix compilation with 3.0.x and -Oonodedfa enabled after r37887
git-svn-id: trunk@37919 -
2018-01-06 11:26:19 +00:00
Jonas Maebe
672afcdca2 * check for conflicts between procedure directives specified in the
implementation and "virtual" (if it's a virtual method), as "virtual"
    does not get repeated in the implementation and hence no conflicts get
    checked by default (mantis #32605)

git-svn-id: trunk@37887 -
2018-01-01 16:54:04 +00:00
pierre
efcb10f537 Handle arm-palmos syscall modifier
git-svn-id: trunk@37223 -
2017-09-15 20:29:02 +00:00
Károly Balogh
addc3a2f94 m68k-palmos: fixed the syscall generation, and improved it to support the dispatch-selector-in-reg-D2 traps
git-svn-id: trunk@36892 -
2017-08-13 01:19:19 +00:00
Károly Balogh
8a71a70d3c m68k-palmos: sketched up some entirely untested syscall support, but it's probably close to what we need
git-svn-id: trunk@36891 -
2017-08-12 21:45:01 +00:00
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
svenbarth
8024fcd7ec * if an operator overload in a structured type is invalid print an error only for the declaration and not the implementation as well
This fixes Mantis #31634 as far as I see it useful to; anything further would probably require extension of the message generation system by a context or such so that the compiler could write "Error in TFoo<Integer>: ..." instead of merely "Error: ..." or something like that.
No test added due to the nature of the bug.

git-svn-id: trunk@35748 -
2017-04-07 13:24:58 +00:00
maciej-izak
8391b73206 * Virtual methods cannot be declared as static (static virtual method has no sense).
+ added tests

git-svn-id: trunk@35724 -
2017-04-03 20:45:52 +00:00
Jonas Maebe
4c68ea1000 * use pocalls_cdecl and cstylearrayofconst more consistently instead of
ad hoc set constants containing varying number cdecl-like calling
    conventions
   o added pocall_sysv_abi_cdecl and pocall_ms_abi_cdecl to cstylearrayofconst
   o also allow C-style blocks with mwpascal instead of cdecl (mwpascal = cdecl
     with "const" = "constref" for record parameters)
   o did not touch cases related to name mangling and import/export names,
     because those are a real mess and easily break things left and right :/

git-svn-id: trunk@35479 -
2017-02-25 11:46:35 +00:00
maciej-izak
520bb31fa6 * Parse management operators. Each management operator is special kind of operator without result.
git-svn-id: trunk@35442 -
2017-02-18 19:12:48 +00:00
Jonas Maebe
265c8e7bbc + support for specifying ms_abi_default, ms_abi_cdelc, sysv_abi_default, and
sysv_abi_cdecl calling conventions on x86-64 to force using the SYSV/
    Microsoft ABI on platforms that don't use it by default (mainly to ease
    porting pure assembler routines)

git-svn-id: trunk@35425 -
2017-02-11 19:57:12 +00:00
svenbarth
d133f210ca * correct comment, cause forward declarations for generic functions *do* indeed work (cause they use the same mechanism as forward definitions in the interface section)
git-svn-id: trunk@35093 -
2016-12-09 16:24:17 +00:00
svenbarth
52673d34f1 * fix for Mantis #31033: don't check for is_specialization(), but for df_specialization (this way we also get pointers or nested types that aren't by themselves real specializations)
+ added test

git-svn-id: trunk@35092 -
2016-12-09 16:22:14 +00:00
svenbarth
d499163ef5 * provisional fix for Mantis #31076: fail gracefully instead of with an internal error if a generic method is declared inside a generic class or record. This will change once we support nested generics however.
* adjusted error message to reflect that we're not only dealing with generic classes
+ added test; note: it's added in webtbs, cause the test will loose its %FAIL attribute in the future

git-svn-id: trunk@35079 -
2016-12-06 22:26:53 +00:00
Károly Balogh
0cb555c07c syscalls: move the reference implementation of parseparaloc to paramgr. removes two identical copies from CPU specific code and enables basereg convention for AROS/x86_64. also, other minor fixes and cleanups in related code.
git-svn-id: trunk@35047 -
2016-12-03 19:00:41 +00:00
svenbarth
a535d54bcb * fix for Mantis #30939: Rework generation of the generic name to be less relying on the type hierarchy as a specialization inside the parameter declaration would want to have the full name of the procdef including its parameters, but those are still parsed at that stage (the pretty name is still a topic onto itself however...)
+ added tests (original test was only mode fpc, test for mode delphi is added as well)

git-svn-id: trunk@35010 -
2016-11-28 18:16:49 +00:00
svenbarth
3f77ce3b12 * leave parse_proc_head() (with some error recovery) if the interface could not be found instead of running straight into an access violation
+ added test

git-svn-id: trunk@35007 -
2016-11-28 17:54:48 +00:00
florian
5d8bcaeb4b + additional flag po_staticmethod for procoptions for class operator. Each class operator is also static, patch by Maciej Izak
git-svn-id: trunk@34998 -
2016-11-27 20:01:39 +00:00
Károly Balogh
657aa06360 arm: arm-aros syscall support
git-svn-id: trunk@34809 -
2016-11-06 14:31:42 +00:00
Károly Balogh
ce5ff8ecd5 forgotten file, this should have been part of the previous commit
git-svn-id: trunk@34807 -
2016-11-06 12:44:01 +00:00
svenbarth
254be82c43 * revert r34712: the behavior with the class constructors is indeed Delphi compatible. However only one class constructor/destructor per class is allowed no matter how it's named.
git-svn-id: trunk@34713 -
2016-10-13 20:11:35 +00:00
svenbarth
4e5ed5b0e2 Fix for Mantis #30729: don't allow other names for class constructors or destructors than Create and Destroy respectively.
+ added tests

git-svn-id: trunk@34712 -
2016-10-13 19:24:07 +00:00
nickysn
657685a8b6 * use sizesinttype instead of ptrsinttype for the index and high parameter of
open arrays/dynarrays/string-like char arrays, etc.

git-svn-id: trunk@34665 -
2016-10-08 13:56:24 +00:00
Károly Balogh
5db02f4202 atari: initial support for TOS syscalls
git-svn-id: trunk@34610 -
2016-10-03 23:37:30 +00:00
Károly Balogh
464ecab542 huge syscall support refactor for Amiga-likes. removed large chunks of ancient duplicated code, and in general tried to make the entire thing more maintainable and cleaner. also added support for AROS EAXBase syscall convention
git-svn-id: trunk@34416 -
2016-09-03 07:57:23 +00:00
svenbarth
08cd62fc7e * rework parse_proc_dec_finish.read_returndef a bit so that specializations as result types of generic routines are handled correctly
git-svn-id: trunk@34410 -
2016-09-02 15:46:08 +00:00
svenbarth
a4a1e9db12 * allow equal result types instead of exactly the same result types for generic functions if both are specializations (otherwise they would be considered as different if they depend on the generic function's generic types)
git-svn-id: trunk@34409 -
2016-09-02 15:43:49 +00:00
svenbarth
8b853571c6 * don't generate a warning if a "generic" token follows while parsing procedure directives (let's hope we'll never have to add a "generic" directive :/ )
+ added test

git-svn-id: trunk@34343 -
2016-08-19 14:07:36 +00:00
svenbarth
bb72c1c4df * declare various assembler symbols (VMT, RTTI, threadvars) as public assembler symbols
* declare public function alias as public assembler symbols

git-svn-id: trunk@34175 -
2016-07-22 13:11:24 +00:00
svenbarth
88108bc4df Extend "compilerproc" with the optional ability to specify an index (same syntax as for "internproc") which allows to map the routine to a syssym.
git-svn-id: trunk@33890 -
2016-06-03 20:53:33 +00:00
svenbarth
f8def6dbc9 Store and use procedure directives of generic routines.
scanner.pas, tscannerfile:
  + new method is_recording_tokens to check whether token recording is already active
pdecsub.pas, parse_proc_directives:
  * record tokens into the declaration token buffer of a generic routine if necessary
pgenutil.pas, generate_specialization_phase2:
  * process the procedure directives that had been recorded with the generic routine

git-svn-id: trunk@33824 -
2016-05-26 18:35:08 +00:00
Jonas Maebe
08d63e3408 * allow default parameters for constref (mantis #29992)
git-svn-id: trunk@33480 -
2016-04-10 21:27:29 +00:00
florian
cb4773432b + hardfloat directive (arm only): use hard float calling conventions regardless of the abi, resolves #29715
git-svn-id: trunk@33196 -
2016-03-06 15:47:31 +00:00
svenbarth
8bd79f95be Fix a few typos discovered by Blaise
git-svn-id: trunk@32640 -
2015-12-11 16:31:00 +00:00
svenbarth
2eeb59591a pdecsub.pas, parse_proc_head:
* register the type parameter symbols and their defs once we really keep them

git-svn-id: trunk@32436 -
2015-11-21 15:41:51 +00:00
nickysn
4da9296f80 * disabled the name mangling of external non-cdecl and non-cppdecl procedures
that don't have an import name specified explicitly. The previous behaviour
  wasn't very useful, because it included the current module name in the mangled
  name and that was very unlikely to be the correct name of a routine in a
  different module. The new behaviour is also BP7 and Delphi compatible.

git-svn-id: trunk@32385 -
2015-11-20 23:14:53 +00:00
svenbarth
d3660fec31 Implement support for parsing "generic [class] procedure" and "generic [class] function" in non-Delphi modes. Since "generic" is a prefix it is quite ugly to implement, but from a Pascal language point of view it fits better than "procedure generic xyz".
Supporting such a prefix of course means that all section handling code ("var", "type", etc.) needs to respect the case of a "generic" token followed by "function", "procedure" or "class" and thus abort doing its own business.
Maybe I'll find the time somewhen in the future to rework the parser (plus scanner?) a bit so that code like this gets more easy to add and more importantly less ugly.

pdecsub.pas:
  * extend parse_proc_dec() and parse_record_method_dec() so that they can be told that they are supposed to handle the to be parsed function/procedure/method header as a generic
pdecvar.pas:
  + new entry for tvar_dec_option named "vd_check_generic" to tell read_var_decls() and read_record_fields() to look out for "generic"
  * extend read_var_decls() and read_record_fields() to check for "generic" if needed and to clean up correctly if it is encountered
pdecl.pas:
  * the section handling procedures types_dec(), resourcestring_dec(), var_dec(), threadvar_dec() and consts_dec() all return whether they had encountered a "generic" token that was followed by one of $
pdecobj.pas:
  * extend method_dec() to take a parameter that says whether the method is supposed to be a generic one
  * parse_object_members: while read_record_fields() can handle "generic" we also need to handle the case of "generic" if no fields are allowed anymore
psub.pas:
  * extend read_proc() by the possibility to tell it that the procedure/function to be parsed is supposed to be generic
  * adjust read_declarations() and read_interface_declarations() to keep track of parsed "generic" tokens and to pass them on accordingly
ptype.pas:
  * parse_record_members: same remark as for pdecobj.parse_object_members

git-svn-id: trunk@32380 -
2015-11-20 16:50:58 +00:00
svenbarth
0ff87336aa Convert the Boolean parameters accept_equal, typeonly and hadspecialize of comp_expr(), sub_expr() and factor() to a set parameter and adjust all calls.
pexpr.pas:
  + new enum texprflag and corresponding set texprflags
  * comp_expr: replace accept_equal and typeonly with texprflags parameter
  * factor: replace typeonly and hadspecialize with texprflags parameter
  * sub_expr: replace accept_equal and typeonly with texprflags parameter
  * adjust calls to comp_expr(), factor() and sub_expr()
other units:
  * adjust calls to comp_expr(), factor() and sub_expr() 

git-svn-id: trunk@32269 -
2015-11-07 21:45:03 +00:00
Jonas Maebe
f004227d91 * ignore the name of class con- and destructors (patch by Ondrej Pokorny,
mantis #28801)

git-svn-id: trunk@32223 -
2015-11-03 18:10:08 +00:00
nickysn
c513cec740 - disallow mixing 'export' and 'interrupt' for the same procedure
git-svn-id: trunk@31836 -
2015-09-26 18:35:04 +00:00
svenbarth
96a9273fba pdecsub.pas:
+ export parse_proc_dec_finish() from the unit
pgenutil.pas:
  * adjust generate_specialization_phase2() to correctly specialize procdefs

git-svn-id: trunk@31772 -
2015-09-18 21:51:17 +00:00
svenbarth
d15cdefc37 pdecsub.pas:
* extend parse_proc_head() with the ability to deal with specializations of procdefs
Note: such a procdef is created as unregistered as this is used to determine the correct overload in tcallcandidates (through the use of the yet to be adapted generate_specialization_phase2())

git-svn-id: trunk@31771 -
2015-09-18 21:31:53 +00:00
florian
d36694bdb8 * fix compilation with -Oodfa
git-svn-id: trunk@31770 -
2015-09-18 18:22:25 +00:00
svenbarth
17a0ac7fc0 pdecsub.pas:
* extend parse_proc_head() with support for /parsing/ generic functions (at least in mode Delphi, mode ObjFPC depends on the new isgeneric parameter to be set)
  * adjust parsing of interface mappings with a generic interface (note: in mode ObjFPC this now requires a "specialize" directly before the generic interface's name, which is more in line with other uses of "specialize")
pexpr.pas, factor:
  * don't call postfixoperators() if hadspecialize is set

tests/test/tgeneric79.pp:
  * adjust test to changed syntax

git-svn-id: trunk@31769 -
2015-09-18 16:24:07 +00:00
svenbarth
5316ae6a49 pdecsub.pas, pd_virtual:
* generate error if method is generic

git-svn-id: trunk@31765 -
2015-09-18 14:54:35 +00:00
svenbarth
6eef28fd03 pdecsub.pas, proc_add_definition:
* special handling for matching generic procdefs with their forward declarations

git-svn-id: trunk@31595 -
2015-09-11 14:13:54 +00:00
svenbarth
65c37df999 + extend tprocdef with the possiblity to create it as unregistered
* for now all procdefs are created as registered
Note: an additional parameter instead of an overload is used for tprocdef.create as otherwise both constructors would need to be overridden in potential descendant CPU-specific classes...

git-svn-id: trunk@31593 -
2015-09-11 13:36:00 +00:00