Commit Graph

5457 Commits

Author SHA1 Message Date
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
12f5cb85e8 Forgot to include option to trash variables for the test for Mantis #26271.
git-svn-id: trunk@27873 -
2014-06-06 14:10:54 +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
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
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
michael
6c7ab322a1 * Applied patch from Laco to fix bug ID #25939
git-svn-id: trunk@27846 -
2014-06-03 11:45:22 +00:00
Jonas Maebe
19c310f5d3 * fixed unit name
git-svn-id: trunk@27829 -
2014-05-30 07:25:04 +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
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
florian
bb129a6d6c * renamed overloaded fma functions into functions encoding explicitly the type
git-svn-id: trunk@27766 -
2014-05-11 11:51:41 +00:00
Jonas Maebe
362ff5ad01 * only check for _PROPERTY as a regular token, so that
{$modeswitch properties-} also affects global properties
    (mantis #25861)

git-svn-id: trunk@27758 -
2014-05-10 16:03:02 +00:00
michael
dc17b7ef46 * Extention -> extension (By Reinier, bug ID #25979)
git-svn-id: trunk@27757 -
2014-05-10 15:56:37 +00:00
Jonas Maebe
2075bf157e * insert JVM checkcast instructions when a voidpointer is implicitly
converted to an incompatible type

git-svn-id: trunk@27744 -
2014-05-10 12:47:34 +00:00
Jonas Maebe
675498a53e * javaa -> java
git-svn-id: trunk@27743 -
2014-05-10 12:47:31 +00:00
Jonas Maebe
20b8ade8ce * added readbarriers as counterparts for the writebarriers (see
"SMP BARRIER PAIRING"
    in https://www.kernel.org/doc/Documentation/memory-barriers.txt ), should
    fix sporadic crashes of the test

git-svn-id: trunk@27726 -
2014-05-03 16:16:17 +00:00
Jonas Maebe
e704dd8d74 * treat "u32bit-u32bit" as a signed value when removing automatic
64 bit upcasts, as the result can be negative when evaluated in
    64 bit (reported on irc, please file bug reports)

git-svn-id: trunk@27725 -
2014-05-03 15:06:16 +00:00
florian
8207e0ef22 + make use of vfnmsub*/vfmsub*/vfnmadd* instructions if possible
git-svn-id: trunk@27721 -
2014-05-02 21:07:46 +00:00
nickysn
8c86d64866 * fixed 'data structure too large' error in test tcall1.pp in the i8086 large
memory model

git-svn-id: trunk@27710 -
2014-05-01 18:27:01 +00:00
nickysn
4bbf2e8618 + enabled {$hugecode} for the test tcalcla1.pp in i8086 large memory model,
because in this model, the code of the test exceeds 64kb

git-svn-id: trunk@27699 -
2014-04-30 21:45:04 +00:00
Jonas Maebe
fba0eb0351 + test for part of mantis #25931 (already works correctly)
git-svn-id: trunk@27698 -
2014-04-30 20:08:50 +00:00
Jonas Maebe
724a6e9019 * fixed -Sx (mantis #25930)
git-svn-id: trunk@27697 -
2014-04-30 19:43:34 +00:00
Jonas Maebe
270c2d700e * allow the "then" part of an if-statement to be terminated by any endtoken,
instead of only by "else" (mantis #25781)

git-svn-id: trunk@27696 -
2014-04-30 19:25:06 +00:00
Jonas Maebe
02ce2e6029 * moved to correct directory
git-svn-id: trunk@27695 -
2014-04-30 19:25:02 +00:00
Jonas Maebe
8ac4a770a9 * check whether file/text is assigned in erase/rename (mantis #25932)
git-svn-id: trunk@27694 -
2014-04-30 18:31:22 +00:00
florian
24a9dd43b9 * do not crash with an ie on illegal boolean expressions in conditional compilation directives, resolves #25951
git-svn-id: trunk@27676 -
2014-04-27 15:50:37 +00:00
florian
33602db802 * try to registers more cleverly during fma code generation
git-svn-id: trunk@27671 -
2014-04-26 18:11:13 +00:00
nickysn
c5badc8a7c * fixed test cg/tvec.pp for small CPUs
git-svn-id: trunk@27652 -
2014-04-25 12:12:51 +00:00
nickysn
2de6edc44e * skip the large mem move test (which requires 4MB of memory) in tmem.pp on 16
and 8-bit CPUs

git-svn-id: trunk@27649 -
2014-04-25 09:18:04 +00:00
Jonas Maebe
01d63b376e * wait for some started threads to terminate when we fail to create
more, hopefully more robust that waiting an arbitrary amount of
    time in between
  * replaced calls to tthread.resume with calls tthread.start

git-svn-id: trunk@27624 -
2014-04-21 11:56:40 +00:00
pierre
d57d816744 powerpc64-aix C objects files added using gcc 4.8.1
git-svn-id: trunk@27585 -
2014-04-16 06:24:07 +00:00
florian
0a312a783e * avoid generation of avx code before the check if avx is supported
git-svn-id: trunk@27582 -
2014-04-14 18:18:29 +00:00
sergei
07e90aaa24 + Implemented IEEE 754-compliant checking for unordered results of floating-point compares on x86 targets. Mantis #9362.
git-svn-id: trunk@27581 -
2014-04-14 12:36:11 +00:00
florian
d88d644925 + support for FMA intrinsic: if there is no hardware support, the compiler throws an error.
Currently it is implemented only for x86-CPUs supporting the FMA extension. While it would
  be possible to implement it in software or simulate fma(<single>,<single>,<single>) using
  double operations, it makes no sense in my opinion to do so.

git-svn-id: trunk@27564 -
2014-04-13 19:21:54 +00:00
svenbarth
e85075de7f Fix for Mantis #25604.
nmat.pas:
  * correctly disable type checks if one of the arguments for MOD, DIV, SHR, SHL, NOT, -X and +X is a generic type parameter

+ added tests

git-svn-id: trunk@27535 -
2014-04-11 16:43:53 +00:00
svenbarth
c623824374 Fix for Mantis #25605.
symtable.pas, search_objectpascal_helper:
  * handle more symbol types than just properties and methods; afterall helpers can have types, static variables and constants as well

+ added test

git-svn-id: trunk@27534 -
2014-04-11 16:13:44 +00:00
svenbarth
256c852631 Fix for Mantis #23776.
ninl.pas, tinlinenode.pass_typecheck:
  * don't generate a type error if Length() is used inside generics with a generic argument

+ added test

git-svn-id: trunk@27533 -
2014-04-11 15:57:21 +00:00
svenbarth
b0670ee34c Fix for Mantis #25600.
ptype.pas, read_named_type.array_dec:
  * generate a valid range definition if we are inside a generic and the array bounds are not ordinals (Note: the check for "parse_generic" should be improved to really detect erratic indexes that are not related to generics in any way)

+ added test

git-svn-id: trunk@27532 -
2014-04-11 14:57:23 +00:00
Jonas Maebe
4a0528399e * check all overloaded routines for mangled name conflicts on the JVM
platform, as different Pascal declarations are mapped to the same
    JVM representation

git-svn-id: trunk@27520 -
2014-04-10 21:07:14 +00:00
Jonas Maebe
3a5e675a2b * fixed typo in last change (javaa instead of java)
git-svn-id: trunk@27519 -
2014-04-10 21:07:09 +00:00
nickysn
a9cfd647ae + added i8086-msdos tests for interrupt procs, intr, getintvec and setintvec
git-svn-id: trunk@27503 -
2014-04-07 22:26:45 +00:00
nickysn
bf1e15fd39 + added another far pointer arithmetic test
git-svn-id: trunk@27490 -
2014-04-06 15:36:17 +00:00
nickysn
cef4092f3d - rm some unneeded assignments from the test
git-svn-id: trunk@27489 -
2014-04-06 15:27:53 +00:00
nickysn
a11c7fe476 + report the number of the failing test in the exit code
git-svn-id: trunk@27488 -
2014-04-06 15:15:22 +00:00
florian
701cdf8ea2 * fix for #25956: left is not necessarily the array load node when accessing an open array/array of const element
git-svn-id: trunk@27487 -
2014-04-06 15:15:16 +00:00
nickysn
cd90154b9c + added pointer const tests to the far pointer arithmetic test tfarptr3.pp
git-svn-id: trunk@27486 -
2014-04-06 15:11:49 +00:00
nickysn
8d1ed088c8 + implemented far pointer arithmetic (operating only on the offset, without
touching the segment)

git-svn-id: trunk@27485 -
2014-04-06 13:12:29 +00:00
sergei
adc8cdb5af * Calling tlabelsym.mangledname should not define the label. This was causing "already defined" errors if a label was referenced before it was defined.
+ Test.
+ Check duplicate labels in assembler blocks. This was impossible due to above bug and duplicate labels were detected only at assembling stage where no location information could be provided.

git-svn-id: trunk@27472 -
2014-04-05 01:17:36 +00:00
svenbarth
5c1b8fdad9 Fix for Mantis #19697. For this we need to have the internal static var symbol know that it came from a static field var symbol so that we can check that for generic or not.
symsym.pas, tfieldvarsym:
  + add new field fieldvarsym which holds a reference to a tfieldvarsym if the static sym was created based on such a symbol
  + add necessary methods and code to correctly load from and store to PPU
  + add new constructor create_from_fieldvar
symcreat.pas, make_field_static: 
  * use new create_from_fieldvar constructor instead of the default one
hlcgobj.pas, finalize_static_data:
  * check whether the static var is based on a generic's class var
ppu.pas:
  * increase PPU version

+ added test

git-svn-id: trunk@27466 -
2014-04-04 16:15:41 +00:00
svenbarth
c5050ea645 Forgot to commit test mentioned in last commit
git-svn-id: trunk@27465 -
2014-04-04 16:10:08 +00:00
svenbarth
689996d84f Fix for Mantis #25959.
* pdecsub.pas, parse_proc_direc:
    when a hint directive is parsed we need to check whether the new token can still be a directive

+ added test (though that won't help much as we don't check the compiler output yet... :/ )

git-svn-id: trunk@27463 -
2014-04-04 14:04:32 +00:00
Jonas Maebe
54964d92eb + forgot to commit, part of r26472
git-svn-id: trunk@27382 -
2014-03-30 16:55:03 +00:00
sergei
1744988962 * Modified behavior of CExtended type in overload selection: it is made more compatible to Extended than to Double and Single. Also an Extended parameter selects a CExtended overload (if available) instead of Double.
+ Test.

git-svn-id: trunk@27366 -
2014-03-30 07:31:58 +00:00
svenbarth
a08e8ff982 Fix for Mantis #25929
* ninl.pas, tinlinenode.handle_default.getdefaultvarsym:
    prefix the default variable's name with a "$zero" instead of a "zero" and use only the string from the second character on for comparisons so that findwithhash() and checkduplicates() generate consistent results

+ added test

git-svn-id: trunk@27320 -
2014-03-28 14:45:18 +00:00
florian
775ac591df * fix test: fma support does not necessarily mean that there is avx2 support
git-svn-id: trunk@27294 -
2014-03-27 09:41:59 +00:00
florian
23ab30c1f8 - removes accidently commited comments for testing
git-svn-id: trunk@27228 -
2014-03-22 17:03:39 +00:00
florian
3b14b28161 + support for FASM output, using it for testing does not work though, see readme.txt
git-svn-id: trunk@27227 -
2014-03-22 17:02:19 +00:00
florian
6f14dbdebe * avoid internal error if an empty record is assigned to a function result, resolves #25895
git-svn-id: trunk@27223 -
2014-03-21 16:31:57 +00:00
Jonas Maebe
f936a48afa * don't change the forward/interface definition of regular forward/interface
functions whose implementation is declared "external". This results in less
    efficient code (all calls will go through a stub), but it prevents interface
    crc changes (-> no recompilations in case of circular dependencies) and it
    also keeps the interface stable (if the external implementation is changed
    afterwards to another external routine or to a local implementation, the
    mangled name of the routine does not change) (mantis #24121)

git-svn-id: trunk@27213 -
2014-03-20 21:03:07 +00:00
florian
ff6afe27cd * enabled fma instruction as the compiler knows them since r27209
git-svn-id: trunk@27210 -
2014-03-20 20:08:58 +00:00
florian
a79be2b05c + support for FMA instructions in inline assembler
+ extended avx test code with FMA

git-svn-id: trunk@27209 -
2014-03-20 20:06:56 +00:00
florian
5d57f38619 + functions for FMA and AVX2 detection
git-svn-id: trunk@27202 -
2014-03-20 15:47:51 +00:00
florian
aa107b914c * merged avx2 branch, developed by Torsten Grundke
git-svn-id: trunk@27200 -
2014-03-20 12:03:52 +00:00
sergei
ab3ae9cf40 * Fixed comment.
git-svn-id: trunk@27183 -
2014-03-19 12:57:26 +00:00
Jonas Maebe
4dfc731bdc + support for nested classes in the WPO devirtualisation and VMT
optimization infrastructure (mantis #25869)

git-svn-id: trunk@27167 -
2014-03-16 19:46:17 +00:00
nickysn
1ef9a0509b - rm packset 1, because that's already the default in delphi mode
git-svn-id: trunk@27160 -
2014-03-16 15:32:35 +00:00
nickysn
015c7e951a * Changed the default packset setting to 1 and disabled the padding of 3-byte
sets to 4 bytes on 16 and 8-bit CPUs. This is compatible with Turbo Pascal 7
  and Delphi 1.

git-svn-id: trunk@27140 -
2014-03-14 23:51:14 +00:00
Jonas Maebe
9420a5d7a7 * also check for targets not supporting -gc/checkpointer functionality in
compiler directives, not just on the command line (mantis #25862)

git-svn-id: trunk@27128 -
2014-03-13 20:42:18 +00:00
nickysn
dcc2354760 * disallow 64-bit property index specifiers on 64-bit CPUs, since they were not
handled correctly there anyway (they were silently truncated to 32-bit)

git-svn-id: trunk@27061 -
2014-03-09 21:05:53 +00:00
nickysn
0621dd523a * objpas.integer=smallint fixes in several tests
git-svn-id: trunk@27054 -
2014-03-09 17:13:40 +00:00
nickysn
19a39cde4a * 16-bit objpas.integer type fixes in Math.DivMod
git-svn-id: trunk@27052 -
2014-03-09 16:46:49 +00:00
nickysn
5ac193dfc3 * fixed test tbsx1.pp for a 16-bit objpas.integer type
git-svn-id: trunk@27050 -
2014-03-09 16:45:15 +00:00
florian
c9f7c7d88c + test for windows which tests if an .rc file can be really compiled into an .res file
git-svn-id: trunk@27042 -
2014-03-09 10:54:33 +00:00
florian
e755a19c42 * win64 ignores -Cg
git-svn-id: trunk@27040 -
2014-03-09 10:51:42 +00:00
florian
08a4e1efe1 * handle for ... in on arrays of constant correctly, resolves also #25838
+ tests

git-svn-id: trunk@27039 -
2014-03-09 09:03:22 +00:00
Jonas Maebe
ffac2feb59 * since we only build the deref for tprocdef.localst when we're
going to write it to the ppu since r26083, also only deref it
    if that's the case (mantis #25814)

git-svn-id: trunk@26956 -
2014-03-04 19:42:39 +00:00
Jonas Maebe
4f1207f603 + support for specifying an optional command line parameter to use during a
recompile of a test

git-svn-id: trunk@26955 -
2014-03-04 19:42:35 +00:00
florian
23c724f885 * prevent a temp. register allocated during spilling being immediately spilled again, resolves #25164
git-svn-id: trunk@26930 -
2014-03-02 19:47:05 +00:00
florian
68f1a51164 * set PIC defines earlier, resolve #25788
git-svn-id: trunk@26924 -
2014-03-02 15:35:08 +00:00
nickysn
30b1aa1d96 * document the known delphi xe3 64-bit test failures
git-svn-id: trunk@26903 -
2014-02-28 14:08:50 +00:00
Jonas Maebe
9315c121d4 - removed cwstring again, it's not needed and breaks compilation of the test
on non-Unix platforms

git-svn-id: trunk@26896 -
2014-02-27 11:54:48 +00:00
michael
7593696a03 * Fixed all tests to be D2009+ compatible
git-svn-id: trunk@26894 -
2014-02-27 09:07:56 +00:00
nickysn
888ecdaee4 * fixed the type conversions of the 'and' operator to be Delphi compatible. Fixes Mantis #25179
git-svn-id: trunk@26882 -
2014-02-25 18:06:29 +00:00
michael
9faea4e757 * Fixed test so the same result as in Delphi
git-svn-id: trunk@26877 -
2014-02-25 10:35:39 +00:00
michael
ff2b6a90d9 * Added tests for various strutils functions by Karl-Michael Schindler (bug ID 25756)
git-svn-id: trunk@26833 -
2014-02-22 12:40:31 +00:00
florian
ab3f5744e0 * skip dec/inc type checking in unspecialized generic methods, resolves #25603
git-svn-id: trunk@26830 -
2014-02-22 09:20:57 +00:00
svenbarth
60a07770f1 Fix cycling after addition of the new case simplification.
nset.pas, tcasenode.simplify: don't assume a specific order of the case labels

+ added test based on ppu.pas, tppu.getaint where no matching case label was found because of the ordering

git-svn-id: trunk@26825 -
2014-02-21 22:49:19 +00:00
svenbarth
500920030b Implement simplification of ordinal case nodes if the case expression is constant (might be useful when inlining).
+ nset.pas, tcasenode: add simplify method; for ordinal constant case expressions either return a copy of the correct block or return a nothing node if the constant did not match anything

+ added test to check that nothing is broken

git-svn-id: trunk@26824 -
2014-02-21 20:36:41 +00:00
florian
6364cf412d * do not crash on invalid property declaration, resolves #23980
git-svn-id: trunk@26818 -
2014-02-19 19:44:06 +00:00
florian
caba4a2050 + test for #24410 so it does not popup again
git-svn-id: trunk@26811 -
2014-02-18 19:30:42 +00:00
florian
6e1bf4d040 * properly simplify not(<const. cbool>), resolves #25255
git-svn-id: trunk@26803 -
2014-02-16 20:20:58 +00:00
svenbarth
ddb78fefdc Add a modeswitch for type helpers as discussed in core on 24th October 2013. It is disabled by default in all modes (afterall type helper support in Delphi started only beginning with XE3)
+ globtype.pas: add new modeswitch to modeswitch enum and name array
* ptype.pas & pdecobj.pas: check for new modeswitch instead of modeswitch class
* ppu.pas: increase ppu version as we've added a new modeswitch which requires correctly compiled units

* adjusted tests to enabled the modeswitch when necessary
+ added three new tests that check for correct functionality of modeswitch typehelpers

git-svn-id: trunk@26796 -
2014-02-16 12:58:24 +00:00
florian
711c533573 * moved test because it tests a certain functionalty and was made solely to test strutils.IsWild
git-svn-id: trunk@26788 -
2014-02-15 15:32:50 +00:00
florian
ad7a3b2dbf * explicitly type cast constants so the compiler does not use smaller types if an fpu instruction set is selected which does not support the highest precision type
git-svn-id: trunk@26775 -
2014-02-14 21:26:54 +00:00
sergei
6c66b8ffe3 * Fixed upper limit in tbits.findnextbit, Mantis #25398.
git-svn-id: trunk@26754 -
2014-02-11 16:39:45 +00:00
michael
1c9560f52e * Added test for IsWild function by Karl-Michael Schindler
git-svn-id: trunk@26748 -
2014-02-11 13:18:11 +00:00
florian
5dcb59c2d4 * renamed test, resolves #25696
git-svn-id: trunk@26733 -
2014-02-08 19:21:08 +00:00
florian
1366498255 + nf_addr_taken: it marks nodes which address is taken
+ check if tnodeflags is 4 bytes or less
* do not do cse on expressions which address is taken

git-svn-id: trunk@26713 -
2014-02-07 20:40:42 +00:00
yury
78304dde66 * mipsel-android: Added C object files for tests.
git-svn-id: trunk@26710 -
2014-02-07 14:40:25 +00:00
yury
73c26bd6be * mipsel-android: Regenerated makefiles. From now the mipsel-android target can be built and used.
git-svn-id: trunk@26705 -
2014-02-07 12:37:17 +00:00
florian
c41d043ac8 + test for last commit
git-svn-id: trunk@26693 -
2014-02-06 19:51:43 +00:00
sergei
a1dfaa54dd * Fixed exception handling in constructors of TP-style objects to correctly handle cases of statically allocated objects (must call destructor but do not free memory) and objects without destructor (must free memory if it was allocated dynamically).
+ Test extended.

git-svn-id: trunk@26676 -
2014-02-05 18:19:13 +00:00
sergei
a5d5ce8eb2 * TP-style object destructors do not need actual VMT in hidden parameter, a constant flag indicating need to free memory is sufficient.
* Destructor called from exception block in constructor must have this flag set in order to free memory.
+ Test.

git-svn-id: trunk@26656 -
2014-02-03 00:20:42 +00:00
florian
be17962748 * delete test file immediately after they were used, external tools might get into trouble trying deleting them due to the uncommon names
git-svn-id: trunk@26655 -
2014-02-02 19:10:42 +00:00
florian
ecdfe75841 * tests fail if dead values are optimized so disable dead value optimization for the tests
git-svn-id: trunk@26631 -
2014-01-30 19:44:12 +00:00
Jonas Maebe
c05da62b0e * detect static data use by record methods and methods of nested classes/
records, so we avoid inlining them (mantis #25598)

git-svn-id: trunk@26617 -
2014-01-29 21:26:38 +00:00
Jonas Maebe
2f741121e9 * don't give an internal error when freeing an error token in the preprocessor
(mantis #25573)

git-svn-id: trunk@26614 -
2014-01-29 19:26:03 +00:00
Jonas Maebe
2adfb6cdda * don't endlessly recurse when printing the typename of a procvardef that
refers to itself via a pointerdef in its parameter or result type(s)
    (mantis #25551)

git-svn-id: trunk@26610 -
2014-01-28 20:14:31 +00:00
Jonas Maebe
89d97a3c2e * only consider tc_pointer_to_array typeconversions to determine whether a
pointer->array type conversion implies an implicit dereference operation
    (mantis #25622)

git-svn-id: trunk@26608 -
2014-01-28 20:14:24 +00:00
nickysn
1faf138667 + fixed mistyped call to BsfWord in test tbsx1.pp
git-svn-id: trunk@26594 -
2014-01-26 23:50:30 +00:00
florian
0ea0b5c34d * quote parameters
git-svn-id: trunk@26584 -
2014-01-26 11:40:46 +00:00
florian
0e67ca6419 * fixed output of test if a failure happens
git-svn-id: trunk@26505 -
2014-01-18 12:08:02 +00:00
Jonas Maebe
a5653916e0 * convert array indices always to s32int, because that is the index type used
by java arrays (otherwise we may get unwanted sign extensions after
    performing e.g. an s16bit operation, see the test)

git-svn-id: trunk@26472 -
2014-01-15 20:36:52 +00:00
Jonas Maebe
5fc4af09dd * don't crash when searching for a type helper in an anonymous array (or
other non-record/objectdef-based) type (mantis #25504)

git-svn-id: trunk@26459 -
2014-01-14 19:52:20 +00:00
florian
b90db73fbc * fixed test
git-svn-id: trunk@26440 -
2014-01-12 20:17:59 +00:00
nickysn
c09bfe9896 * fixed test targets directive (should be '%target', instead of '%platform')
git-svn-id: trunk@26401 -
2014-01-05 22:11:35 +00:00
Jonas Maebe
ffd6a4ea47 * set the code page of rawbytestring typed constants to the same value as
when assigning a string constant to a rawbytestring (system code page with
    {$modeswitch systemcodepage}, CP_ACP without) (mantis #25332)

git-svn-id: trunk@26397 -
2014-01-05 18:26:10 +00:00
Jonas Maebe
68af0bdd40 * moved test to correct location and renamed to correct number
git-svn-id: trunk@26390 -
2014-01-05 10:58:40 +00:00
pierre
a7a9a74f91 Try to become HTML 4 transitional compliant and add svn links
git-svn-id: trunk@26384 -
2014-01-04 21:16:01 +00:00
pierre
62bcc3a2c5 Program cleaned up
git-svn-id: trunk@26382 -
2014-01-04 21:12:34 +00:00
pierre
7adeb480e1 Remove GetTestRunHistoryID, replaced by GetTestNextRunHistoryID and GetTestPreviousHistoryID
git-svn-id: trunk@26381 -
2014-01-04 21:11:23 +00:00
pierre
166ab46317 Add missing SqlDate calls inside InsertNewTestConfigId
git-svn-id: trunk@26380 -
2014-01-04 21:07:44 +00:00
florian
f393c3ff37 * propagate constants into the header of a for loop
+ test which avoids this so we do not miss regressions on for loops with variable boundaries

git-svn-id: trunk@26339 -
2013-12-31 13:16:09 +00:00
Jonas Maebe
d2b8275b99 + support for arbitrary encodings in readstr/writestr
o set the code page of the temporary "text" file to utf-8 for writestr with
     unicodestring/widestring as destination, so that no data loss can occur
     (+ properly deal with cases whereby part of an utf-8 character is
      written to the textbuf in this case)
   o explicitly pass the code page of the destination ansistring for writestr
     with ansistring as destination and set it for the temporary "text" file
   o set the code page of the text file for readstr

git-svn-id: trunk@26317 -
2013-12-29 19:18:49 +00:00
florian
27f6fd1c2c * use new shl/shr constant folding (of r26295) only if forinline is set
* explicitly simplify tree after constant propagation

git-svn-id: trunk@26311 -
2013-12-29 14:09:03 +00:00
florian
739166f3e7 * fix test
git-svn-id: trunk@26308 -
2013-12-29 10:03:41 +00:00
florian
4258fe6765 * adapt exponent used in test to supported float type
git-svn-id: trunk@26304 -
2013-12-28 20:19:58 +00:00
florian
b47f1c4176 * disable constant propagation for tests which will cause a regression because const. prop. causes a compile time error while the tests expect a runtime error
git-svn-id: trunk@26300 -
2013-12-28 20:19:49 +00:00
florian
be807d6cef + tests for dead store removal
git-svn-id: trunk@26299 -
2013-12-28 20:19:46 +00:00
florian
89663e499b * fold shifting of constants equally to cpus
* test adapted, e.g. 1 shl 63 needs now an explicit cast to qword for the one: qword(1) shl 63

git-svn-id: trunk@26295 -
2013-12-28 20:19:35 +00:00
sergei
c3c682fe3f * Changed test so it provides different exit codes depending on the failed assertion.
git-svn-id: trunk@26280 -
2013-12-25 10:33:16 +00:00
pierre
a0747f4d5d Also update TESTCONFIG and TESTRUNHISTORY tables
git-svn-id: trunk@26218 -
2013-12-11 12:33:45 +00:00
pierre
218adfe6c3 * Allow compilation for windows OS.
* soHost -> coHost to be consistent with other TConfigOpt values.
  * ConfigOpts rewritten to have corresponding coXXX constants in comments
  + Add support for long options
  * Go past first >>>> line in longlog file to avoid warning

git-svn-id: trunk@26217 -
2013-12-11 12:27:17 +00:00
pierre
360f53b742 Add -ll option to use longlog file
git-svn-id: trunk@26216 -
2013-12-11 12:21:10 +00:00
pierre
80c67337ed Move GetTestRunHistoryID and AddTestHistoryEntry to dbtests unit
git-svn-id: trunk@26211 -
2013-12-10 13:22:20 +00:00
pierre
a5ea0d2b4c Add dbconfig program to handle TESTCONFIG table
git-svn-id: trunk@26209 -
2013-12-10 08:48:08 +00:00
pierre
bd91a8da7e Force SrcExeExt for prog parameter in ExecuteRemote function
git-svn-id: trunk@26208 -
2013-12-10 08:41:30 +00:00
pierre
85f138b409 + Add StringQuery and InsertQuery functions.
* Call FreeQueryResults if TQueryResult is discarded.

git-svn-id: trunk@26207 -
2013-12-10 08:37:39 +00:00
pierre
0987129993 Add 2.6.0 to 2.6.3 versions
git-svn-id: trunk@26206 -
2013-12-10 08:31:58 +00:00
pierre
cf175b28d1 Add TU_COMPILERDATE to ShowRunData
git-svn-id: trunk@26205 -
2013-12-10 08:27:13 +00:00
florian
dde4ec96c2 * avoid range check error during compilation due to constant propagation
git-svn-id: trunk@26196 -
2013-12-08 09:05:34 +00:00
florian
49fe968d1d * the dfa code now behaves like the old initialization checking code: uninitialized parameters passed by reference cause only a hint
git-svn-id: trunk@26160 -
2013-12-01 17:01:57 +00:00
florian
99eadb91b3 * run CheckAndWarn to get proper locations for warnings about uninitialized variables
* several fixes to liveness analysis
* get rid of old version defines
+ tests

git-svn-id: trunk@26159 -
2013-12-01 17:01:51 +00:00
Jonas Maebe
cddc31a1a8 * also allow 'cpXXXX' in addition to 'CPXXXX' code page names (mantis #15169)
git-svn-id: trunk@26148 -
2013-11-27 20:27:16 +00:00
Jonas Maebe
5e129b4ac5 * fixed TBinaryObjectReader.ReadSingle(), .ReadCurrency() and .ReadDate():
explicitly typecasting a qword to single/currency/tdatetime is no different
    from assigning it directly, since integer types are assignment-compatible
    with floating point types (mantis #25170)

git-svn-id: trunk@26146 -
2013-11-27 19:59:48 +00:00
sergei
be45b411b2 * Disable PIC for tests that contain non-PIC assembler code.
git-svn-id: trunk@26138 -
2013-11-25 14:09:57 +00:00
Jonas Maebe
7be4e20307 * also don't put a value in registers if it is converted from a type that can
be held in one kind of register to a type that can be held in another kind
    of register (mantis #25361)

git-svn-id: trunk@26128 -
2013-11-24 12:49:23 +00:00
sergei
43c96cd898 * TBits.ORBits and TBits.XORBits: properly handle case when other TBits object has smaller Size. Mantis #25289.
git-svn-id: trunk@26121 -
2013-11-23 19:12:57 +00:00
Jonas Maebe
951727f453 * fixed crash when concatenating more than 2 ansistrings that are all empty
(mantis #25349, patch by C Western)

git-svn-id: trunk@26119 -
2013-11-22 12:57:41 +00:00
paul
6e7cc22207 compiler: don't allow to assign to for-in loop variable (bug #0025318)
git-svn-id: trunk@26108 -
2013-11-19 05:29:37 +00:00
nickysn
fbca7ee2cb * check callerside if calleeside isn't available in is_ecx_used. Based on the
patch by Do-wan Kim, mantis #25269.

git-svn-id: trunk@26101 -
2013-11-16 19:39:15 +00:00
Jonas Maebe
b6d279d4aa * don't transform div-by-power-of-2 into a shift when overflow checking is
enabled (mantis #23849)

git-svn-id: trunk@26089 -
2013-11-14 15:47:49 +00:00
florian
92508a9801 * take of life of tlabelnode.left, the test does not test this however because I'am not aware of any example to force a left node for a label
git-svn-id: trunk@26082 -
2013-11-13 19:26:37 +00:00
Jonas Maebe
3e393b867b * small extension of the test
git-svn-id: trunk@26066 -
2013-11-12 10:30:28 +00:00
nickysn
c666649320 * proper fix for the passing of TEST_OPT to tstunits on msdos. The value of
TEST_OPT was normally already passed in OPT, but on msdos the old value
  was killed, due to the 'override OPT=-CX'.

git-svn-id: trunk@26009 -
2013-11-10 14:36:06 +00:00
nickysn
681350daba * add the options specified in TEST_OPT when compiling the tstunits. This allows
running the testsuite for a different than the default i8086 memory model by
  specifying (for example) TEST_OPT=-WmMedium

git-svn-id: trunk@26007 -
2013-11-10 12:23:26 +00:00
florian
1d4a4d0684 + noreturn directive
git-svn-id: trunk@26003 -
2013-11-10 09:00:59 +00:00
florian
5f167091c0 * fix test so it works with const. propagation and does throws the range check error at run time
git-svn-id: trunk@25960 -
2013-11-06 21:10:20 +00:00
Jonas Maebe
d4b6406e62 * fixed compilation of new str<->float code on the JVM target (patch by
Max Nazhalov) and use that code by default on the JVM target
  * adapted JVM tests for the new str<->float code similar to how the
    generic tests were adapted

git-svn-id: trunk@25954 -
2013-11-06 16:13:50 +00:00
Károly Balogh
eb8858933d added a simple optional utility to convert FP Testsuite results to JUnit.XML format
git-svn-id: trunk@25915 -
2013-11-02 20:39:11 +00:00
Jonas Maebe
dad15f2843 * fixed test for double precision platforms after r25888
git-svn-id: trunk@25894 -
2013-11-01 14:18:40 +00:00
Jonas Maebe
96ac477b96 * part of r25888, forgot to commit
git-svn-id: trunk@25891 -
2013-10-31 13:50:35 +00:00
Jonas Maebe
85059f79fe * readded halt(1) temporarily removed for testing and accidentally committed
git-svn-id: trunk@25890 -
2013-10-31 13:47:49 +00:00
Jonas Maebe
4becf1f3c1 + tests for mantis #23196 and #25122, already fixed by r25888
git-svn-id: trunk@25889 -
2013-10-31 13:10:48 +00:00
Jonas Maebe
21eeec9981 + re-implementation of real->string and string->real conversion routines
based on the Grisu1 algorithm. This corrects several precision issues
    with the previous code used to perform such conversions (patch by
    Max Nazhalov, mantis #25241)
   o adaptation of several tests to deal with the better precision of these
     routines compared to the previous version
  Please don't remove the real2str.inc file yet, it's still used by the
  JVM target for now

git-svn-id: trunk@25888 -
2013-10-31 12:39:27 +00:00
svenbarth
c077adf499 Fix for Mantis #25132
defcmp.pas, objectdef_is_related:
  * use "equal_defs" instead of "=", as the former also handles equivalence of specializations

+ added test

git-svn-id: trunk@25848 -
2013-10-25 19:50:56 +00:00
Jonas Maebe
b70e64dc67 * fixed some bugs in the camelCase conversion performed on the JVM target by
-CTlowercaseprocstart
   o convert all consecutive uppercase characters at the start to lowercase
     instead of only the first one. Exception: if there is more than one
     such character and the last one is followed by a lowercase character,
     assume the last uppercase character belongs to the second word (like
     in FPCIsGreat) and don't lowercase that one
 + test

git-svn-id: trunk@25845 -
2013-10-23 22:44:45 +00:00
Jonas Maebe
555634b755 * (re)set upper bits of register when appropriate for all operations in
a_op_reg_reg() (except for NOT, which was already handled correctly)
    + test

git-svn-id: trunk@25840 -
2013-10-22 07:41:52 +00:00
nickysn
703e3f3ce2 * fixed test/cg/tcall1.pp for i8086
git-svn-id: trunk@25837 -
2013-10-20 20:09:27 +00:00
svenbarth
d908dbeec1 Fix for Mantis #25215.
compiler/scanner.pas, tscannerfile.readtoken:
  * after trying to read a _INTCONST check whether a valid first character for an identifier follows and give a syntax error if that is not the case

+ added test

git-svn-id: trunk@25835 -
2013-10-20 12:15:49 +00:00
svenbarth
d91d4afb0f Fix for Mantis #25210 .
compiler/pdecobj.pas, object_dec:
  * since revision 25518 the global symtable of the current module is no longer popped and pushed again so that the defaware symtablestack can add the helper; thus we need to do this not only for static symtables, but for global ones as well
  * adjusted comment to reflect current situation

git-svn-id: trunk@25834 -
2013-10-20 11:33:01 +00:00
nickysn
1f30cd9505 * fixed test tmaclocalprocparam4c.pp for i8086 medium memory model
git-svn-id: trunk@25833 -
2013-10-19 22:42:35 +00:00
nickysn
f3a686eb69 * i8086 far code memory model fixes in tests tw2739,tw3173,tw16034,tw1152,
tw2944 and tw9261

git-svn-id: trunk@25832 -
2013-10-19 21:43:40 +00:00
nickysn
aab978fd19 * fixed test tmacprocvar for i8086 far code memory models
git-svn-id: trunk@25823 -
2013-10-18 17:23:25 +00:00
nickysn
38ad4974fd * i8086 medium/compact memory model fixes in tests tb0368,tb0423,tb0433,tb0433a,
tb0508 and tb0594

git-svn-id: trunk@25822 -
2013-10-18 15:43:14 +00:00
nickysn
7e3d041a11 * fixed test tb0309.pp for i8086 medium/compact memory models
git-svn-id: trunk@25821 -
2013-10-18 14:24:27 +00:00
nickysn
2a11883ad6 * fixed test units/system/tassignd.pp for i8086 medium/compact memory model
git-svn-id: trunk@25820 -
2013-10-18 14:18:36 +00:00
nickysn
f006476ff0 * fixed tests tprocvar1 and tprocvar3 for i8086 medium/compact memory model
git-svn-id: trunk@25819 -
2013-10-18 14:08:11 +00:00
nickysn
1795368cff * fixed test tchlp24 for i8086 medium/compact memory models
git-svn-id: trunk@25818 -
2013-10-18 13:28:10 +00:00
nickysn
e0350d6f44 + added test tlea2.pp, which tests the LEA instruction with a 64-bit, 32-bit and
16-bit operand size on x86_64

git-svn-id: trunk@25810 -
2013-10-17 18:25:17 +00:00
nickysn
4aa010eedc + support LEA with 16-bit operand size
git-svn-id: trunk@25808 -
2013-10-17 16:11:08 +00:00
Jonas Maebe
8dd956cbde * convert unicode/widestring constants to ansistring in resourcestring
declarations (mantis #25198)

git-svn-id: trunk@25807 -
2013-10-17 12:43:39 +00:00
nickysn
60537a94ea * fixed test tintuint for i8086 medium memory model
git-svn-id: trunk@25797 -
2013-10-15 22:49:40 +00:00
Jonas Maebe
10ae87f11c * fixed LdrLdr2LdrMov optimisation in case the first and second ldr have
a different size (disable it in that case) + test

git-svn-id: trunk@25778 -
2013-10-14 12:49:34 +00:00
Jonas Maebe
31a3122b91 * fixed LsrAnd2Lsr test by replacing the existing buggy check with comparing
the outcome of the original and the optimised sequence and seeing whether
    it's same + test

git-svn-id: trunk@25776 -
2013-10-14 12:49:28 +00:00
paul
1c578de28c compiler:
* don't allow to apply the same hint directive twice
  * change parser_e_proc_dir_not_allowed to more generic variant parser_e_dir_not_allowed - they are similar and 'procedure' prefix does not give more information about the error.
  * maybe_parse_hint_directives() uses procdef settings for initial values
  + add tests

git-svn-id: trunk@25720 -
2013-10-08 04:56:42 +00:00
paul
912384594b fpc: allow hint directives between other procedure directives in Delphi mode (issue #25101)
git-svn-id: trunk@25710 -
2013-10-07 10:59:53 +00:00
florian
6391fd39aa * optimize also tail calls, if it is a simple procedure
git-svn-id: trunk@25688 -
2013-10-06 13:51:38 +00:00
florian
f95b225157 * fix wrong constant temp handling, introduced in r24953, resolves #24915
git-svn-id: trunk@25684 -
2013-10-06 13:08:52 +00:00
nickysn
1bea98995b * regenerated fpcmake makefiles after r25642
git-svn-id: trunk@25644 -
2013-10-05 10:11:27 +00:00
svenbarth
bb00c76fe7 Fix for Mantis #21015 .
symdef.pas:
  * tobjectdef.find_implemented_interface: use equal_defs to ensure that equal specializations of interfaces are found as well
  * getparaencoding: use globals.CP_NONE instead of just CP_NONE, because defcmp contains a cp_none enum as well.

+ added test

git-svn-id: trunk@25609 -
2013-09-30 08:44:46 +00:00
svenbarth
2c93687c5a Fix an embarrasing error in m68k which fixes 60 tests.
m68k/cgcpu.pas, tcg68k.g_flags2reg:
  * don't sign extend the flag value which was stored to the register, but instead do a "AND 1" on it to reduce it to 1 bit; afterall Booleans in Pascal are either 0 or 1 and not 0 or $FF

+ added test

git-svn-id: trunk@25598 -
2013-09-28 20:07:57 +00:00
Jonas Maebe
8e107217f6 + added "nostackframe" to routine with code that should assemble into
a single instruction

git-svn-id: trunk@25585 -
2013-09-27 15:06:48 +00:00
svenbarth
e8edbd29c0 Fix for Mantis #24687.
pgenutil.pas:
  + add new function could_be_generic which checks whether a given symbol name could be a generic (which is determined using the genericdummysyms list for the current module)
pexpr.pas:
  * factor: only do a typecheck pass (postfixoperators does one as well) if the found node can not be a generic type
  * sub_expr: do a typecheck pass if it isn't a specialization

+ added test

git-svn-id: trunk@25579 -
2013-09-26 10:21:11 +00:00
svenbarth
fb8b0e7a27 Fix for Mantis #24453. Check for nested types after a specialization. Additionally check correctly whether a type is really a generic before accepting it when parsing a generic.
pgenutil.pas, generate_specialization:
  * use "is_generic" instead of "df_generic in defoptions" as nested non generic types will have that flag set as well and thus would be acceptable for the "<...>" notation although no generic version of it exists
ptype.pas, single_type:
  * check for nested types after doing a specialization

+ added tests (one for now working case and one for now forbidden case)

git-svn-id: trunk@25578 -
2013-09-26 09:21:28 +00:00
svenbarth
68a3827539 Fix for Mantis #21051. Correctly handle specializations that occur during the specialization of methods.
cclasses.pas:
  + TFPHashList & TFPHashObjectList: add WhileEachCall methods that walk the list like ForEachCall does, but uses a while-loop instead of a for-loop
psub.pas, generate_specialization_procs:
  * use WhileEachCall instead of ForEachCall as new defs can be added during the specialization that need to be specialized as well

+ added test

git-svn-id: trunk@25577 -
2013-09-26 08:15:58 +00:00
paul
cdd5d029f0 compiler: don't add operator name as a function result into operator symtable. For FPC mode only operator result identifier should be added and for Delphi mode only 'Result' identifier. Fixes mantis #0025081
git-svn-id: trunk@25562 -
2013-09-25 05:22:28 +00:00
paul
c22c364f43 compiler: regenerate parameter list in tprocvardef.getcopy (fixes compiler crash, issue #0025077)
git-svn-id: trunk@25561 -
2013-09-25 03:28:14 +00:00
paul
ce6c8c1b59 compiler: search namespace symbols also in the interface symtable of a unit when we are registering a unit with a namespace in the implementation section (fixes issue #0025059)
git-svn-id: trunk@25560 -
2013-09-25 02:25:26 +00:00
nickysn
07bbfc7c60 + added { on} to test tfarcal1.pp
git-svn-id: trunk@25552 -
2013-09-24 18:15:43 +00:00
paul
f3963172ba compiler: don't look at unit and namespace symbols from other units while searching for a type (issue #0025054)
git-svn-id: trunk@25536 -
2013-09-23 09:22:47 +00:00
svenbarth
9d48bc0baf Implement cross unit type overloading of generics. This fixes the regression introduced with revision 25498.
symtable.pas:
  + add new tsymbol_search_flag type which can be passed to various searchsym* routines
  + add support to not call "addsymref"
  + add new searchsym_with_flags function that calls searchsym_maybe_with_symoption
  * adjust searchsym_maybe_with_symoption, searchsym_in_class & searchsym_in_helper to use new flag type instead of Boolean arguments
  * adjust searchsym & searchsym_with_symoption which call the modified functions
nutils.pas, handle_staticfield_access:
  * adjust searchsym_in_class call
pexpr.pas, handle_factor_typenode, postfixoperators, factor:
  * adjust searchsym_in_helper and searchsym_in_class calls
pinline.pas, new_function:
  * adjust searchsym_in_class call
scanner.pas, try_consume_nestedsym:
  * adjust searchsym_in_class call
fmodule.pas, tmodule:
  + add genericdummysyms field which is a TFPHashObjectList that contains TFPObjectList instances per generic dummy that in turn contains tgenericdummysyms instances
pgenutil.pas:
  + add function split_generic_name to split a generic name into non-generic name and count value of type parameters
  + add function resolve_generic_dummysym which tries to use the new genericdummysyms field to find the real symbol of a dummy sym
  * generate_specialization: adjust searchsym_in_class call
  * specialization_init/specialization_done: save/restore genericdummysyms of module
symdef.pas, tdefawaresymtablestack:
  + add new intermediate method pushcommon which is used by both push and pushafter
  + add new intermediate method remove_helpers_and_generics (which calls remove_generics and remove_helpers if necessary)
  * rename removehelpers to remove_helpers
  * rename addhelpers to add_helpers_and_generics and extend it to correctly fill current_module.genericdummysyms
  * call remove_helpers_and_generics from pop instead of remove_helpers
ptype.pas, single_type, read_named_type.expr_type, read_named_type:
  * try to resolve symbols with sp_generic_dummy with resolve_generic_dummysym

+ added test

git-svn-id: trunk@25519 -
2013-09-18 14:28:46 +00:00
svenbarth
fbceb574eb Fix for Mantis #25041 . Correctly set CurrentThreadVar for those tthread.inc incarnations that don't use the default ThreadProc in classes.inc (this should be changed in the future though...). In addition to Unix systems as described by the bug report this also involved BeOS and Netware LibC.
+ added test

git-svn-id: trunk@25511 -
2013-09-17 18:02:12 +00:00
svenbarth
900afaddea This test was clearly intended differently...
tests/webtbs/tw10477.pp:
  + add { %NORUN } (only tests compilation)
  * change use of unit "uthlp" to "uw10477"

git-svn-id: trunk@25510 -
2013-09-17 17:50:09 +00:00
svenbarth
2da06b004e Added test for Mantis #24458 which was fixed in revision 24628.
git-svn-id: trunk@25509 -
2013-09-17 14:20:23 +00:00
paul
5aa919c2a8 compiler: have unit interface symtable in stack while parsing implementation uses list (fixes issue #10477)
git-svn-id: trunk@25505 -
2013-09-17 08:53:37 +00:00
nickysn
4d369654e0 * fixed test cg/taddr2.pp for i8086 medium memory model
git-svn-id: trunk@25504 -
2013-09-17 01:06:06 +00:00
paul
0d8ad2a932 compiler: don't treat TRUE and FALSE as keywords. They are predefined constants from this moment. This change is compatible with other pascal compilers. Fixes issue #0025030
git-svn-id: trunk@25497 -
2013-09-16 09:11:17 +00:00
paul
99dadf2998 compiler: allow comparative operators to have result other than Boolean. Reasons:
1. It allows to use comparative operators in some unusual cases (issue #25004).
2. Regular type checking does not allow to use other than Boolean types in IF expressions anyway.
3. Delphi compatibility (although Delphi documentation states otherwise).

git-svn-id: trunk@25494 -
2013-09-16 05:10:31 +00:00
paul
93f1ba4493 compiler: don't allow to access an enum members through the enum member. It should be only possible throught the enum type name. Fixes issue #0025029
git-svn-id: trunk@25493 -
2013-09-16 02:48:52 +00:00
svenbarth
08543ddeba Fix for Mantis #23899 . Allow to overwrite TStringList.ExchangeItems if necessary.
rtl/objpas/classes/classesh.inc, TStringList:
  * rename the private ExchangeItems to ExchangeItemsInt and allow inlining
  + add a protected virtual ExchangeItems
rtl/objpas/classes/stringl.inc, TStringList:
  * Exchange: call ExchangeItemsInt
  + let default implementation of ExchangeItems simply call ExchangeItemsInt
  * QuickSort: call ExchangeItemsInt directly if there is no override otherwise call ExchangeItems

+ added test

git-svn-id: trunk@25480 -
2013-09-13 14:17:01 +00:00
paul
038b7746fb compiler: implement preprocessor expressions (fixes mantis #0010671)
- move operator_levels to topens.pas - it is used from 2 units now
  - implement pexpr like sub_expr for preprocessor expressions
  - implement +,-,*,/ expressions for the moment
  * move OR, AND, IN implemenetation to the new logic

git-svn-id: trunk@25465 -
2013-09-12 08:35:24 +00:00
paul
0eb4244a67 compiler: implement compile-time expression with float numbers (issue #0010670), better handling of integer expressions too
git-svn-id: trunk@25461 -
2013-09-12 01:59:26 +00:00
nickysn
5a42a8d707 + added an i8086 test tfarcal1.pp, which tests calling a far procedure from within inline asm code
git-svn-id: trunk@25435 -
2013-09-08 13:43:52 +00:00
Jonas Maebe
cde2d1b8ee o merged cpstrrtl branch (includes unicode branch). In general, this adds
support for arbitrarily encoded ansistrings to many routines related to
    file system access (and some others).
    
  WARNING: while the parameters of many routines have been changed from
    "ansistring" to "rawbytestring" to avoid data loss due to conversions,
    this is not a panacea. If you pass a string concatenation to such a
    parameter and not all strings in this concatenation have the same
    code page, all strings and the result will be converted to
    DefaultSystemCodePage (= ansi code page by default). In particular,
    concatenating e.g. an Utf8String with a constant string and passing
    the result to a RawByteString parameter will convert the result into
    the DefaultSystemCodePage (unless the source code is compiler with
    {$modeswitch systemcodepage} or {$mode delphiunicode} *and* the ansi
    code page on the system you are compiling *on* happens to be UTF-8)
    
    You can define and use alternative routines that explicitly accept
    Utf8String parameters to avoid this pitfall. Internally, all of these
    routines ensure that they never trigger this condition and ensure that
    not unnecessary/unwanted code page conversions occur.

  + DefaultFileSystemCodePage variable that holds the code page used for
    communicating with the OS single byte file system APIs, and for the
    strings returned by those same APIs. Initialized with
   o the result of GetACP in the system unit of Windows platforms, except for
     WinCE which uses UTF-8 since its file system OS API calls already use
     the UTF-16 versions
   o CP_UTF8 on Unix platforms with FPCRTL_FILESYSTEM_UTF8 defined, and with
     DefaultSystemCodePage on other Unix platforms
   o DefaultSystemCodePage on Java/Android JVM targets
  + DefaultRTLFileSystemCodePage variable that holds the code page used to
    encode strings returned by RTL routines that return filenames obtained
    from OS API calls. By default the same as DefaultFileSystemCodePage on
    all platforms. Separate from DefaultFileSystemCodePage for clarity on
    platforms that may use either utf-16 or single byte OS API calls to
    send/receive file names (such as most Windows platforms)
  + new scpFileSystemSingleByte enum that can be passed to
    GetStandardCodePage() to get the default code page for OS single byte file
    system APIs, with implementations for Unix and Windows
  + SetMultiByteFileSystemCodePage() procedure to override the value of
    DefaultFileSystemCodePage
  + ToSingleByteFileSystemEncodedFileName() function to convert a string to to
    DefaultFileSystemCodePage (does *not* take care of OS-specific quirks like
    Darwin always returning file names in decomposed UTF-8)
  + support for CP_OEMCP
  * textrec/filerec now store the filename by default using widechar. It is
    possible to switch back to ansichars using the FPC_ANSI_TEXTFILEREC define.
    In that case, from now on the filename will always be stored in
    DefaultFileSystemEncoding
  * fixed potential buffer overflows and non-null-terminated file names in
    textrec/filerec

  * when concatenating ansistrings, do not map CP_NONE (rawbytestring) to
    CP_ACP (defaultsystemcodepage), because if all input strings have the
    same code page then the result should also have that code page if it's
    assigned to a rawbytestring rather than getting defaultsystemcodepage
  * do not consider empty strings to determine the code page of the result
    in fpc_AnsiStr_Concat_multi(), because that will cause a different
    result than when using a sequence of fpc_AnsiStr_Concat() calls (it
    ignores empty strings to determine the result code page) and it's also
    slower

  * do not consider the run time code page of the destination string in
    fpc_AnsiStr_Concat(_multi)() because Delphi does not do so either. This
    was introduced in r19118, probably to hide another bug + test
  * never change the code page of a non-empty string when calling setlength on
    it

  * handle the fact that GetEnvironmentStringsA returns the environment in the
    OEM instead of in the Ansi code page (mantis #22524, #15233)
  * don't truncate environment variable strings in GetEnvironmentString(),
    its result is now ansistring/unicodestring depending on whether the
    RTL was compiled with FPC_RTL_UNICODE

  * unix:
   o made the ansistring parameters of the fp*() file system routine overloads
     constant, changed them to rawbytestring and added
     DefaultFileSystemCodePage conversions
   o unicodestring support for POpen(), and DefaultFileSystemCodePage support
     for POpen(RawByteString)

  + DefaultFileSystemCodePage support for dynlibs unit

  + rawbytestring/unicodestring overloads for:
   o system: fexpand, lowercase, uppercase, getdir, mkdir, chdir, rmdir,
     assign, erase, rename
   o objpas: AssignFile, 
   o sysutils: FileCreate, FileOpen, FileExists, DirectoryExists, FileSetDate,
     FileGetAttr, FileSetAttr, DeleteFile, RenameFile, FileSearch, ExeSearch,
     FindFirst, FindNext, FindClose, FileIsReadOnly, GetCurrentDir,
     SetCurrentDir, ChangeFileExt, ExtractFilePath, ExtractFileDrive,
     ExtractFileName, ExtractFileExt, ExtractFileDir, ExtractShortPathName,
     ExpandFileName, ExpandFileNameCase, ExpandUNCFileName,
     ExtractRelativepath, IncludeTrailingPathDelimiter,
     IncludeTrailingBackslash, ExcludeTrailingBackslash,
     ExcludeTrailingPathDelimiter, IncludeLeadingPathDelimiter,
     ExcludeLeadingPathDelimiter, IsPathDelimiter, DoDirSeparators,
     SetDirSeparators, GetDirs, ConcatPaths, GetEnvironmentVariable

    -- the default string type used by FindFirst/Next depends on whether the
      RTL was compiled with FPC_RTL_UNICODE. To force the RawByteString
      version pass a TRawByteSearchRec, for the UnicodeString version pass
      a TUnicodeSearchRec.

  + paramstr(longint):unicodestring available for {$modeswitch unicodestrings}

  + pwidechar versions in sysutils of strecopy, strend, strcat, strcomp,
    strlcomp, stricomp, strlcat, strrscan,strlower, strupper, strlicomp,
    strpos, WideStrAlloc, StrBufSize, StrDispose + tests
    

git-svn-id: trunk@25432 -
2013-09-06 11:04:32 +00:00
Jonas Maebe
de56f909d5 * synchronized with trunk up to and including r25430
git-svn-id: branches/cpstrrtl@25431 -
2013-09-06 10:09:26 +00:00
Jonas Maebe
f539e9158a * small change to r24997: also use the {$modeswitch unicodestrings} state to
determine whether (wide)char->pchar will be preferred over (wide)char ->
    p(wide)char or not (always convert to pchar if mode switch is not active,
    otherwise always to pwidechar). Delphi-compatible + consistent with the
    behaviour added for constant strings in that revision + tests

git-svn-id: branches/cpstrrtl@25430 -
2013-09-06 08:02:59 +00:00
Jonas Maebe
3c3ad705f1 * changed fpc_(u)char_to_shortstr() from a procedure into a function, like
the other fpc_(u)char_to_*str() routines (exception dates back to the
    time calls to these routines were still inserted "manually" in the
    compiler). Fixes the compilation of "shortstr:=widecharconstant" after
    r23613 and simplifies other code calling this helper + test

git-svn-id: branches/cpstrrtl@25428 -
2013-09-06 08:02:46 +00:00
paul
3f2e62874b compiler: handle unit, namespace and class/record/object prefixes before identifiers while parsing {$IF ...} expressions (fixes mantis #0020996)
git-svn-id: trunk@25422 -
2013-09-05 07:05:19 +00:00
paul
1b81afcd42 compiler: allow to hide parent function identifier inside them (by a nested function with the same name or by a local variable). Fixes mantis #0024129.
git-svn-id: trunk@25420 -
2013-09-05 01:10:04 +00:00
paul
115ddf4364 compiler: modernize exception class parse:
- use specially implemented type search routine in case of declaration with colon (on E: Exception do)
  - parse nested types in case of declaration without colon (on Exception do)
  + test

fixes issue #0022225

git-svn-id: trunk@25412 -
2013-09-04 14:09:09 +00:00
svenbarth
d03507671d Fix for Mantis #24953.
pgenutil.pas, parse_generic_parameters:
  * set the typesym of the newly created def so that inline specializations in pexpr.pas, sub_expr can check it correctly

git-svn-id: trunk@25410 -
2013-09-04 12:56:08 +00:00
Jonas Maebe
1a78ec1f11 * workaround for bug in Apple's assembler regarding movq/vmovq and integer
registers

git-svn-id: trunk@25396 -
2013-09-02 14:39:26 +00:00
Jonas Maebe
fcaad5baf2 * perform -CTlowercaseprocstart conversion it tprocsym.create rather than
when building the mangled name, because the latter can also be performed
    when compiler another unit (and therefore if that other unit's setting
    is different from that of the original unit, a wrong mangled name was
    generated) + test for this case

git-svn-id: trunk@25388 -
2013-08-29 22:43:06 +00:00
Jonas Maebe
a14ceba791 + -CTinitlocals switch for the JVM that initialises all local variables
that may trigger JVM bytecode verification errors if they are used
    before they are initialised (this includes passing them as a "var"
    parameter) + test
  * sorted -CT parameters alphabetically and alligned them

git-svn-id: trunk@25387 -
2013-08-29 22:21:23 +00:00
Jonas Maebe
6013606a97 + -CTlowercaseprocstart switch to lowercase the first character of routines
so that code written according to Delphi coding standards can be compiled
    into JVM bytecode with routine names conforming to JVM coding standards

git-svn-id: trunk@25385 -
2013-08-29 22:21:15 +00:00
masta
ff95d42216 Fix ShiftShift2Shift 1 ARM-peephole optimizer
The previous code deleted the newly inserted instruction instead of the
existing one, which obviously broke code.

Assembly:
  mov r0, r0, lsr #23
  mov r0, r0, lsr #23

transformed into:
  mov r0, r0, lsr #23

expected was:
  mov r0, #0

The problem only shows up in the very unlikely case of two LSR/ASR or
two LSL following on each other and having a total shift of more than 31
bits.

This fixes test/opt/tarmshift.pp

I've also removed the {%norun} directive from tarmshift.pp as this test
does only make sense when it also runs.

git-svn-id: trunk@25374 -
2013-08-26 17:41:54 +00:00
nickysn
4f0c160110 * Makefile regenerated with latest fpcmake from trunk, which has i8086-msdos support
git-svn-id: trunk@25353 -
2013-08-23 16:51:31 +00:00
Jonas Maebe
d5c86bcfef * created combined (lipo'd) armv6 and armv7 versions
git-svn-id: trunk@25322 -
2013-08-21 22:28:17 +00:00
paul
4c23d2281a rtl: fpwidestring:
- retry to load currentMap if it is not assigned
  - add more tests for fpwidestring manager

git-svn-id: trunk@25317 -
2013-08-21 06:56:26 +00:00
paul
2cb8125bfc tests: fix test to use fpwidestring manager (by Inoussa, mantis #0024890)
git-svn-id: trunk@25316 -
2013-08-21 06:35:25 +00:00
paul
ec7be0d231 test: add more fpwidestring tests by Inoussa
git-svn-id: trunk@25311 -
2013-08-20 02:52:07 +00:00
Jonas Maebe
af3f12f60c * rawbytestring/unicodestring versions of findfirst/findnext/findclose
o these routines are now generic wrappers in filutil.inc, and call
     the platform-dependent internalfindfirst/next/close routines
   o on unix, the fnmatch routine got proper support for UTF-8 matching
     (e.g., it won't match a partial UTF-8 code point to a "?" wildcard)
   o for NativeNT, a similar (untested) UTF-16 version has been added
  + test for the above
  * rawbytestring/unicodestring versions of fileage

git-svn-id: branches/cpstrrtl@25302 -
2013-08-19 22:04:25 +00:00
Jonas Maebe
26b7f5a36c * ensure that fexpand(ansistring) never converts its argument to a code page
other than DefaultFileSystemCodePage, so that it can work with strings
    holding any encoding
  + test for fexpand(ansistring) with UTF-8 strings while DefaultSystemCodePage
    is set to CP_ASCII

git-svn-id: branches/cpstrrtl@25300 -
2013-08-19 22:04:15 +00:00
Jonas Maebe
b115231ea4 * never change the code page of a non-empty string when calling setlength on
it

git-svn-id: branches/cpstrrtl@25298 -
2013-08-19 22:04:07 +00:00
paul
7ac3647ff2 rtl: apply patch of Inoussa with Incremental Implementation of the Unicode Collation Algorithm (mantis #0024873)
git-svn-id: trunk@25296 -
2013-08-19 16:35:12 +00:00
paul
17ef986b17 compiler: don't treat methods without self node (static class methods, class contructors, destructors, operators) as method pointers, fix comparison of procdef and procvardef to allow assignment of a static class method to a regular procedural variable (issue #24486)
git-svn-id: trunk@25284 -
2013-08-18 17:29:23 +00:00