Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2014-10

CodeTools error when using 'section' keyword

8 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Ring
program hello;
const
   devcfg3: longWord = DEVCFG3_DEFAULT; section '.devcfg3';
begin
end.

is a program that compiles fine but gives me an error in lazarus when I try to use completion with ctrl-SPACE.

hello.pas(3,48) Error: = erwartet aber '.devcfg3' gefunden

Can I disable codetools for this const definition or is it possible to get a fix for this issue in trunk of lazarus?

Thank you,

Michael

Reply by email

Mattias Gaertner
to Michael Ring
Show quoted text 15 lines
Michael Ring hat am 21. Oktober 2014 um 22:36 geschrieben: program hello; const devcfg3: longWord = DEVCFG3_DEFAULT; section '.devcfg3'; begin end. is a program that compiles fine but gives me an error in lazarus when I try to use completion with ctrl-SPACE. hello.pas(3,48) Error: = erwartet aber '.devcfg3' gefunden

fpc 2.6.4 gives the same error.
When is "section" allowed?

Can I disable codetools for this const definition or is it possible to get a fix for this issue in trunk of lazarus?

I will add it, but I need to know the syntax and when it is allowed.

Mattias

Reply by email

Sven Barth
to Mattias Gaertner
"Mattias Gaertner" wrote 21 lines
> Michael Ring hat am 21. Oktober 2014 um 22:36 > geschrieben: > > > program hello; > const > devcfg3: longWord = DEVCFG3_DEFAULT; section '.devcfg3'; > begin > end. > > is a program that compiles fine but gives me an error in lazarus when I > try to use completion with ctrl-SPACE. > > > hello.pas(3,48) Error: = erwartet aber '.devcfg3' gefunden fpc 2.6.4 gives the same error. When is "section" allowed?

It only works on certain targets (currently only Embedded AFAIK). I don't know its rules of declarations currently though...

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20141022/73b964a3/attachment.html>

Reply by email

Michael Ring
to Sven Barth

I did a little digging, Sven is right, this is only for embedded targets; I found the following in systems.pas:

{ all embedded systems }
systems_embedded = [system_i386_embedded,system_m68k_embedded, system_alpha_embedded,system_powerpc_embedded,
system_sparc_embedded,system_vm_embedded,
system_iA64_embedded,system_x86_64_embedded,
system_mips_embedded,system_arm_embedded,
system_powerpc64_embedded,system_avr_embedded,
system_jvm_java32,system_mipseb_embedded,system_mipsel_embedded];

        { all systems that allow section directive }
        systems_allow_section = systems_embedded;

I found the first occurence of this in the sources of fpc 2.4.0

Michael

Sven Barth wrote 40 lines
Am 21.10.2014 23:32 schrieb "Mattias Gaertner" < <mailto:>>: > > > > > Michael Ring < <mailto:>> hat am 21. Oktober 2014 um 22:36 > > geschrieben: > > > > > > program hello; > > const > > devcfg3: longWord = DEVCFG3_DEFAULT; section '.devcfg3'; > > begin > > end. > > > > is a program that compiles fine but gives me an error in lazarus when I > > try to use completion with ctrl-SPACE. > > > > > > hello.pas(3,48) Error: = erwartet aber '.devcfg3' gefunden > > fpc 2.6.4 gives the same error. > When is "section" allowed? It only works on certain targets (currently only Embedded AFAIK). I don't know its rules of declarations currently though... Regards, Sven -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20141022/21aa9b2a/attachment.html>

Reply by email

Mattias Gaertner
to Michael Ring
Show quoted text 20 lines
Michael Ring hat am 22. Oktober 2014 um 09:38 geschrieben: I did a little digging, Sven is right, this is only for embedded targets; I found the following in systems.pas: ?????? { all embedded systems } ?????? systems_embedded = [system_i386_embedded,system_m68k_embedded, ?????????????????????????? system_alpha_embedded,system_powerpc_embedded, ?????????????????????????? system_sparc_embedded,system_vm_embedded, ?????????????????????????? system_iA64_embedded,system_x86_64_embedded, ?????????????????????????? system_mips_embedded,system_arm_embedded, ?????????????????????????? system_powerpc64_embedded,system_avr_embedded, ?????????????????????????? system_jvm_java32,system_mipseb_embedded,system_mipsel_embedded]; ?????? { all systems that allow section directive } ?????? systems_allow_section = systems_embedded; I found the first occurence of this in the sources of fpc 2.4.0

Thanks. I added it. Please test.

Mattias

Reply by email

Michael Ring
to Mattias Gaertner

Unfortunately the fix does not work for me. I still get the same error message

I added some debugging:

   //if UpAtomIs('EXTERNAL') then
   //  debugln(['TPascalParserTool.ReadVariableType
',CurNode.Parent.Parent.DescAsString,' ',CurNode.Parent.DescAsString,'
',CurNode.DescAsString]);
   //if UpAtomIs('SECTION') then
     debugln(['TPascalParserTool.ReadVariableType
',CurNode.Parent.Parent.DescAsString,' ',CurNode.Parent.DescAsString,'
',CurNode.DescAsString]);

when the 'if' line is uncommented I do not get any output.

when it's commented out I see :

TPascalParserTool.ReadVariableType Interface Section Var Section Var popping up several times.

This is my test program:

program hello;
const
   DEVCFG3_DEFAULT=1;
const
   devcfg3: longWord = DEVCFG3_DEFAULT; section '.devcfg3';
   devcfg2: longWord = DEVCFG3_DEFAULT; section '.devcfg2';
begin
end.
Mattias Gaertner wrote 29 lines
> Michael Ring hat am 22. Oktober 2014 um 09:38 > geschrieben: > > I did a little digging, Sven is right, this is only for embedded targets; I > found the following in systems.pas: > > { all embedded systems } > systems_embedded = [system_i386_embedded,system_m68k_embedded, > system_alpha_embedded,system_powerpc_embedded, > system_sparc_embedded,system_vm_embedded, > system_iA64_embedded,system_x86_64_embedded, > system_mips_embedded,system_arm_embedded, > system_powerpc64_embedded,system_avr_embedded, > > system_jvm_java32,system_mipseb_embedded,system_mipsel_embedded]; > > { all systems that allow section directive } > systems_allow_section = systems_embedded; > > I found the first occurence of this in the sources of fpc 2.4.0 Thanks. I added it. Please test. Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Mattias Gaertner
to Michael Ring
Show quoted text 9 lines
[...] This is my test program: program hello; const DEVCFG3_DEFAULT=1; const devcfg3: longWord = DEVCFG3_DEFAULT; section '.devcfg3'; devcfg2: longWord = DEVCFG3_DEFAULT; section '.devcfg2';

Fixed. Please test.

Mattias

Reply by email

Michael Ring
to Mattias Gaertner

Works fine now, thank you very much for the fix!

Michael

Mattias Gaertner wrote 21 lines
On Thu, 23 Oct 2014 21:57:28 +0200 Michael Ring wrote: > [...] > This is my test program: > > program hello; > const > DEVCFG3_DEFAULT=1; > const > devcfg3: longWord = DEVCFG3_DEFAULT; section '.devcfg3'; > devcfg2: longWord = DEVCFG3_DEFAULT; section '.devcfg2'; Fixed. Please test. Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email