Commit Graph

351 Commits

Author SHA1 Message Date
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
Jonas Maebe
5c56b1bc3d * give an error when trying to take address of a global label declared in
another scope instead of crashing (mantis #21078)

git-svn-id: trunk@20508 -
2012-03-10 23:24:43 +00:00
Jonas Maebe
bacdd8be81 * don't ever mark the function result as vs_initialised, also not when
it is passed as a hidden parameter (mantis #20907)

git-svn-id: trunk@20373 -
2012-02-17 16:25:50 +00:00
Jonas Maebe
e5c097a6e2 * mark nodes that have been created by transforming a read-accessor of
of a property with nf_no_lvalue flag, and check that such nodes are
    never used in direct assignments (fixes mantis #21087 and a couple of
    other cases of invalid assignments to properties)

git-svn-id: trunk@20140 -
2012-01-21 19:09:30 +00:00
paul
889196f1c8 compiler: don't allow to execute instance methods, use instance fields and properties from the nested class (bug #0020721)
git-svn-id: trunk@19681 -
2011-11-25 08:33:24 +00:00
Jonas Maebe
84bf45f0e2 * give an error when trying to call an interface/protocol/category method
using the type name of the interface/protcol/category (they are not
    entities themselves on which you can invoke those methods,
    mantis #20661)

git-svn-id: trunk@19651 -
2011-11-18 22:33:33 +00:00
paul
b8589d98cc compiler: Don't allow duplicate property/procedure identifiers inside object declaration. The code which allowed this for delphi mode was initially written based on invalid test from mantis #0009176. Fixes bug #0020580.
git-svn-id: trunk@19564 -
2011-10-31 05:35:40 +00:00
florian
df75368d0b --- Merging r19281 into '.':
U    compiler\pdecsub.pas
U    compiler\symdef.pas
U    compiler\pdecobj.pas
U    compiler\htypechk.pas
U    compiler\ncal.pas
U    compiler\symtable.pas
--- Recording mergeinfo for merge of r19281 into '.':
 U   .
--- Merging r19282 into '.':
A    tests\webtbf\tw19975.pp
--- Recording mergeinfo for merge of r19282 into '.':
 G   .

git-svn-id: trunk@19343 -
2011-10-03 20:43:19 +00:00
Jonas Maebe
d714eeb84b * give a proper error when a type identifier is missing in a
class operator declaration (mantis #19213)

git-svn-id: trunk@19226 -
2011-09-25 14:38:06 +00:00
Jonas Maebe
dff5ac3b0a * don't allow passing a field of a record that's not an lvalue as
var-parameter, nor allowing taking its address (mantis #20095)

git-svn-id: trunk@19199 -
2011-09-23 21:21:49 +00:00
paul
1e3239915f merge r19074 from cpstrnew branch by paul:
tests: fix 2 tests. $FFFF chars are now valid characters for the compiler

git-svn-id: trunk@19126 -
2011-09-17 14:23:58 +00:00
sergei
bbae63a4f2 * Check that a single interface is only delegated to a single property within a class.
* Disallow simultaneous use of method resolution and delegation for the same interface. An interface with method resolution must be implemented directly. This is Delphi compatible and resolves #18058.

git-svn-id: trunk@18179 -
2011-08-12 14:42:30 +00:00
sergei
25bf0012f2 * When the interface method mapping is present, being unable to find the implementing procedure using the mapped name is a error condition. No attempt to find implementing procedure using symbol name should be made in this case. Resolves #19591.
git-svn-id: trunk@18166 -
2011-08-10 21:33:39 +00:00
florian
93e53e1990 * allow also smaller values for code alignment parameters than the current one, resolves #19463
* limit code alignment parameters to power of 2 up to 256
* give an error for an invalid code alignment directive

git-svn-id: trunk@17659 -
2011-06-04 20:56:15 +00:00
sergei
08ff5ff051 * x86 Intel assembler reader: disallow more than one register name per register operand, resolves #15672.
git-svn-id: trunk@17507 -
2011-05-19 20:00:15 +00:00
paul
e77a9051c8 compiler: treat record/class fields types as bt_var_type block in delphi mode - as result they don't create a forward declaration for ^Type. Leave it as is for other modes because in other case it break the compilation of RTL and packages (fixes issue #0018620)
git-svn-id: trunk@16832 -
2011-01-29 07:32:10 +00:00
Jonas Maebe
d76ddcabe6 * don't give an internalerror when trying to explicitly apply an invalid
typecast to an array-of-const (mantis #18267)

git-svn-id: trunk@16749 -
2011-01-11 15:47:56 +00:00
paul
3ceee496d6 tests: fail test tw9509: disable type section in generic interfaces
git-svn-id: trunk@16680 -
2011-01-02 10:51:51 +00:00
Jonas Maebe
3a089cea10 * give an error when trying to let an objcclass conform to a
forward-declared objcprotocol (mantis #17341)

git-svn-id: trunk@16523 -
2010-12-08 22:17:24 +00:00
florian
7d1627e9ca * patch by Aleksa Todorovic to handle access to types inside generics correctly
when they are used as class variables, resolves #18096

git-svn-id: trunk@16474 -
2010-11-29 09:37:09 +00:00
Jonas Maebe
14b95b3b9b * always force range checking for the upper and lower bounds of for-loops if
they are constants (instead of only on 32 bit systems), and always use the
    actual upper/lower bound of the loop variable instead of hardcoding the
    bounds of longint (mantis #17646)

git-svn-id: trunk@16213 -
2010-10-24 14:55:48 +00:00
Jonas Maebe
db8a67747d * give an error when trying to use (bit)sizeof on a type that is not yet
resolved by the compiler (mantis #14354)

git-svn-id: trunk@16112 -
2010-10-08 17:42:53 +00:00
Jonas Maebe
bd0567563c * don't crash in {$x-} mode if a call cannot be resolved due to an error
in the expression (mantis #17455)

git-svn-id: trunk@16061 -
2010-09-29 12:11:22 +00:00
Jonas Maebe
9273856e84 * disallow pusha*/popa* for x86_64 (mantis #14862)
* disallow pushfd/popfd for x86_64 (mantis #14862)
  * fixed assembling popfq with the internal assembler (it needs a rex.w
    prefisx, while pushfq doesn't)
  * changed the default opcode size of pushf/popf/pusha/popa in
    {$asmmode intel} from "native size" to 16 bit (compatible with Intel
    manuals and Kylix; in AT&T mode, the default size for those operations
    remains the native one)
  * changed pushf/popf in rtl/i386/* into pushfd/popfd because of the
    previous change

git-svn-id: trunk@15546 -
2010-07-10 16:22:46 +00:00
Jonas Maebe
cddb2ffcae * give a compile-time error when trying to define a short/ansistring typed constant
containing unicode strings instead of producing unpredictable behaviour
    (mantis #16219)

git-svn-id: trunk@15240 -
2010-05-08 10:57:39 +00:00
Jonas Maebe
72758864e4 * only allow field names in record/object typed constant declarations (mantis #16234)
* improved error recovery after encountering invalid field name in record/object typed constant
    declaration

git-svn-id: trunk@15150 -
2010-04-18 07:55:42 +00:00
Jonas Maebe
35941dcae9 * added missing -CO option
git-svn-id: trunk@15056 -
2010-03-25 09:10:41 +00:00
Jonas Maebe
653974f679 * also give a "potential range error" hint with -CO in case the sizes
match but the source range does not fit in the dest range
    (related to mantis #16023)
  * don't give a "potential range error" when converting between
    s80real and sc80real, since even though the size may differ,
    the represented range does not

git-svn-id: trunk@15044 -
2010-03-24 21:21:19 +00:00
Jonas Maebe
6db635210a * don't give an internalerror when passing a constant string to an
openstring parameter (mantis #16022)

git-svn-id: trunk@15030 -
2010-03-21 14:51:12 +00:00
Jonas Maebe
0cfc6e1cac + support for "univ" in macpas mode: a parameter modifier that allows
passing any value to that parameter which has the same size as the
    parameter (it basically acts as if there is an explicit type conversion
    to the parameter type around the value at the caller side). If a procvar
    has an univ parameter, all procvars whose corresponding parameter
    has the same size as that univ parameter are similarly compatible.

    This transparent compatibility can however cause crashes in case of
    of the procvars when one of the types is passed on the stack and the
    other isn't (because then the called routine will a) load the parameter
    from a wrong location and b) pop the wrong amount off of the stack at
    then end). Therefore FPC will warn in most cases where this can happen.
    (mantis #15777)

git-svn-id: trunk@15010 -
2010-03-13 22:13:20 +00:00
Jonas Maebe
88f5addd1c * do not typecheck statements before checking whether they are valid,
because the associated simplifications can turn invalid statements
    into valid statements (based on patch by Aleksa Todorovic, mantis
    #15594)

git-svn-id: trunk@14998 -
2010-03-09 21:13:22 +00:00
Jonas Maebe
6b0a0c149b * don't perform a range check in Delphi mode when passing a cardinal as
vtInteger to an array-of-const parameter (mantis #15727)

git-svn-id: trunk@14882 -
2010-02-10 16:35:37 +00:00
paul
00624ad7a3 tests: remove {$STATIC ON} directive since it is not available anymore
git-svn-id: trunk@14580 -
2010-01-08 18:01:28 +00:00
paul
8166148a37 compiler: 'static' keyword:
- deprecate -St compiler switch
  - remove $STATIC directive
  - unconditionally enable 'static' keyword usage
  - adopt tests, samplecfg, fpc.cft, error messages

git-svn-id: trunk@14569 -
2010-01-07 19:02:09 +00:00
Jonas Maebe
dd94f5cf2b * no longer allow typed files of reference counted data (mantis #15447)
git-svn-id: trunk@14509 -
2010-01-01 14:56:33 +00:00
Jonas Maebe
e254d607d6 * support arrayconstructornodes of procvars (mantis #15391)
git-svn-id: trunk@14468 -
2009-12-23 20:11:35 +00:00
Jonas Maebe
0247d0c2ee * use calling convention that is not the default on any platform
git-svn-id: trunk@14399 -
2009-12-11 09:36:11 +00:00
Jonas Maebe
164db72f07 * implements getter must used target's default calling convention, because
it's called indirectly via an RTL helper that expects this (mantis #15303)

git-svn-id: trunk@14397 -
2009-12-10 21:47:47 +00:00
Jonas Maebe
b521f80b13 * give a proper error when a rangen appears in a vecn that's not an
array parameter (mantis #15287)

git-svn-id: trunk@14368 -
2009-12-08 18:47:24 +00:00
Jonas Maebe
b9b95a8f73 * fixed compiler crash when putting non-constant string in a set expression
(mantis #15288)

git-svn-id: trunk@14367 -
2009-12-08 17:15:31 +00:00