Commit Graph

38323 Commits

Author SHA1 Message Date
Jonas Maebe
a3c936fe5f + rawbytestring/unicodestring overloads for FileCreate and FileOpen.
The WinCE implementation converts the rawbytestring arguments to
    unicodestring and calls unicode OS APIs, while the others convert
    unicodestring arguments to DefaultFileSystemCodePage and call
    single byte OS APIs
  + test for the above

git-svn-id: branches/cpstrrtl@22467 -
2012-09-27 07:54:25 +00:00
Jonas Maebe
598d2feeb6 + rtldefs.inc file for every target that contains defines shared by multiple
RTL units. Comes with a FPCRTL_FILESYSTEM_UTF8 define that can be
    activated for targets whose single byte filesystem interface enforces
    UTF-8; included in inc/systemh.inc and unix/cwstring.pp until now
  + DefaultFileSystemCodePage variable that holds the code page used for
    communicating with the OS single byte file system APIs, and for the
    strings returned by those same APIs. Initialized with
   o the result of GetACP in the system unit of Windows platforms, except for
     WinCE which uses UTF-8 since its file system OS API calls already use
     the UTF-16 versions
   o CP_UTF8 on Unix platforms with FPCRTL_FILESYSTEM_UTF8 defined, and with
     DefaultSystemCodePage on other Unix platforms
   o DefaultSystemCodePage on Java/Android JVM targets
  + DefaultRTLFileSystemCodePage variable that holds the code page used to
    encode strings returned by RTL routines that return filenames obtained
    from OS API calls. By default the same as DefaultFileSystemCodePage on
    all platforms. Separate from DefaultFileSystemCodePage for clarity on
    platforms that may use either utf-16 or single byte OS API calls to
    send/receive file names (such as most Windows platforms)
  + new scpFileSystemSingleByte enum that can be passed to
    GetStandardCodePage() to get the default code page for OS single byte file
    system APIs, with implementations for Unix and Windows
  + SetMultiByteFileSystemCodePage() procedure to override the value of
    DefaultFileSystemCodePage

  In principle, in the long run unchanged programs only using generic
  ansistrings and unicodestrings should (mostly) behave the same as in
  FPC 2.6.0 as far as RTL-level file system APIs are concerned if
  they set DefaultFileSystemCodePage and DefaultRTLFileSystemCodePage
  to DefaultSystemCodePage at the start of their execution

git-svn-id: branches/cpstrrtl@22466 -
2012-09-27 07:54:06 +00:00
Jonas Maebe
f8c927e396 + branch for making the RTL work properly with the codepage-aware
ansistrings, and for adding in some unicodestring support at the same time
    (unless in the end only a unicodestring RTL is supported, all the work is
     necessary in any case and everything can still be moved around later if
     required)

git-svn-id: branches/cpstrrtl@22465 -
2012-09-26 22:09:35 +00:00
Jonas Maebe
92064356f0 * prevent code page conversion in CharInSet(widechar,tsyscharset)
git-svn-id: trunk@22464 -
2012-09-26 20:46:19 +00:00
Jonas Maebe
91d92c4732 * make ansistring unique when changing the code page without conversion
(like on other platforms)

git-svn-id: trunk@22463 -
2012-09-26 19:48:37 +00:00
svenbarth
54c1e638ad Fix for Mantis #22428.
* pgenutil.pas, generate_specialization:
  * return a generrordef instead of Nil when returning because of an error
  * always check "genname" for a generic count string as a mode ObjFPC generic specialized in a mode Delphi unit will already contain a "$X" suffix and only symname will be set.
+ add (corrected) test

git-svn-id: trunk@22462 -
2012-09-26 15:03:37 +00:00
Jonas Maebe
e3b97d99c6 * fixed memory leaks in case a TP-style object inherits from another object
type that contains managed types, but this child doesn't contain any
    managed type itself (since r16632, the parent should be considered as a
    field of the child in terms of needing initialization/finalization)

