Commit Graph

424 Commits

Author SHA1 Message Date
florian
89f9ebc7b7 * throw an error if raise is called in a noreturn subroutine outside of any exception frame, resolves #39514 2022-01-06 21:13:19 +01:00
Yuriy Sydorov
3ca73da912 * In TP-style INLINE, allowed the > modifier for global vars and relaxed range checks. 2021-08-16 17:36:12 +03:00
Yuriy Sydorov
64ddf22e1b * TP compatibility: For retro CPUs always copy the function result to
the register(s) on function exit if assembler blocks are present.
2021-08-16 00:40:34 +03:00
Yuriy Sydorov
c78e9557f8 * Added support for the old Turbo Pascal INLINE(data/data/...) statement.
It is available only in the TP mode.
2021-08-16 00:40:34 +03:00
nickysn
940738a3a1 * synchronized with trunk
git-svn-id: branches/wasm@48846 -
2021-03-01 13:21:24 +00:00
svenbarth
c7f4be71dc * correctly set the defowner of the exception symtable to the surrounding routine as suggested by Blaise.ru
git-svn-id: trunk@48760 -
2021-02-21 19:15:52 +00:00
nickysn
ed9b14bc20 + allow int64 as for loop counter also for 32-bit targets with a 64-bit ALU
git-svn-id: branches/wasm@48229 -
2021-01-20 16:29:30 +00:00
florian
0bdc1fdea4 * do not set nonlocal for inter-procedural labels, this is not needed, they use
the jmpbuf to reach the target

git-svn-id: trunk@46907 -
2020-09-20 18:57:00 +00:00
florian
6dac888ae5 * 0 is a valid label in iso mode, resolves #37428
git-svn-id: trunk@46362 -
2020-08-11 12:05:13 +00:00
svenbarth
2b7d9c5a1f * also handle single character register names (needed on Z80 for example)
git-svn-id: trunk@45592 -
2020-06-06 17:15:57 +00:00
yury
40504a6f9d * If a nested procedure does not access its parent's frame pointer, optimize it by removing the hidden $parentfp parameter.
* Improved the tisogoto1.pp test.

git-svn-id: trunk@45292 -
2020-05-06 14:43:49 +00:00
svenbarth
60345366f2 * fix for Mantis #35140: apply patch by Ryan Joseph together with some further changes by me to add support for constant parameters in generics
+ added tests

git-svn-id: trunk@45080 -
2020-04-25 22:12:35 +00:00
florian
56d64b007f + in some language modes the loop counter is undefined after the loop by language definition
git-svn-id: trunk@44043 -
2020-01-26 20:13:18 +00:00
florian
007df5d0fa * fix for #36554
git-svn-id: trunk@43913 -
2020-01-11 21:15:19 +00:00
Jonas Maebe
d23c7980aa * properly perform (or not) range/overflow checking when performing constant
propagation into inlined routines, regardless of the range/overflow
    checking state at the caller site

git-svn-id: trunk@43436 -
2019-11-10 12:00:05 +00:00
Jonas Maebe
a051b8d225 - remmoved doregister parameter from t*sym constructors, as the registration
is handled automatically nowadays

git-svn-id: trunk@42998 -
2019-09-14 17:30:45 +00:00
svenbarth
ed5f19e7e3 * change boolean parameters for try_consume_unitsym to a set
git-svn-id: trunk@42360 -
2019-07-12 22:05:05 +00:00
Jonas Maebe
c038e4c3f2 * relaxation of r42272: again only show warnings rather than errors for
out-of-range constants, because of the comments mentioned in #35753
    (except for enums, as apparently Delphi does the same)
  * added range check warnings about explicit type casts that throw away
    bits (e.g. byte($fff)), without giving warnings for most common cases
    (like cardinal(-1))
  * fixed masking/sign exting constant array indices (must be based on index
    range type size/signedness rather than on array size/"signedness")

git-svn-id: trunk@42275 -
2019-06-23 14:12:33 +00:00
Jonas Maebe
1b6425176b * synchronised with trunk till r42049
git-svn-id: branches/debug_eh@42050 -
2019-05-12 18:44:05 +00:00
Jonas Maebe
f76cde1c4c * set correct fileinfo for statements_til_end() block
git-svn-id: trunk@42044 -
2019-05-12 14:28:52 +00:00
florian
b81cc7fbaf * set filepos better
git-svn-id: branches/debug_eh@41284 -
2019-02-10 17:53:52 +00:00
Jonas Maebe
51e68eb302 * fixed several places where the interface crc could change:
o unsetting po_inline while parsing the implementation for various reasons
     (interprocedural goto/label, accessing a local in a parent frame,
      having nested procedures)
   o instead handle this via the pio_inline_not_possible flag
   o noreturn can no longer be specified only in the implementation

