* set PIC defines earlier, resolve #25788

git-svn-id: trunk@26924 -
This commit is contained in:
florian 2014-03-02 15:35:08 +00:00
parent 1d5f74fae0
commit 68f1a51164
3 changed files with 45 additions and 11 deletions

1
.gitattributes vendored
View File

@ -12668,6 +12668,7 @@ tests/webtbf/tw25504.pp svneol=native#text/plain
tests/webtbf/tw2562.pp svneol=native#text/plain
tests/webtbf/tw25622.pp svneol=native#text/plain
tests/webtbf/tw25622a.pp svneol=native#text/plain
tests/webtbf/tw25788.pp svneol=native#text/pascal
tests/webtbf/tw2657.pp svneol=native#text/plain
tests/webtbf/tw2670.pp svneol=native#text/plain
tests/webtbf/tw2719.pp svneol=native#text/plain

View File

@ -803,13 +803,16 @@ type
try_consume_hintdirective(current_module.moduleoptions, current_module.deprecatedmsg);
consume(_SEMICOLON);
consume(_INTERFACE);
{ global switches are read, so further changes aren't allowed }
current_module.in_global:=false;
{ handle the global switches }
{ handle the global switches, do this before interface, because after interface has been
read, all following directives are parsed as well }
setupglobalswitches;
consume(_INTERFACE);
{ global switches are read, so further changes aren't allowed }
current_module.in_global:=false;
message1(unit_u_loading_interface_units,current_module.modulename^);
{ update status }
@ -1649,14 +1652,16 @@ type
if tf_library_needs_pic in target_info.flags then
include(current_settings.moduleswitches,cs_create_pic);
{ setup things using the switches, do this before the semicolon, because after the semicolon has been
read, all following directives are parsed as well }
setupglobalswitches;
consume(_SEMICOLON);
{ global switches are read, so further changes aren't allowed }
current_module.in_global:=false;
{ setup things using the switches }
setupglobalswitches;
{ set implementation flag }
current_module.in_interface:=false;
current_module.interface_compiled:=true;
@ -1972,6 +1977,10 @@ type
if tf_library_needs_pic in target_info.flags then
include(current_settings.moduleswitches,cs_create_pic);
{ setup things using the switches, do this before the semicolon, because after the semicolon has been
read, all following directives are parsed as well }
setupglobalswitches;
consume(_SEMICOLON);
end
else
@ -2013,17 +2022,24 @@ type
until not try_to_consume(_COMMA);
consume(_RKLAMMER);
end;
{ setup things using the switches, do this before the semicolon, because after the semicolon has been
read, all following directives are parsed as well }
setupglobalswitches;
consume(_SEMICOLON);
end
else if (target_info.system in systems_unit_program_exports) then
exportlib.preparelib(current_module.realmodulename^);
begin
exportlib.preparelib(current_module.realmodulename^);
{ setup things using the switches }
setupglobalswitches;
end;
{ global switches are read, so further changes aren't allowed }
current_module.in_global:=false;
{ setup things using the switches }
setupglobalswitches;
{ set implementation flag }
current_module.in_interface:=false;
current_module.interface_compiled:=true;

17
tests/webtbf/tw25788.pp Normal file
View File

@ -0,0 +1,17 @@
{ %norun }
{ %opt=-Cg }
{ %fail }
{ %target=linux,win64,freebsd,darwin }
unit tw25788;
interface
//const a=1; // uncomment this to make it fail as expected
{$ifdef FPC_PIC}
{$error Don't want this to compile with PIC}
{$endif}
implementation
end.