* Handling of -specs in cgcc
@ 2008-07-20 18:28 Alexey Zaytsev
2008-07-22 17:00 ` Alexey Zaytsev
0 siblings, 1 reply; 8+ messages in thread
From: Alexey Zaytsev @ 2008-07-20 18:28 UTC (permalink / raw)
To: linux-sparse; +Cc: welinder
Hi.
Looking at cgcc, it seems that this code does not actually work,
26 if (/^-specs=(.*)$/) {
27 $check .= &add_specs ($1);
28 $has_specs = 1;
29 next;
30 }
because add_specs() never expects to see a file name, and
the option is removed from the argument list and never passed
to gcc. As it seems that this feature never worked, probably
we could simply remove it? Morten?
---
Pass -specs to gcc without trying (and failing) to decompose it.
Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
diff --git a/cgcc b/cgcc
index 4fab530..a1d4f66 100755
--- a/cgcc
+++ b/cgcc
@@ -23,12 +23,6 @@ foreach (@ARGV) {
$m32 = 1 if /^-m32$/;
$m64 = 1 if /^-m64$/;
- if (/^-specs=(.*)$/) {
- $check .= &add_specs ($1);
- $has_specs = 1;
- next;
- }
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: Handling of -specs in cgcc
2008-07-20 18:28 Handling of -specs in cgcc Alexey Zaytsev
@ 2008-07-22 17:00 ` Alexey Zaytsev
2008-07-22 17:20 ` Morten Welinder
0 siblings, 1 reply; 8+ messages in thread
From: Alexey Zaytsev @ 2008-07-22 17:00 UTC (permalink / raw)
To: linux-sparse; +Cc: Morten Welinder
[Added the new address to the CC]
On Sun, Jul 20, 2008 at 10:28 PM, Alexey Zaytsev
<alexey.zaytsev@gmail.com> wrote:
> Hi.
>
> Looking at cgcc, it seems that this code does not actually work,
>
> 26 if (/^-specs=(.*)$/) {
> 27 $check .= &add_specs ($1);
> 28 $has_specs = 1;
> 29 next;
> 30 }
>
> because add_specs() never expects to see a file name, and
> the option is removed from the argument list and never passed
> to gcc. As it seems that this feature never worked, probably
> we could simply remove it? Morten?
>
> ---
>
> Pass -specs to gcc without trying (and failing) to decompose it.
>
> Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
>
> diff --git a/cgcc b/cgcc
> index 4fab530..a1d4f66 100755
> --- a/cgcc
> +++ b/cgcc
> @@ -23,12 +23,6 @@ foreach (@ARGV) {
> $m32 = 1 if /^-m32$/;
> $m64 = 1 if /^-m64$/;
>
> - if (/^-specs=(.*)$/) {
> - $check .= &add_specs ($1);
> - $has_specs = 1;
> - next;
> - }
> -
> if ($_ eq '-no-compile') {
> $do_compile = 0;
> next;
> @@ -83,6 +77,8 @@ sub cc_only_option {
> # ones. Don't include it just because a project wants to pass -Wall to cc.
> # If you really want cgcc to run sparse with -Wall, use
> # CHECK="sparse -Wall".
> +
> + return 1 if $arg =~ /^-specs=.*/;
> return 1 if $arg =~ /^-Wall$/;
> return 0;
> }
>
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: Handling of -specs in cgcc
2008-07-22 17:00 ` Alexey Zaytsev
@ 2008-07-22 17:20 ` Morten Welinder
2008-07-22 17:28 ` Alexey Zaytsev
0 siblings, 1 reply; 8+ messages in thread
From: Morten Welinder @ 2008-07-22 17:20 UTC (permalink / raw)
To: Alexey Zaytsev; +Cc: linux-sparse, Morten Welinder
On Tue, Jul 22, 2008 at 1:00 PM, Alexey Zaytsev
<alexey.zaytsev@gmail.com> wrote:
> [Added the new address to the CC]
("troll.com" is a bitkeeper bug. Use a machine named "troll" and
bitkeeper would
happily add ".com".)
With respect to the substance, I am not sure why you want to remove -specs.
It was never meant to take a filename -- it takes a token like "i86" and adds
options for that. That is not generally very useful, but has its uses
for cross-
compilation.
Morten
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: Handling of -specs in cgcc
2008-07-22 17:20 ` Morten Welinder
@ 2008-07-22 17:28 ` Alexey Zaytsev
2008-07-22 17:43 ` Morten Welinder
0 siblings, 1 reply; 8+ messages in thread
From: Alexey Zaytsev @ 2008-07-22 17:28 UTC (permalink / raw)
To: Morten Welinder; +Cc: linux-sparse, Morten Welinder
On Tue, Jul 22, 2008 at 9:20 PM, Morten Welinder <mwelinder@gmail.com> wrote:
> On Tue, Jul 22, 2008 at 1:00 PM, Alexey Zaytsev
> <alexey.zaytsev@gmail.com> wrote:
>> [Added the new address to the CC]
>
> ("troll.com" is a bitkeeper bug. Use a machine named "troll" and
> bitkeeper would
> happily add ".com".)
>
> With respect to the substance, I am not sure why you want to remove -specs.
> It was never meant to take a filename -- it takes a token like "i86" and adds
> options for that. That is not generally very useful, but has its uses
> for cross-
> compilation.
But won't gcc fail in such case? Maybe we should not remove, but replace it
with a unique option to specify for which architecture sparse should check?
>
> Morten
>
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: Handling of -specs in cgcc
2008-07-22 17:28 ` Alexey Zaytsev
@ 2008-07-22 17:43 ` Morten Welinder
2008-07-22 17:59 ` Alexey Zaytsev
2008-07-22 18:03 ` Josh Triplett
0 siblings, 2 replies; 8+ messages in thread
From: Morten Welinder @ 2008-07-22 17:43 UTC (permalink / raw)
To: Alexey Zaytsev; +Cc: linux-sparse, Morten Welinder
> But won't gcc fail in such case?
It will not fail, as gcc does not see any of it. But since the defines might
not match what gcc runs with, you might get interesting effects.
> Maybe we should not remove, but replace it
> with a unique option to specify for which architecture sparse should check?
That's certainly possible, but I would wait for an actual problem showing
up before fixing anything. Right now, we can use -specs to get an idea
what sparse would find for a different arch without actually having a gcc
around that can cross compile.
Morten
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Handling of -specs in cgcc
2008-07-22 17:43 ` Morten Welinder
@ 2008-07-22 17:59 ` Alexey Zaytsev
2008-07-22 18:03 ` Josh Triplett
1 sibling, 0 replies; 8+ messages in thread
From: Alexey Zaytsev @ 2008-07-22 17:59 UTC (permalink / raw)
To: Morten Welinder; +Cc: linux-sparse, Morten Welinder
On Tue, Jul 22, 2008 at 9:43 PM, Morten Welinder <mwelinder@gmail.com> wrote:
>> But won't gcc fail in such case?
>
> It will not fail, as gcc does not see any of it. But since the defines might
> not match what gcc runs with, you might get interesting effects.
>
Rright, it is not added to the gcc arguments. But this means that if the
build system actually passes -specs= for some reason, gcc would never
see them... On the other hand, have anyone ever seen the -specs option
used in real life?
>> Maybe we should not remove, but replace it
>> with a unique option to specify for which architecture sparse should check?
>
> That's certainly possible, but I would wait for an actual problem showing
> up before fixing anything. Right now, we can use -specs to get an idea
> what sparse would find for a different arch without actually having a gcc
> around that can cross compile.
>
> Morten
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Handling of -specs in cgcc
2008-07-22 17:43 ` Morten Welinder
2008-07-22 17:59 ` Alexey Zaytsev
@ 2008-07-22 18:03 ` Josh Triplett
2008-07-22 18:11 ` Alexey Zaytsev
1 sibling, 1 reply; 8+ messages in thread
From: Josh Triplett @ 2008-07-22 18:03 UTC (permalink / raw)
To: Morten Welinder; +Cc: Alexey Zaytsev, linux-sparse, Morten Welinder
On Tue, 2008-07-22 at 13:43 -0400, Morten Welinder wrote:
> > But won't gcc fail in such case?
>
> It will not fail, as gcc does not see any of it. But since the defines might
> not match what gcc runs with, you might get interesting effects.
>
> > Maybe we should not remove, but replace it
> > with a unique option to specify for which architecture sparse should check?
>
> That's certainly possible, but I would wait for an actual problem showing
> up before fixing anything. Right now, we can use -specs to get an idea
> what sparse would find for a different arch without actually having a gcc
> around that can cross compile.
In general, it seems questionable to have cgcc handle an option named
identically to one in GCC but have it behave differently than GCC.
That said, I do think Sparse should handle different architectures
without requiring compilation of a "cross-Sparse"; it really just needs
a specs-equivalent for each architecture.
- Josh Triplett
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Handling of -specs in cgcc
2008-07-22 18:03 ` Josh Triplett
@ 2008-07-22 18:11 ` Alexey Zaytsev
0 siblings, 0 replies; 8+ messages in thread
From: Alexey Zaytsev @ 2008-07-22 18:11 UTC (permalink / raw)
To: Josh Triplett; +Cc: Morten Welinder, linux-sparse, Morten Welinder
On Tue, Jul 22, 2008 at 10:03 PM, Josh Triplett
<josht@linux.vnet.ibm.com> wrote:
> On Tue, 2008-07-22 at 13:43 -0400, Morten Welinder wrote:
>> > But won't gcc fail in such case?
>>
>> It will not fail, as gcc does not see any of it. But since the defines might
>> not match what gcc runs with, you might get interesting effects.
>>
>> > Maybe we should not remove, but replace it
>> > with a unique option to specify for which architecture sparse should check?
>>
>> That's certainly possible, but I would wait for an actual problem showing
>> up before fixing anything. Right now, we can use -specs to get an idea
>> what sparse would find for a different arch without actually having a gcc
>> around that can cross compile.
>
> In general, it seems questionable to have cgcc handle an option named
> identically to one in GCC but have it behave differently than GCC.
>
> That said, I do think Sparse should handle different architectures
> without requiring compilation of a "cross-Sparse"; it really just needs
> a specs-equivalent for each architecture.
>
> - Josh Triplett
How about just s/specs/arch/ ?
diff --git a/cgcc b/cgcc
index 4fab530..f4417dc 100755
--- a/cgcc
+++ b/cgcc
@@ -23,7 +23,7 @@ foreach (@ARGV) {
$m32 = 1 if /^-m32$/;
$m64 = 1 if /^-m64$/;
- if (/^-specs=(.*)$/) {
+ if (/^-arch=(.*)$/) {
$check .= &add_specs ($1);
$has_specs = 1;
next;
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-07-22 18:11 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-20 18:28 Handling of -specs in cgcc Alexey Zaytsev
2008-07-22 17:00 ` Alexey Zaytsev
2008-07-22 17:20 ` Morten Welinder
2008-07-22 17:28 ` Alexey Zaytsev
2008-07-22 17:43 ` Morten Welinder
2008-07-22 17:59 ` Alexey Zaytsev
2008-07-22 18:03 ` Josh Triplett
2008-07-22 18:11 ` Alexey Zaytsev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).