Commit Graph

141 Commits

Author SHA1 Message Date
florian
e4ee8fa6a2 * patch by Rika to pass some strings by reference, resolves #39338 2021-11-09 22:41:52 +01:00
florian
a4672fbd1c o based on a patch by Rika, resolves #39401:
* use Base64 (62=_, 63=$) encoded FNV hash (instead of CR-32) to shorted identifiers
    * renamed fpccrc to fpchash
    + test
2021-10-10 10:09:22 +02:00
florian
51326e94f3 * allow char constant to be used for const string parameters in generic specializations, resolves #39030
git-svn-id: trunk@49569 -
2021-06-28 20:35:33 +00:00
pierre
e6045673ee Handle NIL entries in deflist after commit 48986
git-svn-id: trunk@49230 -
2021-04-18 15:44:07 +00:00
yury
75491ae21c * Removed/ifdefed the assigned and unused variables.
git-svn-id: trunk@48391 -
2021-01-24 13:58:17 +00:00
yury
9c265d71f0 * Fixed a wrong code caused by a typo. It has been revealed by a note about an unused var.
git-svn-id: trunk@48387 -
2021-01-24 13:08:54 +00:00
svenbarth
e4eed4e259 * when only a symbol name is provided to generate_specialization_phase1 allow a symbol table to be provided as well
git-svn-id: trunk@48000 -
2021-01-02 23:23:29 +00:00
svenbarth
9179f9d43b * always add a generic dummy if it is a procsym
git-svn-id: trunk@47996 -
2021-01-02 23:23:12 +00:00
florian
ff295bf349 * delay setting of pd_body and pd_implement till the header of a generic
procedure is parsed, resolves #37261

git-svn-id: trunk@45717 -
2020-06-30 20:36:51 +00:00
florian
e7f7927ca9 + initialize variables, so compilation with -O3 works
git-svn-id: trunk@45141 -
2020-04-27 19:19:54 +00:00
svenbarth
04554d7505 * use a more detailed error message if a type is not allowed for a generic constant parameter
git-svn-id: trunk@45092 -
2020-04-26 11:46:24 +00:00
svenbarth
a467332187 * fix for Mantis #36975: arraydefs are not allowed for generic types (this is only used for type declarations; for specializing constant strings which are char arrays are still allowed)
+ added test

git-svn-id: trunk@45089 -
2020-04-26 11:46:10 +00:00
svenbarth
60345366f2 * fix for Mantis #35140: apply patch by Ryan Joseph together with some further changes by me to add support for constant parameters in generics
+ added tests

git-svn-id: trunk@45080 -
2020-04-25 22:12:35 +00:00
svenbarth
41a6957f7d * keep track of the fileposinfo for generic constraints
git-svn-id: trunk@44188 -
2020-02-16 09:53:32 +00:00
florian
b7afb2431c * do not allow constraints in headers of procedure implementations in delphi mode, resolves #36584
* better error message if a constraint is found at a wrong location

git-svn-id: trunk@44174 -
2020-02-14 20:56:55 +00:00
svenbarth
c6a4d10f61 * for deciding whether to swap a generic's buffer use the module's flag instead of the def's
git-svn-id: trunk@44073 -
2020-01-30 21:49:07 +00:00
pierre
d1e4066477 Hopefully fix problems related to loading of ppufile generated with other endianess for generics
git-svn-id: trunk@44056 -
2020-01-28 23:43:56 +00:00
yury
1b3a3a7983 * Removed lot of unused local vars. It is useful to turn on the notes in options. :)
git-svn-id: trunk@44053 -
2020-01-28 18:45:33 +00:00
svenbarth
3e7dc25667 * fix for Mantis #36496: correctly handle the function result alias variable inside generic functions
+ added tests

git-svn-id: trunk@43823 -
2019-12-30 21:35:26 +00:00
svenbarth
bf5d75e594 * move the common sequence to build a VMT for an objectdef into a separate procedure (based on a patch by Blaise.ru)
git-svn-id: trunk@43674 -
2019-12-11 22:42:53 +00:00
svenbarth
97eefb6ac3 - the error recovery handling is no longer required
git-svn-id: trunk@43588 -
2019-11-25 20:28:29 +00:00
svenbarth
5b71ba2a9b * treat a missing genericdef with no symname set as an internal error
git-svn-id: trunk@43587 -
2019-11-25 20:28:26 +00:00
svenbarth
ef6c9e930b * correctly handle the genericdef being a procdef, otherwise no code will be generated (and no error either :/ )
+ added test

git-svn-id: trunk@43586 -
2019-11-25 20:28:23 +00:00
svenbarth
1abc9c1fe7 * when specializing a routine all nested specializations must go to the para- or localsymtable as otherwise the symbol can't be found to be registered
git-svn-id: trunk@43568 -
2019-11-24 00:04:31 +00:00
svenbarth
d79e2ee9da * also store, reset and restore the current module's procinfo
git-svn-id: trunk@43566 -
2019-11-24 00:04:23 +00:00
Jonas Maebe
a051b8d225 - remmoved doregister parameter from t*sym constructors, as the registration
is handled automatically nowadays

git-svn-id: trunk@42998 -
2019-09-14 17:30:45 +00:00
Jonas Maebe
d8903ce6b3 - removed maxcrecordalign parameter/field from recordsymtables, as this value
cannot be modified in the settings (so we can directly use the one from
    current_settings)

git-svn-id: trunk@42447 -
2019-07-14 19:24:32 +00:00
Jonas Maebe
281b3ad276 * fix case completeness and unreachable code warnings in compiler that would
be introduced by the next commit

