Commit Graph

3578 Commits

Author SHA1 Message Date
Jonas Maebe
9e074d036b * migrated the handling of ansi/unicodestring constants to the high level
typed constant builder + llvm implementation

git-svn-id: branches/hlcgllvm@28327 -
2014-08-06 18:04:40 +00:00
Jonas Maebe
7949bebb8d * synchronised with r28168 of trunk
git-svn-id: branches/hlcgllvm@28169 -
2014-07-05 21:30:28 +00:00
nickysn
6e9720e830 + added tests for huge pointer normalized and non-normalized equality comparison
git-svn-id: trunk@28163 -
2014-07-05 10:19:26 +00:00
svenbarth
441e6c6083 Fix for Mantis #26177. Use the correct value for the method data when using a method pointer of a type or record helper.
Please note that Delphi has the exact same bug as we have and thus code working in FPC will not work in Delphi.
Additionally taking the method address of a local variable or a local/global constant for a method pointer is dangerous as the variable (in case of constants is a temporary local variable) will go out of scope once the containing procedure/function/method exits!

ncgld.pas, tcgloadnode.pass_generate_code:
  * only use the value of Self if it is an implicit pointer object (class instance) or a class reference, but not for everything else (objects, records, primitive types)

+added test

git-svn-id: trunk@28160 -
2014-07-05 08:54:10 +00:00
svenbarth
a7a9440692 Add a new warning message that is generated if an instance of an abstract class is created. This message is disabled by default, but can be switched on by using {$warn 4122 on} or {$warn 4122 error}.
Please note that this warning won't be triggered if an instance of that class is created using a class variable of that class type as the compiler can not know the type contained in the variable at compile time (see also the added test).

+ msg/errore.msg: added disabled message which informs about the instantiation of an abstract class
* pexpr.pas, do_member_read: generate the message if we have a constructor call for an abstract class using a loadvmtaddrnode (thus the type name is used and not a class variable)

* msg{idx,txt}.inc: updated

+ added test

git-svn-id: trunk@28127 -
2014-07-01 20:41:05 +00:00
Jonas Maebe
5b884c96f2 + initial llvm implementation of the ttai_typedconstbuilder class
o now simple typed constants (integer, floating pointer, pchar)
     and (non-variant) record typed constants containing such
     elements work for llvm

git-svn-id: branches/hlcgllvm@28124 -
2014-07-01 16:30:57 +00:00
Jonas Maebe
02ad2e4879 + unit with a buider class for typed constant/initialised data elements at
the assembler level
   o initially for use during the typed constant parsing, but usable anywhere
     we generate initialised data in the compiler

