Commit Graph

345 Commits

Author SHA1 Message Date
Jonas Maebe
d6d411442b * more small indentation fixes
git-svn-id: trunk@15455 -
2010-06-19 16:22:56 +00:00
Jonas Maebe
e66dbe1317 * fixed indentation of for-in code
git-svn-id: trunk@15450 -
2010-06-19 15:10:44 +00:00
florian
af3eee54cd * make nested comment warning go away
git-svn-id: trunk@15208 -
2010-05-02 19:24:15 +00:00
Jonas Maebe
a48a37d38b * fixed extended syntax checking {$x-} by moving it from the typecheck pass
to the parser, so that it only looks at what the programmer wrote rather
    than at all statements that the compiler may generate internally
    (mantis #11619)
  + several tests for {$x-} mode
  * modified tenumerators1 so it compiles without extended syntax enabled
    (to check for..in with {$x-})

git-svn-id: trunk@15075 -
2010-03-27 12:51:27 +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
d60e1f674c * automatically try to call procvars that are subscripted or used in a
with-statement, both in FPC and TP/Delphi modes (mantis #15728)

git-svn-id: trunk@14881 -
2010-02-10 16:12:18 +00:00
florian
c6ffbe9eda * support string constants > 255 chars
* don't cut off anymore string constants silently at 255 chars

git-svn-id: trunk@14789 -
2010-01-24 09:28:46 +00:00
paul
009ef9184d compiler: add dispinterfaces to most of places where something is comparing to usual interfaces since they are not very different things
git-svn-id: trunk@14751 -
2010-01-19 15:24:39 +00:00
florian
448f3d99c1 * cleanup of case <string> of code by Sergei Gorelkin, resolves #13700
git-svn-id: trunk@14467 -
2009-12-23 19:27:50 +00:00
paul
d89463588c compiler: don't compile incorrect statements if operators are involved (issue #0015338) + test
git-svn-id: trunk@14458 -
2009-12-21 06:57:38 +00:00
Jonas Maebe
40f88809af * don't error out or generate invalid code for "with x do ;"
(Delphi/TP-compatible, mantis #15274)

git-svn-id: trunk@14370 -
2009-12-08 19:45:08 +00:00
Jonas Maebe
559e284bd0 * merged r13762-14047 from trunk
git-svn-id: branches/objc@14048 -
2009-11-04 15:50:26 +00:00
paul
aa5a5e79ce merge revisions: 13909,13923,13924,13934,13935,13942,13943,13944,13946,13948,13950,13951,13952,13983,13994:
rtl: add enumerators to the basic classes
tests: add enumerators test which compiles and work both by fpc and dcc
compiler: 
  + start for-in loop implementation: implement for-in loop for types (enumerations and ranges), strings, arrays and sets. todo: perform type checking, optimize array and string loops - use temp for expression, implement for-in loop for classes
test:
  + add a simple test for the 'for-in' loop
compiler: fix string for-in loop. now it uses a temp variable to store string expression result
complier: fix for-in array loop. use a temp variable for the loop expression only if loop is not an open array loop
complier: continue enumerator implementation:
  + add operator enumerator which give an ability to add enumerator for an existent type (for example to override builtin string enumerator)
  + add class enumerator support via delphi compatible GetEnumerator method + enumerator class/object template (function MoveNext: Boolean; property Current)
  + tests
compiler: fix for-in loop for arrays. delphi does not copy arrays to a temp variable and it is possible to change array during loop. + test
compiler: add reference for the enumerator operator when it is used + another test for operator enumerator for a class
compiler: add reference for the enumerator operator when it is used + another test for operator enumerator for a class
compiler: enumerator directive support:
  + allow to mark methods and properties by 'enumerator MoveNext' and 'enumerator Current' modifiers. Parser checks return types and duplicates.
  + prefer *marked* by enumerator directive methods and properties than GetEnumerator and Current builtin symbols
  + increase ppu version
  + test
rtl: add IEnumerator and IEnumerable interfaces declarations
tests: for-in loop tests:
  + add small comment at the top of test program
compiler: allow 'enumerator MoveNext' for the interface function declaration + test
compiler: move all for-in loop helpers to the nflw unit
compiler: don't allow the compiler to choose the non-valid enumerator operator for the for-in loop

git-svn-id: trunk@14008 -
2009-11-02 03:24:48 +00:00
florian
44aed2af60 o patch by Michael Denisenko, resolves #14734:
* fixes memory leaks in case of string code
  * replace usage of strcmp
  * improved tests

git-svn-id: trunk@13830 -
2009-10-09 20:40:22 +00:00
Jonas Maebe
d34276c575 --- Merging r13696 through r13760 into '.':
U    ide/fpusrscr.pas
U    rtl/unix/video.pp
U    rtl/i386/i386.inc
U    rtl/win/wininc/defines.inc
U    rtl/win/systhrd.inc
U    rtl/linux/m68k/dllprt0.as
U    rtl/linux/i386/syscall.inc
U    rtl/linux/i386/dllprt0.as
U    rtl/linux/i386/si_c.inc
U    rtl/linux/i386/si_prc.inc
U    rtl/linux/i386/si_c21.inc
U    rtl/linux/i386/si_g.inc
U    rtl/linux/i386/si_c21g.inc
U    rtl/linux/i386/si_uc.inc
U    rtl/linux/i386/si_dll.inc
U    rtl/linux/x86_64/dllprt0.as
A    tests/test/packages/hash/sha1test.pp
U    tests/webtbs/tw12038.pp
U    compiler/cclasses.pas
U    compiler/symdef.pas
U    compiler/ncon.pas
U    compiler/ncgrtti.pas
U    compiler/cgbase.pas
U    compiler/pstatmnt.pas
U    compiler/systems/t_linux.pas
U    compiler/pass_1.pas
U    compiler/x86/cgx86.pas
U    compiler/x86/agx86att.pas
U    compiler/x86/aasmcpu.pas
U    compiler/aasmbase.pas
A    packages/fcl-xml/tests/extras.pp
A    packages/fcl-xml/tests/extras2.pp
--- Merging r13696 through r13760 into 'packages/fcl-xml/tests/README_DOM.txt':
U    packages/fcl-xml/tests/README_DOM.txt
--- Merging r13696 through r13760 into '.':
U    packages/fcl-xml/tests/domunit.pp
U    packages/fcl-xml/src/xpath.pp
U    packages/Makefile
U    packages/gmp/src/gmp.pas
U    packages/gmp/readme
U    packages/fcl-db/src/base/db.pas
U    packages/fcl-db/src/base/database.inc
U    packages/sqlite/src/sqlite3.inc
U    packages/fcl-web/src/custweb.pp
U    packages/hash/fpmake.pp
U    packages/hash/Makefile.fpc
A    packages/hash/src/sha1.pp
U    packages/hash/Makefile
U    packages/hash/examples/Makefile.fpc
A    packages/hash/examples/sha1test.pp
U    packages/hash/examples/Makefile
U    packages/Makefile.fpc
U    packages/fcl-base/src/ascii85.pp
U    packages/fcl-base/src/custapp.pp
U    packages/chm/src/chmwriter.pas
U    packages/chm/src/paslzx.pas
U    packages/chm/src/chmreader.pas
--- Merging r13761 into '.':
U    compiler/powerpc/agppcvasm.pas
U    compiler/ppcgen/agppcgas.pas

git-svn-id: branches/objc@13762 -
2009-09-27 14:13:44 +00:00
florian
02eeb3dad6 o update by Michael Denisenko for case <string> of
* memory management fixed
  * idention fixed

git-svn-id: trunk@13712 -
2009-09-14 21:44:11 +00:00
Jonas Maebe
ed9656d1e6 Merged revisions 13627-13631,13637-13638,13640,13642-13648,13650-13653,13656-13658,13660,13664-13667,13672-13675,13680,13682,13687 via svnmerge from
svn+ssh://jonas@svn.freepascal.org/FPC/svn/fpc/trunk

git-svn-id: branches/objc@13697 -
2009-09-12 12:42:38 +00:00
florian
cf215d5097 o patch by Michael V. Denisenko to handle case <string> of (see also #13700)
+ compiler implementation
  + tests

git-svn-id: trunk@13642 -
2009-09-03 20:21:30 +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
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
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
3dd32daa03 * always create a temp for MacPas objects in with-expressions (mantis
#13210)

git-svn-id: trunk@12753 -
2009-02-19 22:43:59 +00:00
yury
fcceb9cfa1 * Removed/ifdefed/commented unused local variables.
git-svn-id: trunk@11430 -
2008-07-20 23:00:31 +00:00
florian
19e723c869 * germanism fixed (aktexceptblock -> current_exceptblock)
git-svn-id: trunk@11410 -
2008-07-19 17:06:16 +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
florian
bc73f9021c Merged revisions 5891-10167,10169-10180 via svnmerge from
http://svn.freepascal.org/svn/fpc/branches/avr

........
  r5891 | florian | 2007-01-11 17:30:12 +0100 (Do, 11 Jan 2007) | 2 lines
  
  + some initial work
........
  r10170 | florian | 2008-02-03 11:02:04 +0100 (So, 03 Feb 2008) | 2 lines
  
  * continued to work on avr port
........
  r10180 | florian | 2008-02-03 15:29:30 +0100 (So, 03 Feb 2008) | 2 lines
  
  + a lot of skeleton code for avr added
........

git-svn-id: trunk@10186 -
2008-02-03 17:21:52 +00:00
peter
505e4f7809 * don't give illegal expression for errorn statements. The error is already given
or can be ignored during a generic template parsing

git-svn-id: trunk@9520 -
2007-12-23 20:57:59 +00:00
florian
50cc61c8fd * ignore register list in pure assembler routines, resolves #9335
git-svn-id: trunk@8978 -
2007-10-28 20:41:19 +00:00
Jonas Maebe
12b4f034ea * only allow using array elements as for-loop counter variables
in TP mode

git-svn-id: trunk@8907 -
2007-10-21 22:39:49 +00:00
peter
6434772c3c * error message when a goto label is optimized away
git-svn-id: trunk@8837 -
2007-10-17 21:52:25 +00:00
Jonas Maebe
c89ea4412f * disallow using inline nodes with a non-void resultdef as statements
(e.g. length, lo/hi, ord, etc). Not the same as mantis #9918, but
    somewhat related

git-svn-id: trunk@8770 -
2007-10-12 11:54:37 +00:00
Jonas Maebe
c408d9bb1d * fixed regression of webtbs/tw2789 caused by r8270 (setting vs_read
without vsf_must_be_valid means that it's not really read, but
    only used by sizeof or so)

git-svn-id: trunk@8273 -
2007-08-12 19:52:57 +00:00
Jonas Maebe
12791bf4f1 * avoid spurious uninitialised warnings about array elements used as
for-loop counters

git-svn-id: trunk@8270 -
2007-08-12 13:19:30 +00:00
peter
1dd62b8686 * write also asmblocklabel for a connected labelsym
git-svn-id: trunk@8159 -
2007-07-23 21:01:32 +00:00
daniel
9adb202a92 * Rework the constexprint to allow operations from low(int64) to high(qword).
+ Some initial work on a formaldef which also carries the typinfo of a parameter.

git-svn-id: trunk@7639 -
2007-06-13 07:41:18 +00:00
Jonas Maebe
69cf42c4f7 * fixed val(s,int64) (it accepted values in the range
high(int64+1)..high(qword) if written in decimal notation) + test
  * fixed range checking of qword constants parsed by the compiler
    (they always gave a range error if > high(int64), because the compiler
     internally stores them as int64)
  * turn off range checking flag of rdconstnodes created by the parser
    from _INTCONST, because those are already range checked by the
    way they are parsed using val()

git-svn-id: trunk@6814 -
2007-03-12 22:22:43 +00:00
Jonas Maebe
4e96fe8fac * fixed with-support for classrefdefs (mantis 8150), with thanks to
Thorsten Engler for supplying an initial patch

git-svn-id: trunk@6088 -
2007-01-20 20:04:54 +00:00
Jonas Maebe
2ad3ef968f * properly detect when we can't take the address of a with-expression
and assign it to a temp in that case (mantis #8141)

git-svn-id: trunk@6071 -
2007-01-19 13:01:07 +00:00
Jonas Maebe
f2b07704b5 * proper initialised/used warnings for variables used
in complex with-statements + tests

git-svn-id: trunk@6024 -
2007-01-17 12:04:53 +00:00
peter
0557ddc342 * removed typed const, it is now handled by staticvarsym
* globalvarsym renamed to staticvarsym
  * fixed invalid regvar use in init when the finalize also uses the var

git-svn-id: trunk@5290 -
2006-11-08 21:04:22 +00:00
peter
3cae449fda * moved rtti to ncgrtti
git-svn-id: trunk@5219 -
2006-11-04 10:43:27 +00:00
peter
658c46b903 * remove tdictionary and tindexarray
* symtables based on TFPHashObjectList and TFPObjectList
  * rename torddef.typ to torddef.ordtype
  * rename tfloatdef.typ to tfloatdef.floattype
  * rename tdef.deftype to tdef.typ
  * remove obsolete browser code, browcol is kept so the ide
    can still be compiled

git-svn-id: trunk@5192 -
2006-11-03 00:30:30 +00:00
florian
bce905b106 * give correct error locations for errors when specializing templates
* removed more germanisms
* better dumping of tokenbuf in ppudump

git-svn-id: trunk@5101 -
2006-10-30 23:28:06 +00:00
florian
85d63d9fa9 * settings refactored
git-svn-id: trunk@5094 -
2006-10-30 18:02:58 +00:00
peter
3078a1927f * remove ttype
* rename old ttype variables *type to *def
  * rename resulttypepass to pass_typecheck
  * rename pass_2 to pass_generate_code

git-svn-id: trunk@5077 -
2006-10-29 22:19:39 +00:00
Jonas Maebe
5cad2321a9 * allow assigning to loop control vars in macpas mode
git-svn-id: trunk@4956 -
2006-10-18 18:13:41 +00:00
Jonas Maebe
355e101bc1 * temp results of calls in "with" statements can be in regs
git-svn-id: trunk@4649 -
2006-09-19 09:23:57 +00:00
Jonas Maebe
eccbc78e04 + support for bitpacked arrays:
+ use {$bitpacking on/+} to change the meaning of "packed"
      into "bitpacked" for arrays. This is the default for MacPas.
      You can also define individual arrays as "bitpacked", but
      this is not encouraged since this keyword is not known by
      other compilers and therefore makes your code unportable.
    + pack(unpackedarray,index,packedarray) to pack
      length(packedarray) elements starting at
      unpackedarray[index] into packedarray.
    + unpack(packedarray,unpackedarray,index) to unpack
      packedarray into unpackedarray, with the first
      element being stored at unpackedarray[index]
  * todo:
    * "open packed arrays" and rtti for packed arrays are not
      yet supported
    * gdb does not properly support bitpacked arrays

git-svn-id: trunk@4449 -
2006-08-19 12:54:12 +00:00
florian
48802b0866 + variants can be used as case expression
git-svn-id: trunk@3530 -
2006-05-14 18:29:49 +00:00
peter
b7fe6797bf Merged revisions 2921-2922,2925 via svnmerge from
http://svn.freepascal.org/svn/fpc/branches/linker/compiler

........
r2921 | peter | 2006-03-15 08:35:00 +0100 (Wed, 15 Mar 2006) | 2 lines

  * pass ObjectWriter to ObjectOuput

........
r2922 | peter | 2006-03-15 12:40:30 +0100 (Wed, 15 Mar 2006) | 2 lines

  * refactor asmdata

........
r2925 | peter | 2006-03-15 16:09:39 +0100 (Wed, 15 Mar 2006) | 3 lines

  * add cfi to asmdata
  * move asmlist, asmcfi, asmdata to own unit

........

git-svn-id: trunk@2932 -
2006-03-16 08:52:22 +00:00