User Changes Trunk

From Free Pascal wiki
Jump to: navigation, search


About this page

Listed below are intentional changes made to the FPC compiler (trunk) since the previous release that may break existing code. The list includes reasons why these changes have been implemented, and suggestions for how you might adapt your code if you find that previously working code has been adversely affected by these recent changes.

The list of new features that do not break existing code can be found here.

Please add revision numbers to the entries from now on. This facilitates moving merged items to the user changes of a release.

All systems

Language Changes

Visibility of generic type parameters

  • Old behaviour: Type parameters of generics had public visibility.
  • New behaviour: Type parameters of generics now have strict private visibility.
  • Reason: With the previous visibility it was possible to create code that leads to infinite loops during compilation or other hard to debug errors. In addition there is no real possibility to work around this issue (for an example see this bug report). Also the fix is Delphi compatible.
  • Remedy: Declare a type alias for the type parameter with the desired visibility.
  • Example: In the following example T is declared as strict private, while TAlias is declared as public and thus can be used as before the change.
  generic TTest<T> = class
  public type
    TAlias = T;

Parsing of specialize has been changed

  • Old behaviour: specialize was used to initialize a specialization and was followed by a type name that might contain a unit name and parent types.
  • New behaviour: specialize is now considered part of the specialized type, just as generic is. This means that unit names and parent types need to be used before the part containing the specialize.
  • Reason: This allows for a more logical usage of specialize in context with nested types (especially if multiple specializations are involved) and more importantly generic functions and methods.
  • Remedy: Put the specialize directly in front of the type which needs to be specialized.

Unit changes


Darwin platforms

Default assembler for Darwin/i386/x86_64/ARM and iPhoneSimulator/i386/x86_64

  • Old behaviour: The default assembler for these platforms was the as binary.
  • New behaviour: The default assembler for these platforms now is the clang binary.
  • Reason: Xcode 7 no longer includes the old assembler, and the as binary now simply invokes clang. Additionally, Xcode 7 now requires the compiler to specify the OS variant (OS X, iOS) and version to the assembler, which was not possible with the as binary that shipped with older Xcode versions. In order to disambiguate between an assembler that does and that does not support these options, we now explicitly invoke clang with these options.
  • Remedy: If you have an older version of Xcode and wish to use the old assembler, you can use the -Aas-darwin command line option.
  • svn: r31830

Default debug format for Darwin/i386

  • Old behaviour: The default debug format for Darwin/i386 was Stabs.
  • New behaviour: The default debug format for Darwin/i386 is DWARF 2.
  • Reason: The assembler included with Xcode 7 and later no longer supports Stabs.
  • Remedy: If you have an older version of Xcode and wish to use Stabs, you can use -Aas-darwin -gs to force the use of the old assembler in combination with Stabs.
  • svn: r31774

Linux/Android platforms

GNU Binutils 2.19.1 or later are required by default

  • Old behaviour: The compiler invocation of the linker always resulted in a warning stating "did you forget -T?"
  • New behaviour: The compiler now uses a different way to invoke the linker, which prevents this warning, but this requires functionality that is only available in GNU Binutils 2.19 and later.
  • Reason: Get rid of the linker warning, which was caused by the fact that we used the linker in an unsupported way (and which hence occasionally caused issues).
  • Remedy: If you have a system with an older version of GNU Binutils, you can use the new -X9 command line parameter to make the compiler revert to the old behaviour. You will not be able to (easily) bootstrap the new version of FPC on such a system though, so use another system with a more up-to-date version of GNU Binutils for that.

i386 platforms

-Ooasmcse/{$optimization asmcse} has been removed

  • Old behaviour: The compiler contained an assembler common subexpression elimination pass for the i386 platform.
  • New behaviour: This optimisation pass has been removed from the compiler.
  • Reason: That pass has been disabled by default since several releases because it hadn't been maintained, and it generated buggy code when combined with newer optimisation passes.
  • Remedy: Don't use -Ooasmcse/{$optimization asmcse} anymore.

Previous release notes

Personal tools