I've uploaded a new alpha to http://www.gnu-pascal.de/alpha/
You will hate this release ... at least if you make heavy use of external declarations or other directives. We all knew that some backward-incompatible changes in this area would have to be made, now that's happened. PLEASE READ THE NOTES BELOW FOR DETAILS.
Changes that affect building GPC: =================================
- Dwarf2 debug info (the default under Linux and many other systems with gcc-3) finally works. This means you can now build GPC with gcc-3 without `-g0' or `-gstabs'.
- Building GPC no more requires gperf (those who maintain build dependencies please note this).
- Besides the source distributions as before, there is now also a "minimal" distribution. This is compressed with bzip2 instead of gzip and does not contain any generated files. These files will be generated automatically when building GPC, but you need some additional tools installed:
bzip2, bash, *GNU* sed, GNU awk, GNU m4, bison, flex, autoconf, help2man, makeinfo (at least version 4.1).
Other changes: ==============
- Forward referencing pointers generate proper debug info now.
- Discriminant identifiers are allowed as variant record selectors.
- `export Foo = all (...)' (fjf811*.pas)
- Delphi-compatible `initialization', `finalization' (chief43*.pas)
- Type-casts are BP compatible now, in particular, value type-casts between ordinal and real or complex types don't work anymore.
- All non-ISO-7185 keywords can be used as identifiers (with two small exceptions). (fjf440.pas)
- `pack-struct' does not imply bit-level packing anymore (only explicit `packed' records and arrays do).
- New options `--[no-]ignore-packed' (`--ignore-packed' is the default in BP mode). (fjf796*.pas)
- New option `--maximum-field-alignment=N'
- `{$[no-]pack-struct}' as a compiler directive
- New options `-W[no-]local-external' (implied by `-Wall')
- New options `--vax-pascal', `--mac-pascal'
- Mac Pascal directives `definec', `macro', `undefc', `ifc', `ifoptc', `elsec', `elifc', `endc', `errorc'
- Units without `implementation' part
- When passing a schema variable as an untyped argument, the whole schema, including the discriminants is passed. (fjf798.pas)
- `TimeZone' in `TimeStamp' counts seconds *east* of UTC now (not west, as before). (datetimedemo.pas)
- Some bug fixes related to operator overloading.
- Variables declared in interfaces of modules are now initialized (capacity of strings etc.). (daj3.pas, sven14c.pas, nick1.pas)
- Various other bug fixes.
Directives and attributes: ==========================
- `external name' works (BP compatible). So
procedure Foo; external; asmname 'bar';
or (equivalent previously)
procedure Foo; asmname 'bar';
can be changed to
procedure Foo; external name 'bar';
GPC also accepts
procedure Foo; external 'libname' name 'bar';
but ignores 'libname'. It could be supported via automake, but since automake is to be replaced by gp, anyway, it seems pointless to do it now.
- `name' works as an attribute.
- `attribute's with single parameters can be written with `=', so
attribute (name ('foo'))
and
attribute (name = 'foo')
are equivalent.
- Linker names (whether by `external name' or as an `attribute') can be string constant expressions now (e.g., involving declared string constants and `+'). The same applies to module/unit file names specified with `in'.
- `asmname' is deprecated (and will be dropped in a future version).
* External `asmname' constructions can be changed as shown above.
* In a unit interface, change
procedure Foo; asmname 'bar';
to
procedure Foo; external name 'bar';
*if* the routine is really external (e.g. implemented in a C file or library); otherwise to
procedure Foo; attribute (name = 'bar');
(previously, GPC didn't care, but now you have to distinguish these cases).
- `external' without an asmname (whether by `external name' or as an `attribute') defaults to all-lowercase linker names now. GPC will give a warning now (because of the change). This warning will disappear in the future (but the change will remain in effect, of course).
Routines without `external' or asmname still use first-uppercase linker names, for those who care. But it's not recommended to rely on this.
So change
procedure Foo; external;
to
procedure Foo; external name 'Foo';
(or change the corresponding C code to `foo' if that's under your control).
- All of the above applies to variables as well.
- `c', `c_language' are also deprecated. Instead of
procedure Foo; c;
or
procedure Foo; c_language;
write
procedure Foo; external;
(if you don't mind the warning for now), or
procedure Foo; external name 'foo';
(if you prefer to make the linker name more explicit).
- `static', `volatile' and `register' for variables are no prefix directives anymore, but attributes. E.g.
var Foo: static Integer;
becomes
var Foo: Integer; attribute (static);
- Same for `inline' with routines.
inline procedure Foo;
becomes
procedure Foo; attribute (inline);
- A new attribute `const' for variables (really read-only -- unlike BP's "typed constants", and also applicable to external variables).
- `attribute' for routines doesn't imply `forward' anymore, so you don't have to declare routines twice in a program or implementation part when setting the linker name or some other attribute. E.g.
procedure Foo; attribute (noreturn); { forward; -- ignored here before } procedure Foo; begin Halt end;
becomes:
procedure Foo; attribute (noreturn); begin Halt end;
A final example:
procedure Foo; asmname 'bar'; attribute (noreturn); procedure Foo; begin Halt end;
becomes:
procedure Foo; attribute (noreturn, name = 'bar'); begin Halt end;
Frank