Commit Graph

275 Commits

Author SHA1 Message Date
Jonas Maebe
769eb3f604 * moved the initialisation of the nodetree and tai class reference constants
from the unit initialisation sections to the variable declaration sections
    to prevent the base units from overriding derived classes (based on patch
    by Hans-Peter Dietrich, mantis #17516)

git-svn-id: trunk@16118 -
2010-10-09 18:52:22 +00:00
Jonas Maebe
94d976bc87 * when simplifying ordinal expressions during inlining, keep the resultdef
that was set during the typecheck pass because typeconversion nodes
    may have been optimised away previously and sometimes the resultdef is
    important (e.g. for the value of callparanodes) (mantis #17458)

git-svn-id: trunk@16101 -
2010-10-07 15:08:52 +00:00
mazen
b127fc154a * Fixed spell error revealed by lintian.
git-svn-id: trunk@16094 -
2010-10-06 20:33:57 +00:00
Jonas Maebe
a311607ca6 * do not convert the second argument of inc/dec(ptrtype,value) into a
pointer, because that will force "value" to become unsigned, which
    result in errors in case of negative 64bit constants in case they
    are multiplied by the size of the pointed type in ncginl (the
    tconstexprint type operators have to handle positive and
    negative numbers differently) (mantis #17342)

git-svn-id: trunk@15951 -
2010-09-08 15:33:43 +00:00
florian
79fa2eb539 * support of iso pascal like i/o in iso mode
git-svn-id: trunk@15685 -
2010-07-31 20:46:27 +00:00
florian
c506913e9b * iso conformant writing of floats (using e instead of E) in iso mode
git-svn-id: trunk@15684 -
2010-07-31 20:45:55 +00:00
florian
8b3bd36ef0 * use iso reset/rewrite with automatic assignmentin iso mode
git-svn-id: trunk@15682 -
2010-07-31 20:44:32 +00:00
florian
d0ea23f39e * write false/true lower case in iso mode
git-svn-id: trunk@15678 -
2010-07-31 20:40:43 +00:00
Jonas Maebe
04a63ea278 * fixed range/overflow checking for succ/pred (mantis #16770)
git-svn-id: trunk@15474 -
2010-06-22 19:15:08 +00:00
paul
1b614b526a compiler:
- add own symbol table for enumeration to store enumeration elements
  - reimplement enumeration member traverse using symbol table instead of firstenum/nextenum - that members are removed
  - implement TEnum.Element access syntax - element is searched in the enumeration symtable in this case instead of global/local symtables
  - implement {$SCOPEDENUM ON/OFF} local switch
  + tests

git-svn-id: trunk@15051 -
2010-03-25 05:46:53 +00:00
Jonas Maebe
071bca7d93 * set expectloc in first_abs_long (mantis #15790)
git-svn-id: trunk@14926 -
2010-02-19 16:46:46 +00:00
Jonas Maebe
025ec34e4d + "CExtended" type that is the same as "extended", but conforming to the
properties/behaviour of the equivalent of Extended in C (i.e., to
    "long double" on i386 and x86_64 platforms that support a 10 byte
    long double, and to "double" elsewhere)

git-svn-id: trunk@14912 -
2010-02-14 13:45:58 +00:00
Jonas Maebe
fea789eca4 * fixed (harmless) range check errors
git-svn-id: trunk@14908 -
2010-02-13 20:48:59 +00:00
florian
f8bf268406 * handle sarX(<const>,<var>) properly. resolves #15653
git-svn-id: trunk@14866 -
2010-02-04 21:30:25 +00:00
pierre
0d098f2dba * fix range check error
git-svn-id: trunk@14851 -
2010-02-03 00:31:26 +00:00
Jonas Maebe
caca6cea37 * allow any kind of fields in Object Pascal classes that are passed to
Objective-C methods or which are fields of Objective-C classes (since they
    are basically opaque to the Objective-C runtime) + fixed tobjc11 so it
    expects classes to be encoded as opaque types
  * give a proper error message when using illegal field/parameter types in
    Objective-C classes/methods instead of an internal error (only checked
    during rtti generation rather than during parsing, because during parsing
    some types may still be forwarddefs)
  * split objcutil in objcdef and objcutil, with objcdef depending only on
    the symtable so it can be used in symdef

git-svn-id: trunk@14838 -
2010-01-31 21:13:41 +00:00
florian
dfc2652062 + support of compiler intrinsic sar* using a patch by Benjamin Rosseaux, resolves #15606
git-svn-id: trunk@14834 -
2010-01-31 16:47:01 +00:00
florian
20de72b703 * allow writeln/readln on generic type parameters
git-svn-id: trunk@14721 -
2010-01-17 15:58:46 +00:00
Jonas Maebe
83c3e7a94b * fixed pred/succ for integer constants that equal the low/high bound of a
built-in integer type (reported by Stefan Kisdaroczi) 

git-svn-id: trunk@14537 -
2010-01-04 15:12:27 +00:00
Jonas Maebe
e50c05f44e * fixed inverted condition in inc/dec range/overflow case that caused
unsigned 32/64 bit values to be always explicitly typecasted to signed
    32/64 bit instead of never (mantis #15304)

git-svn-id: trunk@14379 -
2009-12-09 21:54:46 +00:00
Jonas Maebe
2c3c6d27d3 * fixed range checking for inc/dec when mixing unsigned and signed types
(mantis #14841)
   -> this also makes it impossible now to use constructs such as
    inc(qword_var,-1) with range checking enabled, because that would require
    a conversion to 128 bit for proper evaluation

git-svn-id: trunk@14260 -
2009-11-23 20:01:07 +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
8d65471fe2 * give a proper error when trying to use val() on a boolean (mantis #14777)
* don't allow a boolean or (wide)char to be used as the "error" parameter
    for val()

git-svn-id: trunk@14006 -
2009-11-01 17:18:40 +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
0eec337a00 - removed SUPPORT_UNALIGNED, FPC_SUPPORTS_UNALIGNED and FPC_UNALIGNED_FIXED
defines and ifdefs (already all defined by 2.2.4)

git-svn-id: trunk@13581 -
2009-08-23 07:51:26 +00:00
Jonas Maebe
5885866990 + support for objcencode() (equivalent of Objective-C's @encode()) + test
+ functionality to encode Objective-C function signatures (untested)

git-svn-id: branches/objc@13557 -
2009-08-18 19:54:02 +00:00
florian
c0d4efed2e * forbid passing derived classes to call by reference parent classes (for objects, this is still allowed), resolves #13135
git-svn-id: trunk@13551 -
2009-08-17 21:46:25 +00:00
Jonas Maebe
2799cfd83f + parser-side of objcprotocol() expression to obtain the metaclass
associated with an Objective-C protocol. Code generator part will
    always generate an internalerror currently, because it cannot yet
    be implemented (needs support for generating RTTI for Objective-C
    classes)

git-svn-id: branches/objc@13461 -
2009-07-26 16:03:37 +00:00
Jonas Maebe
40247d2d87 * give an error when the typeinfo() function is called for an enumeration
whose base is not 0, or that has jumps in its value range (manits #9551)

git-svn-id: trunk@12960 -
2009-03-22 20:54:49 +00:00
Jonas Maebe
6165536b5e + added {$modeswitch objectivec1}/-Mobjectivec1 mode switch to enable
the use of Objective-C 1.0 constructs. Because it is a mode switch, it
    can be used cumulatively with every syntax mode. Note that a {$mode xxx}
    statement resets all mode switches as well, so you cannot use the
    -Mobjectivec1 variant if you have such a statement in a unit. This
    modeswitch is currently only enabled for Darwin/PowerPC and Darwin/i386,
    as the backend support is not yet implemented for other platforms.
  + implemented selector() statement that can be used to create an Objective-C
    selector for the message with the specified *constant* name (in the future,
    it will also work for Objective-C method identifiers)
  + added SEL type to the system unit (the selector() statement returns it)
  + added all Objective-C segments to the assembler writers
  + (currently mostly dummy) objc1 unit that is automatically included if the
    {$modeswitch objectivec1} statement is used
  + some tests for the selector() statement

git-svn-id: trunk@12870 -
2009-03-08 18:40:32 +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
1afb1aa9cc + ror/rol functions
+ internal compiler support for ror/rol on i386

git-svn-id: trunk@11466 -
2008-07-27 17:12:32 +00:00
florian
0a4314206f * range check error checking for floats refactored
* never throw range/overflow check errors for floats in delphi mode, resolves #7584

git-svn-id: trunk@10940 -
2008-05-11 09:09:21 +00:00
Jonas Maebe
7657cd7b6c * result of prefetch is voidtype, not voidpointertype (fixes mantis #11275)
git-svn-id: trunk@10913 -
2008-05-09 14:13:59 +00:00
Jonas Maebe
d80d3f36d2 * fixed crash when writing a currency value with a specified number
of fractional digits in case it's not the last value of the
    write(ln) statement (mantis #10920)

git-svn-id: trunk@10421 -
2008-03-02 10:22:25 +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
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
yury
e5f8426f61 * Prevent warning about automatic type conversion when using VAL with COMP type on x86.
git-svn-id: trunk@9540 -
2007-12-26 17:47:40 +00:00
Jonas Maebe
5196db1ac3 * fixed low(set)/high(set) after previous changes + test
git-svn-id: trunk@9371 -
2007-12-01 17:16:33 +00:00
Jonas Maebe
feec2a74f2 * fixed crashes with length(pchar) and length(pwidechar) after
r9360-r9361

git-svn-id: trunk@9363 -
2007-12-01 10:38:22 +00:00
Jonas Maebe
1380a64b1e + simplify support for inline nodes (needed for inlining, because
otherwise you get internalerrors, e.g. when an assigned() expression
    becomes constant)
  * fixed length for constant strings in case of multi/single byte string
    conversions
  * fixed memory leak in constant evaluation of in_abs_long

git-svn-id: trunk@9361 -
2007-11-30 23:47:49 +00:00
Jonas Maebe
aaa484aa59 * removed goto's from tinlinenode.pass_typecheck and removed some other
old no longer needed code from it

git-svn-id: trunk@9360 -
2007-11-30 20:47:38 +00:00
florian
fb8bbd5ff0 + inline abs(<longint>) on x86
git-svn-id: trunk@9333 -
2007-11-25 18:54:40 +00:00
Jonas Maebe
9f04aad33e * prefer write({short,ansi,wide}string) over write(chararray) for
constant strings

git-svn-id: trunk@9279 -
2007-11-18 09:56:25 +00:00
peter
6b8aed593f * remove registers{int/mmx/fpu} from firstpass
* small cleanups of unused variables in firstpass
  * node_resources_fpu() created to get an approximation of the
    required fpu registers
  * for the moment use node_complexity in the CG until the
    node_resource_int() is created

git-svn-id: trunk@8655 -
2007-09-26 21:12:01 +00:00
Jonas Maebe
c10b375615 * give an error for high(ansistring) and high(widestring)
(mantis #9579)

git-svn-id: trunk@8370 -
2007-09-03 16:37:24 +00:00
peter
67e16340be * revert r8118
git-svn-id: trunk@8139 -
2007-07-22 19:59:00 +00:00
daniel
21293f5818 + Add common type integer promotion.
- {$intpromotion common_type} or -CIcommon_type switches to common type promotion.
    - {$intpromotion native_integer} or -CIcommon_type switches to current behaviour.
    - Default in tp mode is common_type, native_integer in other modes
    - Compiler can cycle with -CIcommon_type
    - Still needs checking on other architectures than i386

git-svn-id: trunk@8118 -
2007-07-21 19:16:24 +00:00
Jonas Maebe
28bab3fb4f - removed some unused variables
* fixed some (harmless) ptrint warnings
  - removed some commented code in agppcmpw
  * added one missing field in a typed constant in cp1251

git-svn-id: trunk@8081 -
2007-07-17 13:57:15 +00:00
daniel
11c7fcef7b * Cosmetic cleanup of constexprint leftovers.
git-svn-id: trunk@7657 -
2007-06-14 06:12:12 +00:00