[Lazarus] semaphore

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Feb 17 11:39:13 CET 2012


On Fri, 17 Feb 2012 11:15:28 +0100
Sven Barth <pascaldragon at googlemail.com> wrote:

> Am 17.02.2012 11:00, schrieb Mattias Gaertner:
> > On Fri, 17 Feb 2012 10:21:50 +0100
> > Antonio Fortuny<a.fortuny at sitasoftware.lu>  wrote:
> >
> >> Hi again.
> >>
> >> I've a problem with IDE (0.9.31 2011/12/05 Linux OpenSuse 12.1, FPC
> >> 2.4.4, GTK-2:
> >> when double-click on the event name of a TButton in the object inspector
> >> trying to generate the procedure event code, the unit "ipc" is open and
> >> the error "/usr/share/fpcsrc/rtl/unix/ipc.pp(119,9) Error: expected
> >> end., but seq found" is displayed in the errors window
> >> Same behaviour when hitting Ctrl+Space to end the code for a variable
> >>
> >> This is the code snippet from ipc.pp tagged by the IDE
> >> 105     {$if not defined(linux_ipc32) and not defined(FPC_USE_LIBC)}
> >>               TIPC_Perm = record
> >>                   key   : TKey;
> >>                   uid   : kernel_uid_t;
> >>                   gid   : kernel_gid_t;
> >>                   cuid  : kernel_uid_t;
> >>                   cgid  : kernel_gid_t;
> >>                   mode  : kernel_mode_t;
> >>               {$if sizeof(kernel_mode_t)<  4}
> >> [114]            __pad1    : array[1..4-sizeof(mode_t)];
> >>               {$endif}
> >>               {$ifdef cpupowerpc}
> >>                       seq       : cuint;
> >>               {$else}
> >> [119]            seq       : cushort;
> >>               {$endif}
> >>                   __pad2    : cushort;
> >>                   __unused1 : culong;
> >>                   __unused2 : culong;
> >>             End;
> >>
> >> Beside of this the IDE works well and compiled programs run as expected.
> >> But this really annoying. :-$
> >
> > Array without type?
> > It's always amazing to find out what fpc supports.
> >
> > svn trunk can now parse it.
> 
> I somehow doubt this. It seems more like the condition there is never 
> true and thus the omition was never noticed. At least according to the 
> compiler's code there MUST be a "of" after an array. So it might have 
> been better to investigate why "sizeof(kernel_mode_t) < 4" is evaluated 
> to true by the IDE.

kernel_mode_t is defined in another unit.
The size_of requires parsing like a compiler, that means reading all
ppu files first and resolving every type on its way. And it requires
implementation details of the compiler.
I guess only the compiler can reliably resolve size_of.
Same for declared.

Maybe some heuristics and/or defines can be added to help codetools
parsing such $IFs.

Mattias




More information about the Lazarus mailing list