git-svn-id: trunk@40789 -
2019-01-06 20:35:56 +00:00
Jonas Maebe
170ec00348 - removed withnode (was no longer used since a very long time)
git-svn-id: trunk@40777 -
2019-01-05 22:28:37 +00:00
florian
2ba239ea6d * more robust fix of #27543
git-svn-id: trunk@40746 -
2019-01-02 16:14:18 +00:00
svenbarth
e7f29e9e28 * also pass the pattern with which the potential unit/namespace symbol had been found to try_consume_unitsym*()
git-svn-id: trunk@38913 -
2018-05-05 17:18:31 +00:00
nickysn
3318703ece * moved nf_typedaddr to addrnodeflags (anf_typedaddr)
git-svn-id: trunk@38671 -
2018-04-03 16:41:01 +00:00
florian
37a5716819 * reuse more sparc code for sparc64
git-svn-id: trunk@36961 -
2017-08-20 17:20:43 +00:00
svenbarth
ca78bfffae * fix for Mantis #32111: allow undefined defs as a for loop's counter; the specialization will decide whether it will compile or not
+ added test

git-svn-id: trunk@36722 -
2017-07-10 19:45:15 +00:00
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
maciej-izak
48b149acd4 New tokens for new management operators: Initialize, Finalize, AddRef and Copy. Small code adjustment for parser (pdecobj.pas, pstatmnt.pas, psub.pas, ptype.pas) was required because few of old token has from now value which is outside range of set: _CONSTRUCTOR, _FINALIZATION.
New tokens for operators:
  * _OP_INITIALIZE, _OP_FINALIZE, _OP_ADDREF, _OP_COPY

New tokens:
  * _INITIALIZE, _FINALIZE, _ADDREF, _COPY

git-svn-id: trunk@35438 -
2017-02-18 18:12:45 +00:00
svenbarth
35f8d5427f Revert r31262. Not doing type checking on generics leads to strange warnings (e.g. because variables are not considered as written). I better deal with the compile time errors one at a time than the warnings.
The added test shows such a bogus warning (sadly the test suite can handle the occurence or absense of certain messages yet :/ )

git-svn-id: trunk@33324 -
2016-03-24 20:58:04 +00:00
sergei
5709127a39 * In pure-assembler procedures, don't allocate/free any registers around the only assembler node. Such procedures don't use virtual registers or register allocator.
git-svn-id: trunk@32608 -
2015-12-07 18:32:35 +00:00
svenbarth
74c79803f7 Extend tlocalvarsym with the ability to not register it if needed.
git-svn-id: trunk@32375 -
2015-11-20 11:29:21 +00:00
florian
70b8789262 o basic extended pascal support:
+ automatically loaded helper unit
  * Makefiles adapted
  * mode switch
  * mode switches reorganized
+ TimeStamp support

git-svn-id: trunk@32330 -
2015-11-15 15:13:36 +00:00
svenbarth
0ff87336aa Convert the Boolean parameters accept_equal, typeonly and hadspecialize of comp_expr(), sub_expr() and factor() to a set parameter and adjust all calls.
pexpr.pas:
  + new enum texprflag and corresponding set texprflags
  * comp_expr: replace accept_equal and typeonly with texprflags parameter
  * factor: replace typeonly and hadspecialize with texprflags parameter
  * sub_expr: replace accept_equal and typeonly with texprflags parameter
  * adjust calls to comp_expr(), factor() and sub_expr()
other units:
  * adjust calls to comp_expr(), factor() and sub_expr() 

git-svn-id: trunk@32269 -
2015-11-07 21:45:03 +00:00
svenbarth
35d8a51730 pexpr.pas:
* extend factor() with the ability to deal with an already parsed "specialize"

git-svn-id: trunk@31768 -
2015-09-18 15:38:09 +00:00
yury
11a9ff4a43 * Removed unused vars for mipsel compiler.
git-svn-id: trunk@31745 -
2015-09-17 15:46:30 +00:00
yury
432248cbf1 * Removed lot of unused vars.
git-svn-id: trunk@31732 -
2015-09-17 12:48:58 +00:00
florian
9a55e8fa3c * do not call typecheckpass unncessarily in generic definitions, it might cause only errors, resolves #28058
git-svn-id: trunk@31262 -
2015-08-02 20:29:30 +00:00
Károly Balogh
56eeabd01b fixed a warning with DFA
git-svn-id: trunk@30015 -
2015-02-26 09:36:03 +00:00
sergei
657ac78304 * Improved handling of registers used in assembler blocks. Assembler nodes no longer have lists of used registers attached to them. Instead, each specified register creates an allocation/deallocation pair and an additional tai_regalloc.markused item directly in the asmlist. This way, register lists are no longer limited to integer registers, and parsing no longer depends on paramanager to know which registers are volatile.
If assembler block has no modified register list, it is still handled in pass2, by allocating all volatile registers (not only the integer ones as before).

