Commit Graph

34376 Commits

Author SHA1 Message Date
svenbarth
988c799b0e generate_specialization needs to return the correct generic def if the parent classes are parsed, so that that the usage of generic interfaces is allowed.
This fixes the compilation of test tests\test\tgeneric29.pp and the reminder in pdecobj.pas is not needed anymore.

Note: Perhaps this behavior should be enabled in general if "parse_generic" is true (and not only if parse_parent_class if true as well).

git-svn-id: branches/svenbarth/generics@19426 -
2011-10-09 16:07:22 +00:00
svenbarth
d54b7dd58f Added two reminders for me
git-svn-id: branches/svenbarth/generics@19425 -
2011-10-09 16:06:31 +00:00
svenbarth
6b03193783 Switching from overloaded type symbol to unique symbol per generic.
Reasons for the "unique symbol" approach:
- no special search operations for cross unit search needed (which is supported by Delphi) => less performance impact
- no special care needed to really find the correct generic => less increase of parser complexity

Currently all generic tests except tgeneric29.pp compile and inline specializations work as well.

The changes in detail:
* pdecl.pas/types_dec:
- The variables used to hold the final name of the symbol are now prefixed with "gen". In case of non-generics the prefixed ones are equal to the non-prefixed ones (e.g. orgtypename=genorgtypename). In case of a generic symbol the "gen"-variants contain the type parameter count suffix (e.g. '$1' in case of 'TTest<T>') as well.
- The unmodified pattern is used to insert and detect a dummy symbol with that name, so that type declarations and - more important - inline specializations can find that symbol.
- In non-Delphi modes this symbol is also used to detect whether we have a type redefinition which is not allowed currently; its typedef points to the generic def.
- In mode Delphi the def of that dummy symbol (which contains an undefineddef) is modified when a corresponding non-generic type is parsed, so that it contains the def of the real type.

* pdecsub.pas/parse_proc_head
- consume_generic_type_parameter now only parses the type parameters and picks the generic with the correct amount of parameters. The verification of the order and names of the parameters needs to be added again.
- it also does not use "def" anymore, but it sets "srsym"
- in parse_proc_head the symbol (srsym) is only searched if the symbol isn't assigned already; in case of a generic in mode FPC it will find the dummy symbol that points to the generic def

* pexpr.pas
- in factor_read_id there are three cases to handle:
 + the symbol is not assigned => error
 + a possible generic symbol (either an undefined def or the non-generic variant) => no error and no hints
 + a non-generic symbol => hints
 Point 1 is handled correctly, point 2 and 3 aren't currently and also they might be needed to be moved somewhere else
- sub_expr:
 + a node can be a tloadvmtaddrnode as well if the non-generic variant of a generic symbol is a class
 + we can only check afterwards whether the specialization was successful

* pgenutil.pas/generate_specialization
using the count of the parsed types the correct symbol can be found easily

git-svn-id: branches/svenbarth/generics@19424 -
2011-10-09 16:05:31 +00:00
svenbarth
a862cd702d Rebase to revision 18000
git-svn-id: branches/svenbarth/generics@18005 -
2011-07-16 16:19:33 +00:00
svenbarth
6a9e882277 pexpr.pas, sub_expr: Added support for "as" and "is" operators if the right hand side is an inline specialization (currently detected by the next token being a "<"). This could potentially introduce some problems if the right hand side isn't a specialization but a "<" comparison together with some overloaded operators (I still need to find a case for such a problem)...
git-svn-id: branches/svenbarth/generics@18004 -
2011-07-16 14:13:56 +00:00
svenbarth
b23b42acb3 factor_read_id:
don't accept the generic dummy symbol if the next token isn't a "<"

sub_expr:
generate an error if we had a normal "<" comparison containing the dummy symbol on the left side instead of a specialization

git-svn-id: branches/svenbarth/generics@18003 -
2011-07-16 14:13:11 +00:00
svenbarth
de1e6b1c3d Implement support for nested non-generic types inside generic types. This is mostly for records, classes and objects ("structures") as those didn't work at all, but the others (arrays, procvars) weren't done cleanly either.
pobjdec.pas (object_dec) / ptype.pas (record_dec, array_dec, procvar_dec):
- enable "parse_generic" if a nested type is parsed and we're already inside a generic (this prevents code to be generated for the nested type's methods)
- set the "df_specialization" flag so that the code for generating the methods (and thus resolving the forwards declarations) is called for this symbol

pexpr.pas:
add "post_comp_expr_gendef" which basically calls "handle_factor_typenode" and "postfixoperators" as those aren't exported from the unit themselves

ptype.pas, read_named_type.expr_type:
- use "post_comp_expr_gendef" to parse the use of nested types (e.g. "var t: TTest<T>.TTestSub")

psub.pas, specialize_objectdefs:
implement the generation of the method bodies for nested structures (resolves the forward declarations)

