Commit Graph

390 Commits

Author SHA1 Message Date
Jonas Maebe
f50dec5202 * don't allow implicit type conversions from pointers to c-style blocks in
Delphi mode, because unlike for procvars we need full type information
    to be able to generate a block (mantis #30022)

git-svn-id: trunk@33529 -
2016-04-17 19:07:26 +00:00
florian
ee89e99189 * correctly write an error if one tries to implement a method introduced in a generic in a specialization of the generic, resolves issue #23169
git-svn-id: trunk@31241 -
2015-07-28 21:16:47 +00:00
Jonas Maebe
7866bae173 * don't crash when trying to access the call_self_node in case it doesn't
exit, but instead give an error (bug introduced in r30950, mantis #28338)

git-svn-id: trunk@31150 -
2015-06-23 21:23:29 +00:00
Tomas Hajny
b2475353f4 * test programs previously having extension .pas renamed to .pp so that they are found during testsuite runs
git-svn-id: trunk@30024 -
2015-02-27 13:03:13 +00:00
Jonas Maebe
5b39b20a3d * fixed duplicate field names in variant record parts
git-svn-id: trunk@28822 -
2014-10-15 10:08:43 +00:00
Jonas Maebe
f6f304e0ca * check for duplicate identifiers when inserting union symtables into the
parent record symtable (mantis #26704)

git-svn-id: trunk@28820 -
2014-10-14 20:30:14 +00:00
svenbarth
f1bfb398e4 Fix for Mantis #26456.
symtable.pas, searchsym_in_helper:
  * check whether extendeddef is assigned as this function is called when parsing the extended type and it was not found (the second pass is to display a more accurate error message and was added some weeks ago)

+ added test

git-svn-id: trunk@28242 -
2014-07-20 13:40:01 +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
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
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
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
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
svenbarth
c5050ea645 Forgot to commit test mentioned in last commit
git-svn-id: trunk@27465 -
2014-04-04 16:10:08 +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
florian
e755a19c42 * win64 ignores -Cg
git-svn-id: trunk@27040 -
2014-03-09 10:51:42 +00:00
florian
68f1a51164 * set PIC defines earlier, resolve #25788
git-svn-id: trunk@26924 -
2014-03-02 15:35:08 +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
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
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
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
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
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
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
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
b6bfa864d4 Disallow the usage of the inline assembler inside generics, because there are currently two problems:
1. At least on x86 the assembler reader initializes the parameter location informations which results in InternalError 200301231
2. Assembler tokens are not stored in the token stream and thus won't be reproduced during specialization

x86/rax86int.pas, tx86intreader.Assemble:
  * check for "parse_generic" before calling generate_parameter_info
pstatmnt.pas, assembler_block & statement:
  * generate an error message if an asm statement should be parsed inside a generic

+ added test

git-svn-id: trunk@24892 -
2013-06-13 19:42:49 +00:00
florian
0968d095ed * convert function like used new into a appropriate nodes only in pass_1 so proper error checking can be carried out, resolves #24495
git-svn-id: trunk@24667 -
2013-05-31 14:55:49 +00:00
Jonas Maebe
11d5d4f79d * check range of enums and booleans in typed constant expressions when
using the asmlist generator (mantis #24428)

git-svn-id: trunk@24495 -
2013-05-14 12:05:00 +00:00
Jonas Maebe
3a03586ca9 * give an error when declaring a class as conforming to a forward-declared
interface: the compiler does not/cannot check whether the class
    implements all required methods in that case, and it moreover leads to
    crashes (mantis #24184). Older versions of Delphi did allow this (and
    don't check whether the interface methods are implemented either), but
    that's simply a (similar) bug in Delphi that has been fixed in XE at
    least
  * fixed compilation of webtbs/tw2727 after this fix

git-svn-id: trunk@24177 -
2013-04-07 12:18:31 +00:00
Jonas Maebe
1244cdff70 * don't treat bitpacked arrays of subranges of char that can be represented
using less than 8 bits per element the same as regular char arrays as far
    as automatic type conversions are concerned (they have to be explicitly
    packed/unpacked) (mantis #24013)

git-svn-id: trunk@23739 -
2013-03-09 10:37:30 +00:00
svenbarth
359a228085 Fix one problem type of Mantis #23546. A record must not contain a static array that uses itself as an element type (in can contain a dynamic array however) otherwise an infinite loop is encountered when checking whether the record needs special init/final code.
pdecvar.pas, read_record_fields:
  * if the def of the field is a static array then use the array's element def (the final element def if it is a multi dimensional array) to check for whether this is the current record type

+ added tests

git-svn-id: trunk@23352 -
2013-01-09 14:07:01 +00:00
svenbarth
29bd000a4a Fix for Mantis #23571.
ptype.pas, single_type:
  * if using a message that expects a parameter, provide that parameter...

+ added tests

git-svn-id: trunk@23349 -
2013-01-09 11:28:17 +00:00
svenbarth
27f5e4f582 Fix for Mantis #23547. Basically we now fail with nicer error messages.
pgenutil.pas:
  generate_specialization:
    + instead of giving an internal error if "symname" is empty and "tt" is "nil" we now do an error recovery by parsing the specialization parameters and returning an errordef (this happens if the "generic" type before the "<" is not found)
    * handle "<>" specially by giving an approbiate error message (both when doing a recovery/parsing a generic and during normal specialization)
  parse_generic_parameters:
    * set the "block_type" to "bt_type" to be on the safe side
    * don't continue with inspecting the def (especially hard typecasting) if the found def is not an "objectdef"

Added tests.

git-svn-id: trunk@23344 -
2013-01-08 09:05:11 +00:00
Jonas Maebe
439741178d * test has to fail: add { %fail } and moved to webtbf
git-svn-id: trunk@22803 -
2012-10-21 17:28:20 +00:00
Jonas Maebe
5ea03973d3 * reject assignments to vecn[rangen] (mantis #22941)
git-svn-id: trunk@22434 -
2012-09-21 22:42:30 +00:00
Jonas Maebe
17c495595c * made variable public so got warning gets triggered
git-svn-id: trunk@22244 -
2012-08-25 21:32:38 +00:00
Jonas Maebe
4d0e4e1b56 * treat "[var + rip]" in intel assembler mode as addr_pic_no_got on x86-64
(mantis #22665)
  + support "[var wrt ..gotpcrel]" nasm/yasm syntax in intel assembler mode
    for GOT-relative accesses on x86-64, + give an error when trying to do
    this on win64 (it doesn't have a GOT)
  * moved code that give a warning when using GOT-relative accesses to
    static data on x86-64 from the AT&T reader to rax86 so it's also
    active for the Intel assembler reader
  + added warning when not using GOT-relative accesses (but plain
    RIP-relative instead) to global data on non-Win64 x86-64

git-svn-id: trunk@22243 -
2012-08-25 15:12:49 +00:00
Jonas Maebe
288d1ec74a * support referencing "result" in nostackframe pure assembler routines if
the result location is a simple location (a single register/reference)
    (mantis #22490)
  * print an error when accessing "result" in a nostack pure assembler routine
    if the result location is not simple

git-svn-id: trunk@22166 -
2012-08-21 19:51:40 +00:00
Jonas Maebe
aad3ce960a * give an error when trying to give a parameter of a non-simple type a
default value (mantis #22343)
  * give an error when specifying an invalid default value (e.g. a
    floating point number for a longint parameter)

git-svn-id: trunk@22021 -
2012-08-06 20:13:20 +00:00
Jonas Maebe
b1d00b66ac * fixed internalerror after invalid type node in subscript node
(mantis #22395)

git-svn-id: trunk@21917 -
2012-07-15 18:17:29 +00:00
svenbarth
8c95ea039f Fix for Mantis #22219
ptype.pas:
  * read_named_type: 
      after reading the type we're pointing to we need to make sure that
      we didn't get a generic dummy symbol; this can happen when parsing
      a pointer declaration as the type in a constant or variable 
      declaration
  * resolve_forward_types:
      when resolving forward types we need to make sure that we weren't
      given a generic dummy to which no non-generic definition was
      given (possible in Delphi mode); for non-Delphi modes we can not
      rely on the generic dummy flag as the typedef of the symbol will
      the generic def
+ added test from the bug reports as well as three additional ones to
  make sure that nothing breaks regarding to forward pointer 
  declarations
      

git-svn-id: trunk@21687 -
2012-06-24 10:08:17 +00:00
Jonas Maebe
50659b7e7f * give an error if a routine definition defines default values for
parameters that do not appear in forward/interface definitions
    (mantis #19434)
  * added test for #17136 already works

git-svn-id: trunk@21524 -
2012-06-07 22:36:39 +00:00
svenbarth
bf9cb352b3 ptype.pas, single_type: If the generic dummy type is used in mode Delphi then generate an error. This fixes Mantis #21363.
git-svn-id: trunk@21496 -
2012-06-06 13:15:18 +00:00
Jonas Maebe
f8cb3fbfef + old tests I forgot to commit
git-svn-id: trunk@21429 -
2012-05-29 09:01:55 +00:00
Jonas Maebe
5e6aaccca9 * removed spaces from empty line at start to prevent (unpatched) dbdigest
from crashing

git-svn-id: trunk@21150 -
2012-04-30 20:13:09 +00:00
sergei
c08ab0f745 * Re-raising exceptions must be allowed only in 'except' block itself, not in 'try' block of a nested try..except statement. Mantis #21873.
git-svn-id: trunk@21100 -
2012-04-28 15:59:34 +00:00
pierre
0c144e8bbc Test fix for bug report 21566
git-svn-id: trunk@20636 -
2012-03-26 15:50:09 +00:00
florian
0f9b8c8936 * don't throw an error if a non-generic is tried to be specialized, resolves #21238
git-svn-id: trunk@20607 -
2012-03-23 20:32:40 +00:00
pierre
f8dcacd69b *Explicitly disable range check to trigger the hint that is tested and no range check generated warning
git-svn-id: trunk@20601 -
2012-03-23 15:16:29 +00:00
florian
fbc519faeb * don't allow multiple deprecated messages, resolves #21466
git-svn-id: trunk@20515 -
2012-03-12 21:39:43 +00:00