#60 mig doesn't work with perl 5.12

closed-fixed
mig (2)
5
2011-07-09
2010-09-14
Andras Biro
No

Mig generates uncompilable code with perl 5.12, with methodes like this:
public static boolean isSigned_nx_struct radio_count_msg 2 6
Tested with perl 5.12.1 and nesc 1.3.1, but I think nesc 1.3.2 has the same perl scripts.
Chih-Ming Hsieh sent a patch to the tinyos-help list in this thread:
http://mail.millennium.berkeley.edu/pipermail/tinyos-help/2010-September/047819.html

Discussion

  • Andras Biro

    Andras Biro - 2011-05-16

    there's an other problem with perl 5.12: if target=null, or target isn't specified, mig exits with this error:
    two source files specified (PLATFORM_NULL and NESC=131)

     
  • Nobody/Anonymous

    The suggested patch ignores the use of $_ in other places (e.g. chop in the first line of the loop).

    An alternative suggestion for the patch is:

    --- lib/ncc/migdecode.pm.orig 2010-12-29 12:59:08.000000000 +0000
    +++ lib/ncc/migdecode.pm 2011-06-23 18:35:56.000000000 +0100
    @@ -47,14 +47,14 @@
    $amtype = $4;

    $base = 0;
    - for (@spec) {
    + foreach my $spec1 (@spec) {
    # remove end of line stuff to avoid confusion w/ cygwin
    - chop;
    - s/\r$//;
    + chomp $spec1;
    + $spec1 =~ s/\r$//;

    - / *(.*)/;
    - split / /, $1;
    - ($field, $type, $offset, $bitlength) = @_;
    + $spec1 =~ s/\s*//;
    + my @my_field = split / /, $spec1;
    + ($field, $type, $offset, $bitlength) = @my_field;

    $basetype = &basetype($type);
    @field_array_max = &arraymax($type);

     
  • David Gay

    David Gay - 2011-07-09

    Fixed for upcoming 1.3.3.

    Plus:
    - $_ is not going away to the best of my knowledge
    - I can't reproduce the problem with --target. If still present in 1.3.3, please file a new bug with a reproducible test case.

     
  • David Gay

    David Gay - 2011-07-09
    • status: open --> closed-fixed