Commit Graph

313 Commits

Author SHA1 Message Date
paul
74cc1e0bab compiler: allow 'as' for dispinterface, allow comparisons of dispinterface and pointers (issue #0015530, issue #0015529)
git-svn-id: trunk@14663 -
2010-01-16 11:37:25 +00:00
florian
c1f3d8dcaa * unified names of system_*/systems_* sets
git-svn-id: trunk@14566 -
2010-01-07 18:16:20 +00:00
Jonas Maebe
b4c572483b * always call procvars inside varargs in TP/Delphi mode (mantis #15446)
git-svn-id: trunk@14527 -
2010-01-02 21:43:19 +00:00
florian
dab642986e * patch by Sergei Gorelkin, fixes several issues with implements, resolves #15209
git-svn-id: trunk@14466 -
2009-12-23 16:23:19 +00:00
Jonas Maebe
dd7e472fa4 * don't convert "cardinal div (cardinal-cardinal)" to longint after it
has been upcasted to int64, but convert it back to cardinal (mantis
    #15015)
  * put the "remove unnecessary 64 bit type conversions" code between
    {$ifndef cpu64bitalu} instead of {$ifndef cpu64bitaddr}

git-svn-id: trunk@14396 -
2009-12-10 21:08:31 +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
Jonas Maebe
d1538ab023 o added ARM VPFv2/VFPv3 support:
+ RTL support:
      o VFP exceptions are disabled by default on Darwin,
        because they cause kernel panics on iPhoneOS 2.2.1 at least
      o all denormals are truncated to 0 on Darwin, because disabling
        that also causes kernel panics on iPhoneOS 2.2.1 (probably
        because otherwise denormals can also cause exceptions)
    * set softfloat rounding mode correctly for non-wince/darwin/vfp
      targets
    + compiler support: only half the number of single precision
      registers is available due to limitations of the register
      allocator
    + added a number of comments about why the stackframe on ARM is
      set up the way it is by the compiler
    + added regtype and subregtype info to regsets, because they're
      also used for VFP registers (+ support in assembler reader)
    + various generic support routines for dealing with floating point
      values located in integer registers that have to be transferred to
      mm registers (needed for VFP)
    * renamed use_sse() to use_vectorfpu() and also use it for
      ARM/vfp support
    o only superficially tested for Linux (compiler compiled with -Cpvfpv6
      -Cfvfpv2 works on a Cortex-A8, no testsuite run performed -- at least
      the fpu exception handler still needs to be implemented), Darwin has
      been tested more thoroughly
  + added ARMv6 cpu type and made it default for Darwin/ARM
  + ARMv6+ implementations of atomic operations using ldrex/strex
  * don't use r9 on Darwin/ARM, as it's reserved under certain
    circumstances (don't know yet which ones)
  * changed C-test object files for ARM/Darwin to ARMv6 versions
  * check in assembler reader that regsets are not empty, because
    instructions with a regset operand have undefined behaviour in that
    case
  * fixed resultdef of tarmtypeconvnode.first_int_to_real in case of
    int64->single type conversion
  * fixed constant pool locations in case 64 bit constants are generated,
    and/or when vfp instructions with limited reach are present

  WARNING: when using VFP on an ARMv6 or later cpu, you *must* compile all
    code with -Cparmv6 (or higher), or you will get crashes. The reason is
    that storing/restoring multiple VFP registers must happen using
    different instructions on pre/post-ARMv6.

git-svn-id: trunk@14317 -
2009-12-03 22:46:30 +00:00
Jonas Maebe
559e284bd0 * merged r13762-14047 from trunk
git-svn-id: branches/objc@14048 -
2009-11-04 15:50:26 +00:00
Jonas Maebe
fffa66e2f9 * only allow implicit conversions from 0 to NIL in Delphi mode, rather than
from any ordinal constant, and give a warning for this one allowed
    conversion like Kylix does (mantis #14713)
  * this required calling simplify from typecheckpass in ttypeconvnode for
    cord_to_pointer, because this simplification prevents the type checking
    from happening (but the typecheck itself also does that simplification)

git-svn-id: trunk@13919 -
2009-10-22 19:49:08 +00:00
Jonas Maebe
a149674a75 Merged revisions 13458-13596 via svnmerge from
svn+ssh://jonas@svn.freepascal.org/FPC/svn/fpc/trunk

git-svn-id: branches/objc@13598 -
2009-08-25 19:47:36 +00:00
Jonas Maebe
106c0673c0 * allow passing records to C varargs (also allowed by C)
git-svn-id: trunk@13595 -
2009-08-25 19:04:34 +00:00
Jonas Maebe
2f7457f37e * set the fileinfo of typeconversions created using inserttypeconv*()
to that of the left node
  * same for a typeconversion inserted in the typecheck pass of
    taddrnode

git-svn-id: trunk@13579 -
2009-08-22 22:11:03 +00:00
Jonas Maebe
acdb0bbb3e * don't change current_filepos in pass_typecheck when not generating
errornodes (so the that the parser won't afterwards suddenly start
    creating nodes with this different fileinfo)

git-svn-id: trunk@13577 -
2009-08-22 20:21:56 +00:00
Jonas Maebe
a25e791ff8 * allow Objective-C classes/protocols in C varargs parameter lists
git-svn-id: branches/objc@13460 -
2009-07-26 16:00:33 +00:00
Jonas Maebe
335e159c11 Merged revisions 13351-13373,13376-13457 via svnmerge from
svn+ssh://jonas@svn.freepascal.org/FPC/svn/fpc/trunk

git-svn-id: branches/objc@13458 -
2009-07-26 14:31:50 +00:00
Jonas Maebe
754696d1f5 * enable converting procedure callnodes with only default parameters into
procvars in tp/delphi mode (mantis #11771)

git-svn-id: trunk@13400 -
2009-07-17 10:29:56 +00:00
Jonas Maebe
5a2ccfff52 --WARNING: start build process with FPC 2.2.4; won't work when
starting with a previous 2.3.1 or compiler built from the objc branch
  + added basic objcprotocol support (only for external protocols
    currently)
     o use in type declaration: "type xp = objcprotocol ... end;"
     o when defining a root class that implements it:
       "type yc = objcclass(xp) ... end" (note: no support yet
       for something like "objcclass(id,xp)" or so)
     o when defining a non-root class that implements a protocol:
       "type zc = objcclass(nsobject,xp) ... end"
     o includes support for "required" and "optional" sections
     o no support yet for the objcprotocol(<protocol>) expression
       that enables getting a class instance representing the
       protocol (e.g., for use with "conformsToProtocol:")
     o message names have to specified in protocol declarations,
       but if an objcclass implements a protocol, the message names do
       not have to be repeated (but if they are, they have to match;
       the same goes when overriding inherited methods)
  + allow specifying the external name of Objective-C classes and
    protocols, since classes and protocols can have the same name
    (and you cannot use the same Pascal identifier in such caseq)
  + added NSObject protocol, and make the NSObject class use it
  + added missing NSObject class methods that have the same name
    as instance methods (added "class" name prefix to avoid clashes)
  * fixed several cases where the compiler did not treat Objective-C
    classes/protocols the same as Object Pascal classes/interfaces
    (a.o., forward declarations, alignment, regvars, several type
     conversions, ...)
  * allow "override" directive in objcclass declarations, and print
    a hint if it's forgotten in an external declaration (because it
    doesn't really matter there, and may make automated header
    conversion harder than necessary) and an error if will be used in
    a non-external declaration (because it is not possible to start
    a new vmt entry-tree in Objective-C, you can only override parent
    methods)
  * reject objcclasses/protocols as parameters to typeof()
  * don't try to test VMT validity of objcclasses/protocols

git-svn-id: branches/objc@13375 -
2009-07-09 20:48:28 +00:00
Jonas Maebe
1f6ec379de * moved field definitions before method/property definitions (see mantis
#13971)

git-svn-id: trunk@13330 -
2009-06-27 11:27:31 +00:00
Jonas Maebe
66c14c8a88 * don't mark classes used in "is"- or "as"-expressions as potentially
instantiated (for wpo)
  * also replace vmt-entries for classes for which we don't have any
    information at all with FPC_ABSTRACTERROR (since that means they
    certainly are not instantiated), except for their published and
    virtual class methods
  * fixed check for published methods in wpo

git-svn-id: trunk@13219 -
2009-05-31 13:52:40 +00:00
Jonas Maebe
966ebbf157 * fixed missing reference counting in case a refcounted type was implicitly
type casted to a non-refcounted type, e.g. dynarray to pointer in Delphi
    mode (mantis #13820)

git-svn-id: trunk@13195 -
2009-05-25 19:41:14 +00:00
ivost
0438667eed * fixed bug #5800
* const s: string = icorbainterface; is possible now
* as operator is working now with corba interfaces
* supports helper function is working now with corba interfaces

git-svn-id: trunk@12729 -
2009-02-09 00:35:09 +00:00
Jonas Maebe
9d81148986 * only convert character constants into widechar/widestring when assigned
to a widechar/widestring (compatible with constant string handling,
    mantis #13036)

git-svn-id: trunk@12588 -
2009-01-24 12:45:03 +00:00
Jonas Maebe
bfbfa2eb64 * when converting a constant char (not widechar) with ord>=128 to a string,
convert it into a widechar at compile time using the current source file's
    code page (and in case it was to a non-widestring, then convert it at run
    time into the current run time ansi code page) (mantis #12993)

    Previously, the characters were either stuffed into the string without
    conversion (widestring), or passed to the run time "ansi-character to
    stringtype" routine (other string types; which was also wrong, since
    that routine expects the character to be in ansi-encoding, which is
    not necessarily the same as whatever the source file encoding was)

git-svn-id: trunk@12580 -
2009-01-21 18:58:37 +00:00
Jonas Maebe
7b4eed79ce * fixed generic uint32->float softfpu conversion
git-svn-id: trunk@12200 -
2008-11-22 18:05:19 +00:00
florian
a0939ad9d6 * actually the important part of r12120 containing the compiler change
git-svn-id: trunk@12121 -
2008-11-16 14:08:31 +00:00
Jonas Maebe
c6c9ec83e0 * only make the target of a type conversion not regable after checking
whether it's assignable if 1) the size/sign changes (was already the
    case) and 2) in case something actually can be assigned to it

git-svn-id: trunk@12039 -
2008-11-09 10:24:23 +00:00
Jonas Maebe
1e178d324f * explicitly check whether the methodpointer isn't the same as the result
before optimising function result assignment, because at this point the
    hidden self parameter is not yet inserted (mantis #12597)
  * changed ttypeconvnode.actualtargetnode to use the same logic as what
    is used to determine whether something can be assigned to the result
    of a type conversion (so the above check also works if the methodpointer
    contains a typecast to a different object type)

git-svn-id: trunk@12038 -
2008-11-09 10:19:29 +00:00
Jonas Maebe
19f8aede99 + some missing docompare() overrides
git-svn-id: trunk@11937 -
2008-10-19 16:50:43 +00:00
florian
cd6b57c733 * fixed constant char to unicodestring conversion
git-svn-id: trunk@11779 -
2008-09-14 17:19:20 +00:00
florian
b178b08ba7 Merged revisions 11665-11738 via svnmerge from
http://svn.freepascal.org/svn/fpc/branches/unicodestring

........
  r11665 | florian | 2008-08-30 13:30:17 +0200 (Sat, 30 Aug 2008) | 1 line
  
  * continued to work on unicodestring type support
........
  r11666 | florian | 2008-08-30 19:02:26 +0200 (Sat, 30 Aug 2008) | 2 lines
  
  * expectloc for wide/ansi/unicode strings is LOC_CONSTANT or LOC_REGISTER now
........
  r11667 | florian | 2008-08-30 20:42:37 +0200 (Sat, 30 Aug 2008) | 1 line
  
  * more unicodestring stuff fixed, test results on win32 are already good
........
  r11670 | florian | 2008-08-30 23:21:48 +0200 (Sat, 30 Aug 2008) | 2 lines
  
  * first fixes for unix bootstrapping
........
  r11683 | ivost | 2008-09-01 12:46:39 +0200 (Mon, 01 Sep 2008) | 2 lines
  
      * fixed 64bit bug in iconvenc.pas
........
  r11689 | florian | 2008-09-01 23:12:34 +0200 (Mon, 01 Sep 2008) | 1 line
  
  * fixed several errors when building on unix
........
  r11694 | florian | 2008-09-03 20:32:43 +0200 (Wed, 03 Sep 2008) | 1 line
  
  * fixed unix compilation
........
  r11695 | florian | 2008-09-03 21:01:04 +0200 (Wed, 03 Sep 2008) | 1 line
  
  * bootstrapping fix
........
  r11696 | florian | 2008-09-03 21:07:18 +0200 (Wed, 03 Sep 2008) | 1 line
  
  * more bootstrapping fixed
........
  r11698 | florian | 2008-09-03 22:47:54 +0200 (Wed, 03 Sep 2008) | 1 line
  
  + two missing compiler procs exported
........
  r11701 | florian | 2008-09-04 16:42:34 +0200 (Thu, 04 Sep 2008) | 2 lines
  
  + lazarus project for the linux rtl
........
  r11702 | florian | 2008-09-04 16:43:27 +0200 (Thu, 04 Sep 2008) | 2 lines
  
  + set unicode string procedures
........
  r11707 | florian | 2008-09-04 23:23:02 +0200 (Thu, 04 Sep 2008) | 2 lines
  
  * fixed several type casting stuff
........
  r11712 | florian | 2008-09-05 22:46:03 +0200 (Fri, 05 Sep 2008) | 1 line
  
  * fixed unicodestring compilation on windows after recent unix changes
........
  r11713 | florian | 2008-09-05 23:35:12 +0200 (Fri, 05 Sep 2008) | 1 line
  
  + UnicodeString support for Variants
........
  r11715 | florian | 2008-09-06 20:59:54 +0200 (Sat, 06 Sep 2008) | 1 line
  
  * patch by Martin Schreiber for UnicodeString streaming
........
  r11716 | florian | 2008-09-06 22:22:55 +0200 (Sat, 06 Sep 2008) | 2 lines
  
  * fixed test
........
  r11717 | florian | 2008-09-07 10:25:51 +0200 (Sun, 07 Sep 2008) | 1 line
  
  * fixed typo when converting tunicodestring to punicodechar
........
  r11718 | florian | 2008-09-07 11:29:52 +0200 (Sun, 07 Sep 2008) | 3 lines
  
  * fixed writing of UnicodeString properties
  * moved some helper routines to unicode headers
........
  r11734 | florian | 2008-09-09 22:38:55 +0200 (Tue, 09 Sep 2008) | 1 line
  
  * fixed bootstrapping
........
  r11735 | florian | 2008-09-10 11:25:28 +0200 (Wed, 10 Sep 2008) | 2 lines
  
  * first fixes for persisten unicodestrings
........
  r11736 | florian | 2008-09-10 14:31:00 +0200 (Wed, 10 Sep 2008) | 3 lines
  
  Initialized merge tracking via "svnmerge" with revisions "1-11663" from 
  http://svn.freepascal.org/svn/fpc/trunk
........
  r11737 | florian | 2008-09-10 21:06:57 +0200 (Wed, 10 Sep 2008) | 3 lines
  
  * fixed unicodestring <-> variant handling
  * fixed unicodestring property reading
........

git-svn-id: trunk@11739 -
2008-09-10 20:14:31 +00:00
florian
9a83b1d275 * split typecast_string_to_string into simplify and firstpass, allows better constant propagation when inlining, resolves #11327
git-svn-id: trunk@11636 -
2008-08-23 07:29:30 +00:00
florian
1fa70f7a0a * proper support for tobject.getinterface with raw/corba interfaces, resolves #6798 and #6036
git-svn-id: trunk@11497 -
2008-08-01 15:27:58 +00:00
yury
491f0fa1d8 * Replaced all user defined warnings by TODO comments to reduce compiler noise.
git-svn-id: trunk@11443 -
2008-07-23 11:00:03 +00:00
yury
6daceb38f6 * Fixed unreachable code warnings.
git-svn-id: trunk@11440 -
2008-07-23 09:55:44 +00:00
yury
b70bf05ad5 * I hope it's proper fix for r10688.
git-svn-id: trunk@10690 -
2008-04-18 10:51:56 +00:00
Jonas Maebe
62e66d2a56 * explicit typecasting of any ordinal type to a boolean of the same
size must happen without any mangling of the value (mantis #11027)
  * moved checking for signed-to-unsigned (or vice versa) type
    conversions in assignments from htypechk to ncnv (where there
    was already code for similar checks) and added support for
    bool_to_bool there as well

git-svn-id: trunk@10521 -
2008-03-21 14:44:58 +00:00
peter
8f239d04b6 * cleanup and simplify the set type handling
git-svn-id: trunk@10432 -
2008-03-02 17:48:27 +00:00
peter
85e904cb36 * fix range error
git-svn-id: trunk@10424 -
2008-03-02 14:00:38 +00:00
micha
83b7f81f81 + add no-fpu support to compiler/rtl for powerpc-linux (-Cfnone)
git-svn-id: trunk@10422 -
2008-03-02 12:59:02 +00:00
Jonas Maebe
97f4c0a130 * call taddnode.simplify at the very end of taddnode.pass_typecheck, so
it doesn't have to duplicate any type checking code, and so constant
    expressions get the same resultdefs as non-constant expressions
  * properly fixed resultdef determination of "set + setelementn" (follows
    same rules now as "set + set")
  * also convert "longint or/xor cardinal" to int64 (needed for correct
    results with negative numbers and Delphi-compatible) + test
  * extended 64-to-32 type conversion simplification to also handle
    or/xor nodes (so if the result is typecasted back to 32 bit, the
    evaluation can still be done entirely in 32 bit). These changes also
    enable that optimization in some extra cases (not just anymore for
    expressions containing only uint32)

git-svn-id: trunk@10418 -
2008-03-01 20:48:50 +00:00
Jonas Maebe
a2beae0e11 * use more generic set type boundaries for constant sets with one
element in Delphi mode (fixes mantis #10890, but requires more
    thorough changes in nadd.pas for proper fixing)

git-svn-id: trunk@10399 -
2008-02-27 21:17:13 +00:00
Jonas Maebe
179b840cea * also adjust constsetlo when parsing a constant set in Delphi mode
git-svn-id: trunk@10395 -
2008-02-27 15:42:49 +00:00
florian
6c53785e3a * first part of implements clean up and fixing
git-svn-id: trunk@10382 -
2008-02-24 11:05:46 +00:00
Jonas Maebe
f36e5411af * split cpu64bit compiler define into
a) cpu64bitaddr, which means that we are generating a compiler which
       will generate code for targets with a 64 bit address space/abi
    b) cpu64bitalu, which means that we are generating a compiler which
       will generate code for a cpu with support for 64 bit integer
       operations (possibly running in a 32 bit address space, depending
       on the cpu64bitaddr define)
   All cpus which had cpu64bit set now have both the above defines set,
   and none of the 32 bit cpus have cpu64bitalu set (and none will
   compile with it currently)
  + pint and puint types, similar to aint/aword (not pword because that
    that conflicts with pword=^word)
  * several changes from aint/aword to pint/pword
  * some changes of tcgsize2size[OS_INT] to sizeof(pint)

git-svn-id: trunk@10320 -
2008-02-13 20:44:00 +00:00
peter
519b11dba7 * workaround for 2.2 rnagecheck
git-svn-id: trunk@10106 -
2008-01-29 23:19:24 +00:00
Jonas Maebe
8349cde7db * changed byte/word/longbool to be Delphi-compatible (+ similar changes
for qwordbool) + test:
    o assigning true to such a variable now sets them to $ff/$ffff/$ffffffff
    o these types are now all signed
    o converting an integer type to a byte/word/long/qwordbool using an
      explicit type cast keeps the integer's original value stored in the
      bool, instead of forcing it to ord(true)/ord(false)
    (mantis #10233 and #10613, implemented for all architectures, testsuite
     tested for ppc32, sparc and x86)
  * fixed some places where the rtl depended on longbool(true) having the
    value 1
  * extended several boolean tests (and adapted some to no longer assume
    that byte/word/long/qwordbool(true)=1)
  + support for converting to qwordbool in second_int_to_bool for x86, ppc
    and sparc

git-svn-id: trunk@9898 -
2008-01-24 21:30:55 +00:00
Jonas Maebe
84159b3cbb * optimize away unnecessary implicit upcasts to int64 for subtractions
of u32bit values on 32 bit platforms (after the int64 values have 
    already been used for overload selection etc, i.e., semantically
    nothing changes)
  + test which checks that not too many typecasts are optimized away

git-svn-id: trunk@9664 -
2008-01-06 23:30:19 +00:00
florian
8f17101039 * allow application of as operator only to interfaces having a guid, resolves #6797
git-svn-id: trunk@9436 -
2007-12-12 21:07:47 +00:00
Jonas Maebe
742ff35c48 + also optimize assignments from calls to by-reference "results":
o it's a by-reference parameter, but ignore that since it's
      guaranteed to be safe because of the escape analysis
    o it's wrapped in an absolute type conversion -> added
      actualtargetnode method to tnode which digs through that

git-svn-id: trunk@9412 -
2007-12-07 17:58:25 +00:00
yury
4e3547c7bf * Improved warning "Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.":
- check for procedure and class pointers as well;
  - do not warn if typecasted pointer is passed as parameter or directly assigned to a variable. 

git-svn-id: trunk@9264 -
2007-11-16 13:52:19 +00:00