git-svn-id: trunk@22461 -
2012-09-26 14:26:00 +00:00
michael
2cd78c03b3 * Fix for bug ID #0022986
git-svn-id: trunk@22460 -
2012-09-26 14:17:31 +00:00
Jonas Maebe
10d4b8e66f * added "HaltOnNotReleased:=true;" so test exits with an error if not all
memory is released

git-svn-id: trunk@22459 -
2012-09-26 14:16:19 +00:00
pierre
cb123a6376 * Fix compilation for targets without process unit
git-svn-id: trunk@22458 -
2012-09-26 11:48:15 +00:00
florian
46bf1823b8 * fixed/cleaned up lazarus project file
git-svn-id: trunk@22457 -
2012-09-25 18:53:11 +00:00
svenbarth
e04fae2c67 Remove commented variables which strangely weren't detected by a "make cycle"...
git-svn-id: trunk@22456 -
2012-09-25 11:52:10 +00:00
svenbarth
582f1d04b8 Added %NORUN flag.
git-svn-id: trunk@22455 -
2012-09-25 10:27:34 +00:00
svenbarth
2414c55ca0 Fix for Mantis #21538.
* defcmp.pas, compare_defs_ext: 
  use the new genericparas list to check whether two specializations of the same generic can be considered equal
+ added test

git-svn-id: trunk@22454 -
2012-09-25 10:25:30 +00:00
svenbarth
03493a4d31 Added tests for now fixed Mantis #22427.
git-svn-id: trunk@22453 -
2012-09-25 10:10:28 +00:00
svenbarth
88af293155 Fix for Mantis #22160
The cause of the internal error was the following:
We have a generic in an unit ("A") which uses another unit ("B") in the implementation section and this other unit uses unit A in the interface section. Now the generic is specialized in the interface section of B. This leads to the problem that in unit A when it tries to load the globalsymtable of unit B that globalsymtable will be Nil, because parsing of the interface section is not yet finished. Thus the change in pgenutil.pas, specialization_init: if the unit is still "in_interface" the localsymtable needs to be used instead of the globalsymtable.

This doesn't necessarily lead to a compiling test though, as there is the following possibility:
Unit A contains a generic class/record (with methods) and uses unit B in the implementation section. This unit B also contains a generic class/record (with methods) and uses unit A in the implementation section. Both units contain a specialization of the other unit's generic outside of it's own generics (such that generate_specialization is fully triggered). Let's assume compilation starts with unit A and we reach the uses of unit B. Now compilation switches to unit B and completes as unit A is already registered and in compilation. The problem now is that the generic in unit A still contains unresolved forward declarations as the implementation section of A was not yet parsed which will lead to "forward declaration not solved" errors (Note: Delphi compiles this).

The solution to this is the following: if a generic is specialized from another unit which is not in state ms_compiled then the unit of the specialization needs to wait for the unit of the generic. So the specialization's unit adds itself into a list of waiting units of the generic's unit. Now inside "proc_unit" we need to check whether this module is waiting for other modules and if so avoid "finishing" the unit (which means generating the methods of the specialization, generating assembler code and ultimately freeing the scanner and PPU). Now when the generic's unit finishes we need to check whether other modules are waiting for it and finish them (of course it's a bit more complicated in reality, but that pretty much sums it up).

+ globstat.pas: Added an unit which handles the saving and restoring of the global state which was originally inside "parser.pas, compile" so that Don't Repeat Yourself (DRY) is respected.
* fmodule.pas, tmodule: 
  + add fields to keep track of the units the module is waiting for and which modules are waiting for the module
  + add field for the saved global state (raw pointer to avoid circles)
  + add field for the state which is needed to finish the unit (raw pointer to avoid circles)
  + move the code which was used in "parser.pas, compile" after a module was successfully compiled to the new virtual method "end_of_parsing"
+ fppu.pas, tppumodule.end_of_parsing:
  free the ppufile here
* pgenutil.pas:
  + add new procedure "maybe_add_waiting_unit" which adds the specialization's unit to the waiting list of the generic if that unit is not yet compiled
  * generate_specialization: call the new function when we add a new (true) specialization
  * specialization_init: instead of not adding implementation units at all check whether the unit is still parsing the interface section and add the localsymtable in that case
