gdb-patches RFA: Fix pascal behavior for class fields

"Pierre Muller" <[email protected]>
Newsgroups gmane.comp.compilers.gpc
Message-ID <[email protected]>
For gpc mailing list:

this email comes as a follow-up of this bug report

 <https://sourceware.org/bugzilla/show_bug.cgi?id=17815>
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>
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.

_______________________________________________
Gpc mailing list
[email protected]
https://www.g-n-u.de/mailman/listinfo/gpc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.