git-svn-id: trunk@42046 -
2019-05-12 14:29:03 +00:00
Jonas Maebe
e008785152 * insert the hidden parameters for objectdef methods after resolving
overrides but before generating the VMT, so that these hidden parameters
    are part of the procdefs stored in the VMT (fixes some LLVM type errors
    after r41716)

git-svn-id: trunk@41884 -
2019-04-16 16:11:50 +00:00
Jonas Maebe
ed2ae508d0 * only add hidden parameters for objectdef methods after generating the vmt,
so that they take into account inherited calling conventions (mantis #35233)
   o don't needlessly calculate the paraloc info when generating a JVM mangled
     name

git-svn-id: trunk@41716 -
2019-03-16 19:14:14 +00:00
Jonas Maebe
91d5457b38 * moved around/replaced the following procedures to stop nflw from depending
on pdecsub (node units should not depend on parser units):
   o maybe_add_public_default_java_constructor()
   o handle_calling_convention()
   o create_finalizer_procdef() (replaced with create_outline_procdef())
   o insert_record_hidden_paras()
   o handle_calling_convention()
   o proc_add_definition()
   o build_parentfpstruct()
   o maybe_guarantee_record_typesym()
   o get_first_proc_str()
  * factored out the creation of a procinfo for a nested procdef based on a
    subnodetree of the current procdef into tprocinfo.create_for_outlining()

git-svn-id: trunk@40773 -
2019-01-05 16:26:33 +00:00
Jonas Maebe
28df55fe08 * moved handle_calling_convention() to pparautl
git-svn-id: trunk@40772 -
2019-01-05 16:26:29 +00:00
svenbarth
598ac21791 * if the generic dummy symbol is a procsym (with procdefs added) then this is the symbol that should be resolved to
git-svn-id: trunk@39232 -
2018-06-15 13:49:21 +00:00
svenbarth
06d7e26df0 * move code to add a symbol to the current module's generic dummy symbols into a new function pgenutil.add_generic_dummysym()
git-svn-id: trunk@36466 -
2017-06-09 14:30:23 +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
e4565378db * Allow for "record constraint" in Delphi mode more types like: ordinal, float, classical objects, enumerations (instead of just record). Delphi compatibility. Fix for mantis #24073.
git-svn-id: trunk@35739 -
2017-04-05 13:12:30 +00:00
svenbarth
d34acf3bc7 * fix for Mantis #31120: check current_genericdef only if the current_procinfo isn't used
+ added test

Note: the test is added to webtbs although it's right now still failing, cause I'll remove the restriction for nested procedures since the compiler now supports them correctly. Due to the way we handle generics we don't have problems with them unlike Delphi.

git-svn-id: trunk@35147 -
2016-12-17 21:20:44 +00:00
svenbarth
6ba85c2a70 * second fix for Mantis #30626: also search in parent classes for a suitable pre-existing specialization
+ added test

git-svn-id: trunk@35014 -
2016-11-29 17:04:07 +00:00
svenbarth
0a1e080089 * only create a new procsym for a specialization if it's indeed needed
git-svn-id: trunk@35013 -
2016-11-29 14:13:06 +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
ee466b9a28 * extend tdef.fullownerhierarchyname() with a parameter that skips the inclusion of a procdef's parameter declaration using the new pno_noparams option
git-svn-id: trunk@35009 -
2016-11-28 18:06:35 +00:00
svenbarth
63b0024e4c * fix for Mantis #30626: unset current_procinfo so that further specializations don't use a symtable to specialize themselves in that they shouldn't use (cause current_procinfo takes precedence)
git-svn-id: trunk@34916 -
2016-11-18 16:17:09 +00:00
svenbarth
fd7daf91df + new overload for generate_specialization_phase1() which allows to pass a specific symbol name without the need to specify a file position
git-svn-id: trunk@34529 -
2016-09-16 15:10:51 +00:00
svenbarth
627e30f47f * factor() might return a typenode with a errordef, so check for that and don't add the typesymbol to the parameter list in that case; fixes the access violation of tw17181.pp
git-svn-id: trunk@34472 -
2016-09-09 13:04:41 +00:00
svenbarth
80c2e3b51a * special detection of an ongoing specialization for the case that a function that belongs to a generic and has said generic as parameter or result is in turn specialized as a parameter or result of another generic function
git-svn-id: trunk@34412 -
2016-09-02 15:52:03 +00:00
svenbarth
6a14bb5014 * check the owner of current_specializedef as that is Nil if a generic routine is specialized and this is the specialization of one of its parameters or its result type
git-svn-id: trunk@34411 -
2016-09-02 15:48:30 +00:00
pierre
22a7ce8972 Fix memory leak due to double srsym allocation
git-svn-id: trunk@34364 -
2016-08-21 22:26:59 +00:00
Jonas Maebe
95f28e5e0c * avoid a crash when processing synthetic methods of specialised classes:
these are generated after the other specialisation methods (via
    add_synthetic_method_implementations, rather than via
    generate_specialization_procs)
   o fixes crash in tests/test/jvm/tw20212.pp

git-svn-id: trunk@34036 -
2016-06-30 15:33:54 +00:00
svenbarth
6c3dd6b601 Another system, another regression... (this time tests/test/tgenfunc15.pp on i386-win32)
pgenutil.pas:
  * generate_specialization_phase2 & generate_specialization_procs: don't add pending specializations if we're currently parsing a generic

git-svn-id: trunk@33885 -
2016-06-03 12:36:27 +00:00