Skip to content

Commit

Permalink
vms codingstd: fix check_isxxx.t
Browse files Browse the repository at this point in the history
add a 2nd callback argument to Parrot::Test::Util::Runloop->testloop
fix some src/platform/vms/exec.c isxxx_functions casts, and skip
the rest, when called with the unsigned char[] b argument.
  • Loading branch information
Reini Urban committed Nov 17, 2014
1 parent c060620 commit 54c938a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -27,6 +27,7 @@
+ Fix self heuristic with vtable overridden method calls.
$P0($P0) instead of $P0() is now invalid, it is always a method.
https://trac.parrot.org/parrot/ticket/103 #1013
+ Add vms support by mvorl. GH #866
- Build
+ Set -mabi=64 for gcc --m=64 on mips, -m64 on powerpc #1110
+ Add --{en,dis}able-static #1104
Expand Down
6 changes: 3 additions & 3 deletions lib/Parrot/Test/Util/Runloop.pm
@@ -1,4 +1,4 @@
# Copyright (C) 2008, Parrot Foundation.
# Copyright (C) 2008,2014, Parrot Foundation.

=head1 NAME
Expand Down Expand Up @@ -81,7 +81,7 @@ sub testloop {
my $cb = $args{per_file};
my $buf = join('', @lines);
# do the per-file test
unless($cb->($buf)) {
unless($cb->($buf, $path)) {
push(@failures, $error_line);
}
}
Expand All @@ -92,7 +92,7 @@ sub testloop {
# do the test, once for each line
foreach my $n (0..@lines-1) {
my $line = $lines[$n];
unless($cb->($line)) {
unless($cb->($line, $path)) {
$error_line .= "," if $have_errors;
$error_line .= " " . ($n+1);
$have_errors = 1;
Expand Down
15 changes: 8 additions & 7 deletions src/platform/vms/exec.c
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2004-2010, Parrot Foundation.
* Copyright (C) 2004-2014, Parrot Foundation.
* Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
* 2002, 2003, 2004, 2005, 2006, 2007 by Charles Bailey and others
*/
Expand Down Expand Up @@ -2342,9 +2342,10 @@ setup_cmddsc(const char *incmd, int check_img, int *suggest_quote,
#else
char *cp2;
for (cp2 = resspec;
*rest && !isspace((unsigned char)*rest) && cp2 - resspec < (VMS_MAXRSS - 1);
rest++, cp2++)
*rest && !isspace((unsigned char)*rest)
&& cp2 - resspec < (VMS_MAXRSS - 1); rest++, cp2++) {
*cp2 = *rest;
}
*cp2 = '\0';
if (int_tovmsspec(resspec, cp, 0, NULL)) {
s = vmsspec;
Expand All @@ -2363,9 +2364,9 @@ setup_cmddsc(const char *incmd, int check_img, int *suggest_quote,

if (*rest) {
for (cp2 = vmsspec + strlen(vmsspec);
*rest && cp2 - vmsspec < MAX_DCL_LINE_LENGTH;
rest++, cp2++)
*rest && cp2 - vmsspec < MAX_DCL_LINE_LENGTH; rest++, cp2++) {
*cp2 = *rest;
}
*cp2 = '\0';
}
}
Expand Down Expand Up @@ -2472,7 +2473,7 @@ setup_cmddsc(const char *incmd, int check_img, int *suggest_quote,
if (j >= NAM$C_MAXRSS)
break;
}
while ((j > 0) && !isprint(image_argv[j-1]))
while ((j > 0) && !isprint((unsigned char)image_argv[j-1]))
j--;
image_argv[j] = 0;

Expand Down Expand Up @@ -2552,7 +2553,7 @@ setup_cmddsc(const char *incmd, int check_img, int *suggest_quote,
strncat(vmscmd->dsc$a_pointer, resspec, MAX_DCL_LINE_LENGTH);
else {
rest = cmd;
while (*rest && isspace(*rest)) rest++;
while (*rest && isspace((unsigned char)*rest)) rest++;
}

if (image_argv[0] != 0) {
Expand Down
8 changes: 6 additions & 2 deletions t/codingstd/check_isxxx.t
@@ -1,5 +1,5 @@
#! perl
# Copyright (C) 2006-2009, Parrot Foundation.
# Copyright (C) 2006-2014, Parrot Foundation.

use strict;
use warnings;
Expand Down Expand Up @@ -56,12 +56,16 @@ my $isxxx_functions = join '|', @isxxx_functions_list;

sub check_isxxx {
my $line = shift;
my $path = shift;

# does the line contain an isxxx call?
return 1 unless $line =~ /[^_]($isxxx_functions)\([^)]+/;
# is the line missing a cast?
return 1 unless $line !~ /[^_]($isxxx_functions)\(\(unsigned char\)/;
# yes! fail.
# skip src/platform/vms/exec.c 2426, 2427, 2457, 2461, 2471
return 1 if $path =~ m{src/platform/vms/exec.c$}
and $line =~ /[^_]($isxxx_functions)\(b\[/;
# else fail
return 0;
}

Expand Down

0 comments on commit 54c938a

Please sign in to comment.