This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
gdb-patches RFA: Fix pascal behavior for class fields
- From: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- To: "'Pedro Alves'" <palves at redhat dot com>, "'gdb-patches'" <gdb-patches at sourceware dot org>
- Cc: <gpc at gnu dot de>
- Date: Thu, 8 Jan 2015 15:15:40 +0100
- Subject: gdb-patches RFA: Fix pascal behavior for class fields
- Authentication-results: sourceware.org; auth=none
- References: <54ae4586 dot 01e3440a dot 7b06 dot fffff844SMTPIN_ADDED_BROKEN at mx dot google dot com> <54AE605A dot 8050308 at redhat dot com> <54ae7f9f dot c323460a dot 36ed dot ffffff30SMTPIN_ADDED_BROKEN at mx dot google dot com> <54AE8914 dot 4010507 at redhat dot com>
For gpc mailing list:
this email comes as a follow-up of this bug report
https://sourceware.org/bugzilla/show_bug.cgi?id=17815
The start of the thread can be found at:
https://sourceware.org/ml/gdb-patches/2015-01/msg00164.html
Pedro asked:
> >> How about adding this to the test suite?
> >
> >
> > The whole testsuite/gdb.pascal is almost empty,
> > I never invested time to develop it :(
> >
> > At the time I started it, GPC (the GNU pascal compiler)
> > was still active, but development apparently
> > stopped since quite some time.
> >
> > I am unable to install GPC, which means that I cannot test it.
> > Would a testsuite that supports only Free Pascal be acceptable?
>
> Do you actually mean, whether it's ok for a new
> test (not test suite) to go in untested on GPC? It certainly is.
> Better test on FPC than nowhere. :-)
That is indeed what I meant.
> AFAICS, the tests themselves don't really care which compiler
> is in use other than for marking xfails; you just call
> gdb_compile_pascal,
> and that works with either. That's my impression from quickly
> skimming testsuite/lib/pascal.exp.
The problem is that GPC and Free Pascal support several
pascal 'dialects'. But this requires command line options.
The -Mobjfpc option is required for Free Pascal compiler
to understand class type definition, but is rejected in default mode.
I expect GNU GPC to also reject class in 'normal' mode...
Maybe someone on the gpc mailing list knows if classes are supported
by GPC and if it requires a special compiler option.
Pierre Muller
FYI: Here is the example code that is included in the bug report.
$ cat ~/pas/test/test-class-pascal.pas
type
TA = class
public
x, y : integer;
constructor Create;
function check(b : TA) : boolean;
destructor Done; virtual;
end;
constructor TA.Create;
begin
x:=-1;
y:=-1;
end;
destructor TA.Done;
begin
end;
function TA.check (b : TA) : boolean;
begin
check:=(x < b.x);
end;
var
a, b : TA;
begin
a:=TA.Create;
b:=TA.Create;
a.x := 67;
a.y := 33;
a.check (b);
end.