git-svn-id: branches/hlcgllvm@28117 -
2014-07-01 16:30:37 +00:00
nickysn
f0346c096f + added rtl helpers for huge pointer arithmetic
git-svn-id: trunk@28099 -
2014-06-28 17:08:40 +00:00
nickysn
5093c573dc + added huge pointer assignment and far->huge conversion tests
git-svn-id: trunk@28091 -
2014-06-27 16:56:02 +00:00
nickysn
82d393014b + added a test for the tiny memory layout
git-svn-id: trunk@28079 -
2014-06-26 17:38:38 +00:00
nickysn
835fb1d157 + added memory layout tests for the small and medium memory models
git-svn-id: trunk@28078 -
2014-06-26 17:30:32 +00:00
nickysn
3952f8830c + added test for the i8086 compact model memory layout
git-svn-id: trunk@28050 -
2014-06-24 19:48:37 +00:00
nickysn
57b233e724 + added test for the memory layout of the i8086 large memory model
git-svn-id: trunk@28040 -
2014-06-23 21:08:51 +00:00
sergei
4b5736a381 + Added test for Mantis #20456. The issue itself was fixed in the meantime.
git-svn-id: trunk@28035 -
2014-06-23 03:58:58 +00:00
Jonas Maebe
2df1d5ec58 * don't allow default parameter values for parameter types that don't accept
constant values (i.e., anything non-value/const/constref) (mantis #263363)
   o fixed default parameter value for var-parameter in chmreader

git-svn-id: trunk@28016 -
2014-06-20 19:50:20 +00:00
Jeppe Johansen
0dc39b5d63 Applied patch from Michael Ring that adds some startup code for some new stm32f0 and stm32f1 controllers, and fixes naming on some LPC ARMv6m controllers.
git-svn-id: trunk@28009 -
2014-06-20 06:49:04 +00:00
Jonas Maebe
9450407ed5 * when taking the address of a method1 that is specified by subscripting
the result of a objtype.method2 call, ensure that we call method2 with
    objtype as methdpointer rather than the self node of the current routine
    (mantis #24844)

git-svn-id: trunk@27977 -
2014-06-15 17:26:12 +00:00
Jonas Maebe
24f4adf657 * set the rangedef of open arrays to ptrsinttype (instead of s32inttype),
so that it's the same as the def returned by the low/high nodes
    (mantis #25703)

git-svn-id: trunk@27970 -
2014-06-15 15:26:47 +00:00
Jonas Maebe
159a35da4e * check for read/write after a newly declared property (mantis #26011)
o this reverts the support that was added for such declarations when
     mantis #4676 was fixed, but this was done for Delphi compatibility
     and
    a) current Delphi versions don't accept such declarations anymore either
    b) such declarations are meaningless
   o fixed a number of such invalid property declarations in packages

git-svn-id: trunk@27966 -
2014-06-15 10:59:47 +00:00
Jonas Maebe
8634aa8ad2 * fixes for the support for overriding properties on the JVM target:
o only create an accessor wrapping the inherited accessor at a
     potentially lower visibility level if the overriding property
     itself does not specify a different accessor to use
   o simplified code
   o tests

git-svn-id: trunk@27954 -
2014-06-14 10:35:35 +00:00
Jonas Maebe
2075dc5a53 * support for raising the visibility of inherited properties on the JVM
target (generate new getters/setters with increased visibility that
    call the inherited ones, if necessary)

git-svn-id: trunk@27940 -
2014-06-12 11:08:44 +00:00
svenbarth
81c7b22199 Mantis #25236 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27902 -
2014-06-08 15:51:33 +00:00
svenbarth
45e2e91536 Mantis #22468 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27901 -
2014-06-08 15:47:13 +00:00
svenbarth
60ef0a61bc Mantis #22792 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27900 -
2014-06-08 15:43:46 +00:00
svenbarth
1ebff1a963 Mantis #21622 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27898 -
2014-06-08 11:38:24 +00:00
svenbarth
8b290f4cb2 Mantis #24690 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27897 -
2014-06-08 11:34:32 +00:00
svenbarth
47407d2d7a Mantis #23279 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27896 -
2014-06-08 11:26:44 +00:00
svenbarth
1a22175553 Mantis #23653 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27895 -
2014-06-08 11:23:31 +00:00
svenbarth
69a8445472 Mantis #22790 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27894 -
2014-06-08 11:18:04 +00:00
svenbarth
c1fdce5166 Mantis #22540 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27893 -
2014-06-08 11:12:03 +00:00
svenbarth
94f47443f0 Mantis #25043 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27879 -
2014-06-06 15:52:02 +00:00
svenbarth
6f962e817a Mantis #24072 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27878 -
2014-06-06 15:39:30 +00:00
svenbarth
49a9f4c1ea Fix for Mantis #26123.
pdecobj.pas, object_dec:
  * Always check for genericdef and genericlist and not genericdef and ifnot then genericlist.

+ added test

git-svn-id: trunk@27877 -
2014-06-06 15:19:45 +00:00
svenbarth
34394d6925 Fix for Mantis #26180. Accept undefineddef as first parameter type of an Assert if it is used inside a generic.
ninl.pas, tinlinenode.pass_typecheck:
  * if the first parameter of an Assert is a undefineddef node then accept it as well if the node is part of a generic function/method

+ added test

git-svn-id: trunk@27875 -
2014-06-06 14:39:27 +00:00
svenbarth
aca48a4cf2 Fix for Mantis #26288. Types declared inside a generic must have the df_generic flag set. Period.
ptype.pas, read_named_type:
  * array_dec & procvar_dec: set df_generic of the array/procvar if parse_generic was originally set

+ added test

git-svn-id: trunk@27874 -
2014-06-06 14:22:17 +00:00
svenbarth
4a0d27ebfe Fix for Mantis #26271: Don't trash local variables that are used for the Default() intrinsic.
* ngenutil.pas, tnodeutils.trashable_sym:
    check for vo_is_default_var flag and don't consider such as trashable

+ added test

git-svn-id: trunk@27872 -
2014-06-06 13:59:52 +00:00
svenbarth
1bbcc08a8b Fix for Mantis #26176. Don't handle "type helper" as unique.
ptype.pas:
  * read_named_type: change hadtypetoken from a value to a var parameter and set it to false if a type helper is parsed so that calling code does not handle it as unique
  * read_anon_type: handle that hadtypetoken is now a var parameter

pgenutil.pas, generate_specialization:
  * handle that hadtypetoken of read_named_type is now a var parameter

+ added test

git-svn-id: trunk@27870 -
2014-06-06 13:26:21 +00:00
svenbarth
9ab5affd55 Contrary to popular believe the VMT for a generic needs to be at least generated so that check for inherited methods can be done correctly. This does however not mean that the VMT is written to the object file which is handled at a completely different place. Fixes Mantis #26193.
pdecl.pas, types_dec:
  * invoke the VMT builder for generic classes as well

+ added test

git-svn-id: trunk@27869 -
2014-06-06 13:05:39 +00:00
reiniero
d3bb0d4a17 + fcl-db: add GUI for tests in testsqlscanner
git-svn-id: trunk@27863 -
2014-06-06 08:49:16 +00:00
svenbarth
639a59df92 Added support for partial specialization. This should fix a few problems with generics, the tests for which will be added in the next days after I've verified them.
For partial specialization only the declaration is reparsed, but not method bodies.

The way generic parameters are passed around inside the compiler is changed: instead of creating new type symbols we keep a (name,def) pair so that the code in insert_generic_parameter_types can decide whether it needs to add a type symbol (for new undefined defs) or not (for real types and undefined defs that were passed on from the parent generic). This required the tfpobjectlist type of the genericlist variables/parameters to be changed to tfphashobjectlist.

For correctly parsing Delphi specializations as parameters in functions of records (or objects) the relationship between the def and its typesym must already be established during the parsing. For this the checks for forcing a "type is not completely defined" message needed to be adjusted to correctly handle nested types as well. This should as a sideeffect also allow the usage of nested constants, etc like was fixed for classes some months ago.

ToDo: 
  - if a generic is specialized with only fully defined types then we could generate the in the unit where it's used. This is not yet done.
  - currently we don't specialize generics that are currently parsed; maybe this could be improved in the future for better type compatibility checks
  - check whether the pausing of token recording for partial specializations works correct in context of hint modifiers

pgenutil.pas:
  * parse_generic_parameters: return a tfphashobjectlist instead of a tfpobjectlist (requires a few type adjustments in various other declarations)
  * maybe_insert_generic_rename_symbol, insert_generic_parameter_types: change genericlist from tfpobjectlist to tfphashobjectlist
  * parse_generic_specialization_types_internal: use is_generic instead of checking for df_generic
  * generate_specialization:
      + add a nested function to disable the requirement to check for method bodies
      * use the "simple" parameter parsing only for error recovery
      * instead of already creating a new type symbol for a parameter we use the found symbol's name and its def and maybe create it later on (therefor the type of tfpobjectlist was changed to tfphashobjectlist)
      * a partial specialization is specialized into the symtable of the def it is specialized in instead of one of the two global symtables
      * for now we handle partial specializations of generics we are currently parsing like before
      * don't continue recording generic tokens while we do a partial specialization
      * use the new unset_forwarddef function on the newly created defs
  * insert_generic_parameter_types: only create a new type symbol if the found type symbol does not yet have an owner (thus was freshly created for this generic declaration)

pdecobj.pas, object_dec:
  * change type of genericlist from tfpobjectlist to tfphashobjectlist
  * set the type sym for all object types that can be generic or inside a generic (needed for correctly parsing Delphi style generic declarations)

pdecsub.pas, parse_proc_head:
  * consume_generic_interface: always generate the specialization name as now all generics are "specialized" inside a generic
  * the assumption that the def index numbers are the same is no longer true as the genericdef might contain the defs of partial specializations which are not generated for full specializations

pdecvar.pas, read_record_fields:
  * we also need to check nested types whether they contain a not yet completely parsed record or object

ptype.pas:
  * read_named_type: 
      * change genericlist from tfpobjectlist to tfphashobjectlist
      * pass the typesymbol along to record_dec
  * resolve_forward_types: use is_generic instead of checking for df_generic
  * single_type: 
      * use is_generic instead of checking for df_generic
      * no need to check generic parameters
  * parse_record_members:
      + add parameter for the record's type symbol
      * setup the typesym <=> def relationship
  + record_dec: add parameter for the type symbol and pass it to parse_record_members
  * read_named_type, expr_type: use is_generic instead of checking for df_generic
  * array_dec & procvar_dec: change genericlist from tfpobjectlist to tfphashobjectlist

symdef.pas, tstoreddef:
  * improve the checks used in is_generic and is_specialization to really only work on true generics and true (and partial) specializations respectively
  * don't search the type parameters in the symtable, but store them in the PPU and load them from there
  - remove fillgenericparas method (including the calls in the descendants tarraydef, tprocvardef, tobjectdef and trecorddef)

defcmp.pas, compare_defs_ext:
  * handle partial specializations: specializations with only undefineddefs are compatible to generic defs

pdecl.pas, types_dec:
  * switch generictypelist from tfpobjectlist to tfphashobjectlist

ppu.pas:
  * increase PPU version

+ added tests that ensure that "not completely defined" checks for records (and objects) still work correctly

git-svn-id: trunk@27861 -
2014-06-05 20:05:05 +00:00
reiniero
7275f30360 * fcl-db: readme for sql parser/scanner/lexer; based on Michael's message http://www.mail-archive.com/fpc-devel%40lists.freepascal.org/msg18680.html
git-svn-id: trunk@27853 -
2014-06-05 08:15:37 +00:00
sergei
886159e73a * Renamed testdll2.pp into ttdllex1.pp so it falls into same chunk with ttdllexe.pp and can be located at runtime.
git-svn-id: trunk@27850 -
2014-06-04 12:30:35 +00:00
sergei
128cdd2a65 * Renamed testdll.pp into ttdlltes1.pp so it falls into same chunk with ttdlltest.pp and can be located at runtime.
git-svn-id: trunk@27849 -
2014-06-04 12:10:51 +00:00
sergei
bdb2993277 * Renamed tlib* tests so all file names of dependent tests differ only in last letter. This fixes failures caused by inability to locate dlls at runtime.
git-svn-id: trunk@27848 -
2014-06-04 11:53:07 +00:00
sergei
a8bc2085e8 - Delete strpas.inc files, no longer used, their contents has been merged into corresponding $(CPU).inc.
git-svn-id: trunk@27833 -
2014-05-31 00:49:40 +00:00
Jonas Maebe
03ef4b6477 + test for mantis #26226 (already works with FPC 2.7.1)
git-svn-id: trunk@27823 -
2014-05-29 12:19:27 +00:00
nickysn
daf71e6d88 * fixed multiplication by 64-bit constants on x86_64, mantis #26230
git-svn-id: trunk@27822 -
2014-05-28 22:52:08 +00:00
nickysn
3cc8ff11e3 + generate the stack segment for i8086 far data memory models from within fpc
itself (instead of having a fixed 16k stack in the startup code). This allows
  setting the stack size in these models with the -Cs option.

git-svn-id: trunk@27820 -
2014-05-27 23:29:50 +00:00
sergei
7e1c370c17 * Write RTTI for function arguments as children of function RTTI, resolves #24540,#25002,#25128 (bugs are basically duplicate, so adding only first of them to the testsuite).
git-svn-id: trunk@27797 -
2014-05-16 20:09:32 +00:00
florian
417d444376 * do not crash with an internal error if an indexed access is done on a constant pointer node
git-svn-id: trunk@27789 -
2014-05-14 17:35:09 +00:00