* pmodules.pas:
  * change "proc_unit" to a function which returns "true" if the unit was already finished (no need to wait for other units)
  + move the code from "proc_unit" from "generate_specialization_procs" on to a new procedure "finish_unit" which
  * this procedure is either called immediately in "proc_unit" if the unit does not need to wait for other units or from "finish_unit" itself if a unit that is waiting for the given unit does no longer wait for another module (special care is taken in proc_unit to avoid circles)
* parser.pas, compile:
  * correctly handle the case if an unit is not finished
  * use the new global state functionality from globstat.pas
  * pay special attention when calling "set_current_module" (see comment at that call)

+ add tests from 22160
+ add test for above mentioned "diamond" case

git-svn-id: trunk@22452 -
2012-09-25 09:45:25 +00:00
pierre
d01ec10f45 Fix tw22326 for mips CPU
git-svn-id: trunk@22451 -
2012-09-24 22:28:54 +00:00
pierre
15f4e1279b Add RS_GP to list of saved registers if pi_needs_got flag is set
git-svn-id: trunk@22450 -
2012-09-24 21:01:47 +00:00
pierre
5b5a5ab7af + Add EXTDEBUG warning if pi_needs_got was not set in pass_1
git-svn-id: trunk@22449 -
2012-09-24 15:54:59 +00:00
pierre
bc04e83b25 Add pi_needs_got to current_procinfo.flags in pass_1 method if a label reference is used
git-svn-id: trunk@22448 -
2012-09-24 15:39:26 +00:00
michael
cd733daaa4 * Take care of locking when reading a file.
git-svn-id: trunk@22447 -
2012-09-24 09:00:52 +00:00
Jonas Maebe
944c1172ee * implementation of fix from r22376 without using introspection
git-svn-id: trunk@22446 -
2012-09-23 21:25:39 +00:00
Jonas Maebe
1a97e61619 * factored out fixref from handle_load_store, and handle indirect symbol
loads for darwin in fixref (used to be done in ncgld, but was removed
    there)

git-svn-id: trunk@22445 -
2012-09-23 21:25:32 +00:00
tom_at_work
71059475f8 GParMake also needs to get passed to allow completion of testsuite when some compilation options are incompatible to the default ones
git-svn-id: trunk@22438 -
2012-09-22 12:54:35 +00:00
Jonas Maebe
dc5c318eeb * fixed compilation with -dTEST_WIN64_SEH after r22433 based on patch by
Cyrax, mantis #22952)

git-svn-id: trunk@22437 -
2012-09-22 12:41:31 +00:00
Jonas Maebe
6402714780 - reverted r22363 (disabling of multi-threaded compilation), didn't notice
the issue had been fixed in r22353

