summaryrefslogtreecommitdiff
path: root/compiler/pdecvar.pas
diff options
context:
space:
mode:
authorflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2011-04-10 19:20:48 +0000
committerflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2011-04-10 19:20:48 +0000
commit160cc1e115eeb75638dce6effdd16b2bc810ddb4 (patch)
treeb791a95695a7cf674e61a6153139c6f9c6c491fa /compiler/pdecvar.pas
parent3843727e74b31bbf2a34e7e3b89ee422269f770e (diff)
parent413a6aa6469e6c297780217a27ca91363c637944 (diff)
downloadfpc-avr.tar.gz
* rebase to trunk@17295avr
git-svn-id: http://svn.freepascal.org/svn/fpc/branches/avr@17296 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/pdecvar.pas')
-rw-r--r--compiler/pdecvar.pas30
1 files changed, 30 insertions, 0 deletions
diff --git a/compiler/pdecvar.pas b/compiler/pdecvar.pas
index b085d60fa4..259ca0c45d 100644
--- a/compiler/pdecvar.pas
+++ b/compiler/pdecvar.pas
@@ -1041,6 +1041,17 @@ implementation
end;
+ procedure try_consume_sectiondirective(var asection: ansistring);
+ begin
+ if idtoken=_SECTION then
+ begin
+ consume(_ID);
+ asection:=get_stringconst;
+ consume(_SEMICOLON);
+ end;
+ end;
+
+
procedure read_var_decls(options:Tvar_dec_options);
procedure read_default_value(sc : TFPObjectList);
@@ -1253,6 +1264,7 @@ implementation
hintsymoptions : tsymoptions;
deprecatedmsg : pshortstring;
old_block_type : tblock_type;
+ section : ansistring;
begin
old_block_type:=block_type;
block_type:=bt_var;
@@ -1394,6 +1406,24 @@ implementation
) then
read_public_and_external_sc(sc);
+ { try to parse a section directive }
+ if (target_info.system in systems_embedded) and (idtoken=_SECTION) then
+ begin
+ try_consume_sectiondirective(section);
+ if section<>'' then
+ begin
+ for i:=0 to sc.count-1 do
+ begin
+ vs:=tabstractvarsym(sc[i]);
+ if (vs.varoptions *[vo_is_external,vo_is_weak_external])<>[] then
+ Message(parser_e_externals_no_section);
+ if vs.typ<>staticvarsym then
+ Message(parser_e_section_no_locals);
+ tstaticvarsym(vs).section:=section;
+ end;
+ end;
+ end;
+
{ allocate normal variable (non-external and non-typed-const) staticvarsyms }
for i:=0 to sc.count-1 do
begin