Re: gdb-patches RFA: Fix pascal behavior for class fields

Pedro Alves <[email protected]>
Newsgroups gmane.comp.gdb.patches,gmane.comp.compilers.gpc
Message-ID <[email protected]>
On 01/08/2015 02:15 PM, Pierre Muller wrote:
> 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.

I'd suggest adding support for a new option to
gdb_compile_pascal, like "objfpc", so you'd compile
the test with:

 if {[gdb_compile_pascal ... executable [list debug objfpc]] != "" } {
     untested $testfile.exp
     return -1
 }

You'd teach fpc_compile about the new option:

proc fpc_compile {source dest type options} {
...
    foreach i $options {
...
        } elseif { $i == "objfpc" } {
           append add_flags " -Mobjfpc"
        }
...
    }


Someone that cares about testing with GNU GPC would then
do the equivalent to gpc_compile, if anything is necessary.
If gpc simply fails to compile the test, it's no biggie,
as gdb_compile_pascal returns false, and the test is
skipped with "untested".

There may be a more generic and common name for the mode,
like "obj-pascal" or something, but I wouldn't know.

Thanks,
Pedro Alves
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.