pdecl.pas, types_dec:
when we encounter a nested structure inside a specialization of a structure, we need to find the corresponding generic definition so that the generic can be correctly parsed later on.

git-svn-id: branches/svenbarth/generics@18002 -
2011-07-16 14:12:25 +00:00
svenbarth
bb61abe546 Finally fixed the handling of hint directives and added a comment explaining the situation in the context of generics.
git-svn-id: branches/svenbarth/generics@18001 -
2011-07-16 14:11:31 +00:00
michael
840b158eb8 * Fixed DeleteKey. Deleting the last key does not delete the section (Delphi/Windows compatible)
git-svn-id: trunk@18000 -
2011-07-16 14:11:30 +00:00
svenbarth
8737220309 * Reordered the conditions for the inline spezialization as the "isgeneric" boolean is not needed
* As "handle_factor_typenode" is now available the classrefdef wrapper is not needed anymore

git-svn-id: branches/svenbarth/generics@17999 -
2011-07-16 14:10:34 +00:00
svenbarth
b0eb13cc3f Removed the remaining traces of the type overloads and increased PPU version to differ from trunk.
git-svn-id: branches/svenbarth/generics@17998 -
2011-07-16 14:09:38 +00:00
svenbarth
6a60f9d42a Integrated the changes from trunks's postfixoperators into my own and removed the local version again.
git-svn-id: branches/svenbarth/generics@17997 -
2011-07-16 14:08:49 +00:00
svenbarth
7a401d6f00 generate_specialization needs to return the correct generic def if the parent classes are parsed, so that that the usage of generic interfaces is allowed.
This fixes the compilation of test tests\test\tgeneric29.pp and the reminder in pdecobj.pas is not needed anymore.

Note: Perhaps this behavior should be enabled in general if "parse_generic" is true (and not only if parse_parent_class if true as well).

git-svn-id: branches/svenbarth/generics@17996 -
2011-07-16 14:08:03 +00:00
svenbarth
19f0bc5c64 Added two reminders for me
git-svn-id: branches/svenbarth/generics@17995 -
2011-07-16 14:07:20 +00:00
michael
066a001afe * Fixed WriteString to be Windows/Delphi compatible. Writing an empty value does not delete the value
git-svn-id: trunk@17994 -
2011-07-16 14:05:42 +00:00
Jonas Maebe
d85ccd7418 * fixed compilation on targets where tthreadid is not an integer type after
r17992

git-svn-id: trunk@17993 -
2011-07-16 12:03:35 +00:00
sergei
5c3aca5148 * thread.inc, DoneThread: allow CurrentTM.ReleaseThreadVars to be unassigned and reset ThreadID (in preparation to support Windows native threadvars)
* win/systhrd.inc: added error checking in several places. Fail with code 226 if resources cannot be allocated, as Delphi does.
* win/syswin.inc, Dll_entry: Don't call DoneThread in PROCESS_DETACH callback, it is redundant because the main thread is finalized by FPC_DO_EXIT. SysReleaseThreadVars is still necessary. Also removed redundant assignments to return value.

git-svn-id: trunk@17992 -
2011-07-15 23:57:23 +00:00
sekelsenmat
e21749d6d4 fpvectorial: Finishes fixing the colors in the PostScript reader
git-svn-id: trunk@17991 -
2011-07-15 11:12:51 +00:00
sekelsenmat
d37d0ae1a4 fpvectorial: Fixes some bugs in the PostScript interpreter, previously it didnt run some procedures, and adds more commands to it
git-svn-id: trunk@17990 -
2011-07-15 10:19:21 +00:00
sergei
ae4cdf25f8 + aggas.pas: Write section attributes when long section names are used for smart linking (enabled for win32 and win64). It is needed because GAS does not understand that '.text.something' is part of '.text' and assigns default attributes (writable data) to all such sections, which is not the desired behavior.
git-svn-id: trunk@17989 -
2011-07-13 23:45:28 +00:00
sergei
35a2ed9a6c - Removed unused variable
- Removed inline directive (formal arguments are unsupported and only cause compiler noise)

git-svn-id: trunk@17988 -
2011-07-13 22:14:39 +00:00
joost
b156dc5ad9 * Use new fpmake distclean command. After all targets are cleaned by fpmake distclean, cleanup the fpmake executable
git-svn-id: trunk@17987 -
2011-07-13 21:07:23 +00:00
joost
08ee418513 * Reverted r17969, now fpmake distclean is implemented
git-svn-id: trunk@17986 -
2011-07-13 20:25:02 +00:00
joost
25a9052ced * Implemented distclean command, which cleans up all targets
git-svn-id: trunk@17985 -
2011-07-12 20:45:52 +00:00
sergei
e32317bca4 * Fixed x86_64 compilation further (rev. 17940 was not enough).
git-svn-id: trunk@17983 -
2011-07-12 13:42:27 +00:00
marco
ad60e9a467 * some notes I had in an old checkout.
git-svn-id: trunk@17982 -
2011-07-12 09:50:04 +00:00
marco
d2ccb1f564 * added fpvectorial -> fcl-base -j 2 deps, and regenned packages/ and fpvectorial makefile with up to date fpcmake
fpvectorial makefile had deps on fcl-process instead of fcl-base?

