Bit sloppy of me not to include a solution...
I guess a simple solution would be:
const
ConstNoTargetUnUsed1 = 0;
{$if defined(i386)}
bla = 1;
{$ifend}
{if defined(arm))
bla = 2;
{$ifend}This constant is just there to smooth over the compile process...
ConstNoTargetUnUsed1
In other locations
ConstNoTargetUnUsed2 could be introduced as well...
Perhaps a {if defined(NoTarget)) might be usefull somewhere... but for the const it probably needs a default constant which is never used...
A cleaner solution is probably to just wrap the const in a conditional like so:
{$if Defined(i386) or Defined(Arm) or Defined(Etc))
const
{$ifend}{$if Defined(i386))
bla = 1
{ifend}
{if Defined(arm))
bla = 2
{ifend}
And so forth...
Bye,
Skybuck.
Earlier message 38 lines
----- Original Message -----
From: "Skybuck Flying"
To: "Free Pascal Other MailList"
Sent: Thursday, 7 April, 2011 00:22 AM
Subject: "NoTarget" could also be a target
> Hello
>
> I noticed a certain little problem with the free pascal compiler code.
>
> Some sections assuming that at least one define is present.
>
> for example:
>
> const
> {$if defined(i386)}
> bla = 1;
> {$ifend}
> {if defined(arm))
> bla = 2;
> {$ifend}
>
>
> ^ This creates a little problem when no target or no defines are present.
>
> Perhaps "no target" could be the default (or "unknown target") (in case an
> operating system is ever called "no" ;) :))
>
> By adding a "no target" as a potential target this would allow to test
> certain parts of the compiler without actually having to specify a
> target...
>
> Bye,
> Skybuck.
>
>
>