git-svn-id: trunk@30011 -
2015-02-25 21:53:15 +00:00
svenbarth
5a344ee263 Rework the way how "specialize" is handled. Instead of initializing the specialization of a full type declaration (including unit name and parent types) it is now considered part of the specialized type itself. This means that for example the following code:
type
  TTestLongInt = specialize SomeOtherUnit.TTest<LongInt>;

will now have to read as

type
  TTestLongInt = SomeOtherUnit.specialize TTest<LongInt>;

While this is not backwards compatible this situation should arise seldomly enough and the benefits especially in context with generic functions/procedures/methods outway the drawbacks.

pbase.pas:
  * try_consume_unitsym: add a allow_specialize parameter that allows to parse "specialize" in front of a non-unit symbol; whether it was a specialization or not is reported using a new is_specialize parameter
  + add a new overload try_consume_unitsym_no_specialize that calls try_consume_unit sym with allow_specialize=false and a dummy is_specialize parameter
  * switch calls to try_consume_unitsym to try_consume_unitsym_no_specialize
pstatmnt.pas, try_statement:
  * switch call to try_consume_unitsym to try_consume_unitsym_no_specialize
  * adjust call to parse_nested_types
ptype.pas:
  + extend id_type with the possibility to disallow unit symbols (needed if a specialize was already parsed) and to report whether a specialize was parsed
  + extend parse_nested_types with the possibility to tell it whether specializations are allowed
  * have parse_nested_types specialize generic defs if one is encountered and local type defs are allowed
  * id_type: only allow "unitsym.specialize sym" or "specialize sym", but not "specialize unitsym.sym"
  * single_type: correctly handle specializations with "specialize" keyword
  * read_named_type.expr_type: there is no longer a need to check for "specialize" keyword
pexpr.pas:
  + new function handle_specialize_inline_specialization which tries to specialize a type symbol
  * handle_factor_typenode: handle specializations after a point that follows a record or object (why isn't this part of postfixoperators anyway? O.o)
  * postfixoperators: handle "specialize" after records and objectdefs
  * factor_read_id: handle "specialize" in front of an identifier (and after unit symbols)

+ added tests
* adjusted test webtbs/tw16090.pp

git-svn-id: trunk@29768 -
2015-02-20 16:23:40 +00:00
Jonas Maebe
270c2d700e * allow the "then" part of an if-statement to be terminated by any endtoken,
instead of only by "else" (mantis #25781)

git-svn-id: trunk@27696 -
2014-04-30 19:25:06 +00:00
Jonas Maebe
b57c95043f + support overriding tdef/tsym methods with target-specific functionality:
o made all (non-abstract) tdef and tsym constructors virtual
   o added c*def/c*sym classref types for every (non-abstract) t*def/t*sym
     class
   o added cpusym unit for every architecture that derives a tcpu*def/tcpu*sym
     class from the base classes, and initialises the c*def/c*sym classes with
     them. This is done so that the llvm target will be able to derive from
     the tcpu*def/sym classes without umpteen ifdefs, and it also means that
     the WPO can devirtualise everything because the c* variables are only
     initialised with one class type
   o replaced all t*def/t*sym constructor calls with c*def/c*sym constructor
     calls

git-svn-id: trunk@27361 -
2014-03-29 22:31:55 +00:00
florian
b2b26f84cf * partially merged the mips-embedded branch of Michael Ring:
- startup code/controller units are not merged yet
  - assembler call does not pass the needed CPU type yet

git-svn-id: trunk@27188 -
2014-03-19 21:25:38 +00:00
florian
4d5119bf1c * fixes several issues which cause warnings by the dfa code when using it to detect uninitialized variables
git-svn-id: trunk@26161 -
2013-12-01 17:02:08 +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
paul
d25ae84113 compiler: don't output an error twice in 'on Exception do' block if Exception is not a valid type
git-svn-id: trunk@25419 -
2013-09-05 00:46:26 +00:00
paul
115ddf4364 compiler: modernize exception class parse:
- use specially implemented type search routine in case of declaration with colon (on E: Exception do)
  - parse nested types in case of declaration without colon (on Exception do)
  + test

fixes issue #0022225

git-svn-id: trunk@25412 -
2013-09-04 14:09:09 +00:00
svenbarth
407e9d173b Fix for Mantis #17598. When extended syntax is off allow the result of constructors to be dropped when the constructor is called as an instance method instead of a class method.
pstatmnt.pas, statement:
  * check whether the constructor is called as an instance or class method
nflw.pas, tlabelnode.pass_1:
  * don't check the owner of the labelsym when there is none (happens with internally created labels like for e.g. exception handling)

+ added test  

git-svn-id: trunk@25068 -
2013-07-09 07:56:45 +00:00