git-svn-id: trunk@22435 -
2012-09-21 22:42:35 +00:00
Jonas Maebe
5ea03973d3 * reject assignments to vecn[rangen] (mantis #22941)
git-svn-id: trunk@22434 -
2012-09-21 22:42:30 +00:00
florian
ca5fabda6d * cleanup some unused units from uses clauses
git-svn-id: trunk@22433 -
2012-09-21 18:53:46 +00:00
Jonas Maebe
6f2c567e37 * don't write '.section' twice for stubs on Darwin/ARM
git-svn-id: trunk@22432 -
2012-09-21 16:28:43 +00:00
pierre
ad45f8be0b Regenerated after: avoid troubles if svnversion is found twice in SEARCHPATH
git-svn-id: trunk@22431 -
2012-09-21 14:32:57 +00:00
pierre
0dc69d5b3e Avoid troubles if svnversion is found twice in SEARCHPATH
git-svn-id: trunk@22430 -
2012-09-21 14:32:33 +00:00
tom_at_work
beca39448a Forgot to add current compiler options to fpmkunit compilation. This leads to the error described in r22397 when e.g. building with -Cfvfpv3 on arm/linux
git-svn-id: trunk@22429 -
2012-09-21 12:13:50 +00:00
paul
88a10330c2 rtl: initialize DefaultSystemCodePage on aix,beos,haiku,solaris
git-svn-id: trunk@22428 -
2012-09-21 01:45:18 +00:00
marco
1dbde17516 * fix some of the overloads for -A and -W routines.
git-svn-id: trunk@22427 -
2012-09-20 16:56:28 +00:00
svenbarth
759bd33327 Use the ccharset unit instead of charset when compiling with 2.6.0 like is done for the other cp* units.
git-svn-id: trunk@22426 -
2012-09-19 13:56:25 +00:00
pierre
1550c623c3 Avoid memory leak in isbinaryoverloaded function
git-svn-id: trunk@22425 -
2012-09-19 07:59:12 +00:00
pierre
0d00df6ec5 * Only -dextheaptrc sets keepreleased to tue (meaning no memory is really released by heaptrc memory manager)
* -dheaptrc add heaptrc as first unit in main source.

git-svn-id: trunk@22424 -
2012-09-19 07:57:31 +00:00
pierre
4f810f0918 free final_asmnode if not used to avoid memory leak
git-svn-id: trunk@22423 -
2012-09-19 07:25:29 +00:00
pierre
de2543f2bd Allow compilation of ppudump with -dHEAPTRC command line option
git-svn-id: trunk@22422 -
2012-09-19 07:08:35 +00:00
florian
e2e4634295 - remove maps with unclear header
git-svn-id: trunk@22421 -
2012-09-18 18:46:23 +00:00
paul
32fc7118d4 compiler: add US-ASCII codepage
git-svn-id: trunk@22419 -
2012-09-18 01:32:24 +00:00
paul
a2548fc9f9 rtl: pass exact size to delete instead of full string length
git-svn-id: trunk@22418 -
2012-09-18 00:31:21 +00:00
Jonas Maebe
a13c9d93ff * create new object file when creating new section for ansistring/
unicodestring constants so they can be smartlinked away on
    platforms using library-based smartlinking (mantis #22888)

git-svn-id: trunk@22417 -
2012-09-17 22:30:16 +00:00
tom_at_work
f5ddc02a5c + add debian armel library search path
+ for armhf, use the more canonical ld-linux-armhf.so.3 as defdynlinker

git-svn-id: trunk@22416 -
2012-09-17 21:13:37 +00:00
Jonas Maebe
8799d9d204 * don't create temporary ansistrings with codepage DefaultSystemCodePage
when concatenating or comparing CP_ACP strings, because the ansistring
    conversion helpers also check for CP_ACP and do the right thing in
    that case
  * don't convert code pages when comparing CP_ACP strings with
    DefaultSystemCodePage strings (mantis #22906)

git-svn-id: trunk@22415 -
2012-09-17 19:41:44 +00:00
Jonas Maebe
64740049bf * fix for mantis #22796: add alignment padding to records before inserting
hidden parameters while parsing the interface, because they may depend on
    the padded size (since the size was not yet padded in the interface and
    padded in the implementation, this could result in differences)

git-svn-id: trunk@22414 -
2012-09-17 14:34:03 +00:00
Jonas Maebe
349a682596 * corrected license header from GPL to LGPL + static linking exception like
the rest of the FPC RTL, after confirming with the original author that
    this is ok (mantis #22879)

git-svn-id: trunk@22413 -
2012-09-17 12:12:42 +00:00
Jonas Maebe
44fa475fe4 * fixed -dTEST_WIN64_SEH after r22337 (mantis #22885)
git-svn-id: trunk@22412 -
2012-09-17 11:22:18 +00:00
paul
f338d5c338 rtl: set DefaultSystemCodePage on linux without cwstrings
git-svn-id: trunk@22411 -
2012-09-17 08:31:37 +00:00
paul
d7d8c10aaf bsd: set DefaultSystemCodePage without cwstring.pas
git-svn-id: trunk@22410 -
2012-09-17 02:33:06 +00:00