git-svn-id: trunk@17981 -
2011-07-12 09:34:31 +00:00
joost
c0d54a0fb2 * Added fcl-base dependency (epsvectorialreader.pas depends on contnrs)
git-svn-id: trunk@17980 -
2011-07-12 07:31:00 +00:00
marco
1e9733d2d7 * several virtual* and heap* functions checked for 64-bit issues.
git-svn-id: trunk@17979 -
2011-07-11 20:38:37 +00:00
joost
584ac69bff * Several fpmake-file updates
git-svn-id: trunk@17976 -
2011-07-11 19:24:28 +00:00
sergei
02a5efc619 * win/systhrd.inc, clean up:
- removed assembler from SysRelocateThreadVars: never actually worked, and this file is shared between different CPUs - not a proper place for assembler anyway.
- Obtain handle of kernel32.dll using GetModuleHandle, allows to get rid of UnloadLibrary call.

git-svn-id: trunk@17975 -
2011-07-11 17:18:48 +00:00
florian
b0cef1693a * compilation of system unit was broken
git-svn-id: trunk@17972 -
2011-07-10 21:03:55 +00:00
florian
f276177c44 + build atmega128 mcu unit
git-svn-id: trunk@17971 -
2011-07-10 21:03:05 +00:00
florian
4f08d148ea * unique internal errors
git-svn-id: trunk@17970 -
2011-07-10 20:54:48 +00:00
joost
595eadccb6 * Do not cleanup fpmake executable on distclean anymore. To make it possible
to cleanup more than one target using distclean.
 * Added new fpmakeclean target to makefiles which does a cleanall and clears
the fpmake executables

git-svn-id: trunk@17969 -
2011-07-10 14:27:49 +00:00
sergei
6a2e87121b * ogcoff.pas: sort all objsections having '$' in the name, not just .idata$*. This is a documented PECOFF feature and it is required for tls callback stuff to link correctly regardless of the order of declarations in source files.
git-svn-id: trunk@17968 -
2011-07-10 12:24:35 +00:00
joost
eae9ef6529 * Do not mark packages as installed, if they are compiled within this fpmake
git-svn-id: trunk@17967 -
2011-07-10 09:08:59 +00:00
marco
4163c8fb51 * assume callback is cdecl
git-svn-id: trunk@17966 -
2011-07-09 21:34:32 +00:00
joost
28fb5b21a3 * Always add -n when compiling fpmake when not cross-compiling
git-svn-id: trunk@17965 -
2011-07-09 16:08:06 +00:00
Mattias Gaertner
5ca0871033 instantfpc: example for mode directive
git-svn-id: trunk@17964 -
2011-07-09 08:40:27 +00:00
sergei
50952945e1 * Moved WideString-related code, which is identical for Win32 and Win64, into syswin.inc
* Defined HAS_WIDESTRINGMANAGER for Win32 and Win64, this allows to smartlink away part of generic widestring routines.

git-svn-id: trunk@17963 -
2011-07-08 20:07:51 +00:00
pierre
5a2d6c0429 Fix constant pointer reading for 64 bit CPU
git-svn-id: trunk@17962 -
2011-07-08 16:28:24 +00:00
pierre
0ca127b97e * Fix length size for non-short string types
git-svn-id: trunk@17961 -
2011-07-08 16:21:28 +00:00
pierre
f23b265ce1 + Add global testppudump rule
git-svn-id: trunk@17960 -
2011-07-08 16:01:28 +00:00
pierre
efb0193cb2 Add ./utils/ppudump prerequisite to log-ppu files
git-svn-id: trunk@17959 -
2011-07-08 15:57:27 +00:00
pierre
d4372a7ac5 * Add ppudump testing rules
git-svn-id: trunk@17958 -
2011-07-08 15:47:27 +00:00
pierre
b94cdd4881 * Handled real constants of different size
git-svn-id: trunk@17957 -
2011-07-08 15:39:04 +00:00
pierre
322e3f8a16 * More fixes for ppudump use
git-svn-id: trunk@17956 -
2011-07-08 15:38:14 +00:00
pierre
3017132268 * Remove triple sources
git-svn-id: trunk@17955 -
2011-07-08 15:37:23 +00:00
pierre
2f7a57fcab * Use extended for bestreal type if GENERIC_CPU is defined
git-svn-id: trunk@17954 -
2011-07-08 15:36:29 +00:00