Re: [PATCH 2/4] cgcc: avoid passing a sparse-only option to cc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I create a branch in the chrisl repo call "review-ramsay" for your new
follow up patches.
I plan to do incremental fix up if any on that branch. Then when we
both happy about it,
I will do rebase and smash the commit before push to master branch.



On Thu, Oct 16, 2014 at 1:33 AM, Ramsay Jones
<ramsay@xxxxxxxxxxxxxxxxxxx> wrote:
> On 15/10/14 15:23, Christopher Li wrote:
>> On Sun, Oct 12, 2014 at 3:57 AM, Ramsay Jones
>> <ramsay@xxxxxxxxxxxxxxxxxxx> wrote:
>>>
>>>
>>> -       system ($check) == 0 or die;
>>> +       system ($check) == 0 or exit 1;
>>
>> Why not exit with the error code from sparse here?
>> Sparse might exit with other error code than "1" in the future.
>
> The meaning of the return value from system() is not portable.

I see. Does it mean we should use some thing other than "system".
or maybe some thing like:

$retcode = system($check);
if $retcode !=0 { exit $retcode; }

I don't use Perl so that might not be valid Perl.

> Hmm, off the top of my head, something like:
>
>     sub exit_code {
>         my ($code) = @_;
>         if ($code == -1) { # failed to execute
>             $code = 1;
>         }
>         elsif ($code & 127) { # died with a signal (maybe)
>             $code = 1;
>         }
>         elsif ($code != 0) { # non-zero exit code (maybe)
>             my $t = ($code >> 8) & 0xff;
>             $code = 1;
>             if ($t > 0) {
>                 $code = $t;
>             }
>         }
>         return $code;
>     }
>
>     system ($check) or exit exit_code($?);
>
> However, I think the above is way overkill in this case. ;-)

Yes, I agree, that is way overkill.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux