Lines Matching +full:hexagon +full:- +full:linux +full:- +full:user

5 # (c) 2008-2010 Andy Whitcroft <apw@canonical.com>
49 $P [OPTION]... [GIT-REV-LIST]
54 -q, --quiet quiet
55 --no-tree run without a qemu tree
56 --no-signoff do not check for 'Signed-off-by' line
57 --patch treat FILE as patchfile
58 --branch treat args as GIT revision list
59 --emacs emacs compile window format
60 --terse one line per report
61 -f, --file treat FILE as regular source file
62 --strict fail if only warnings are found
63 --root=PATH PATH to the qemu tree root
64 --no-summary suppress the per-file summary
65 --mailback only produce a report in case of warnings/errors
66 --summary-file include the filename in summary
67 --debug KEY=[0|1] turn on/off debugging of KEY, where KEY is one of
70 --test-only=WORD report only warnings/errors containing WORD
72 --codespell Use the codespell dictionary for spelling/typos
74 --codespellfile Use this codespell dictionary
75 --color[=WHEN] Use colors 'always', 'never', or only when output
77 -h, --help, --version display this help and exit
79 When FILE is - read standard input.
86 # Prevent --color by itself from consuming other arguments
88 if ($_ eq "--color" || $_ eq "-color") {
89 $_ = "--color=$color";
106 'summary-file!' => \$summary_file,
108 'test-only=s' => \$tst_only,
112 'no-color' => sub { $color = 'never'; },
118 # Use the user provided codespell file unconditionally
120 } elsif (!(-f $codespellfile)) {
133 my $codespell_dict = `python3 -c "$python_codespell_dict" 2> /dev/null`;
134 $codespellfile = $codespell_dict if (-f $codespell_dict);
183 die "Only one of --file, --branch, --patch is permitted\n";
186 die "One of --file, --branch, --patch is required\n";
194 $color = (-t STDOUT);
222 die "$P: $root: --root does not point at a valid tree\n";
234 print "Must be run from the top-level dir. of a qemu tree\n";
242 [A-Za-z_][A-Za-z\d_]*
243 (?:\s*\#\#\s*[A-Za-z_][A-Za-z\d_]*)*
262 our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]};
265 our $Constant = qr{(?:[0-9]+|0x[0-9a-fA-F]+)[UL]*};
266 our $Assignment = qr{(?:\*\=|/=|%=|\+=|-=|<<=|>>=|&=|\^=|\|=|=)};
270 =>|->|<<|>>|<|>|!|~|
271 &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/|%
279 [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
280 | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
281 | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
282 | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
283 | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
284 | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
285 | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
289 [\x09\x0A\x0D\x20-\x7E] # ASCII
293 # some readers default to ISO-8859-1 when showing email source. detect
294 # when UTF-8 is incorrectly interpreted as ISO-8859-1 and reencoded back.
297 \xC3[\x82-\x9F] \xC2[\x80-\xBF] # c2-df 80-bf
298 | \xC3\xA0 \xC2[\xA0-\xBF] \xC2[\x80-\xBF] # e0 a0-bf 80-bf
299 | \xC3[\xA1-\xAC\xAE\xAF] (?: \xC2[\x80-\xBF]){2} # e1-ec/ee/ef 80-bf 80-bf
300 | \xC3\xAD \xC2[\x80-\x9F] \xC2[\x80-\xBF] # ed 80-9f 80-bf
301 | \xC3\xB0 \xC2[\x90-\xBF] (?: \xC2[\x80-\xBF]){2} # f0 90-bf 80-bf 80-bf
302 | \xC3[\xB1-\xB3] (?: \xC2[\x80-\xBF]){3} # f1-f3 80-bf 80-bf 80-bf
303 | \xC3\xB4 \xC2[\x80-\x8F] (?: \xC2[\x80-\xBF]){2} # f4 80-b8 80-bf 80-bf
310 [A-Z][A-Z\d_]*[a-z][A-Za-z\d_]* # camelcase
311 | [A-Z][A-Z\d_]*AIOCB # all uppercase
312 | [A-Z][A-Z\d_]*CPU # all uppercase
369 # for new files the SPDX-License-Identifier line is sufficient.
398 my ($suspect, $fix) = split(/->/, $line);
404 warn "No codespell typos will be found - file '$codespellfile': $!\n";
450 …open($HASH, "-|", "git", "log", "--reverse", "--no-merges", "--no-mailmap", "--format=%H %s", $ARG…
451 die "$P: git log --reverse --no-merges --no-mailmap --format='%H %s' $ARGV[0] failed - $!\n";
454 $line =~ /^([0-9a-fA-F]{40,40}) (.*)$/;
471 open($FILE, '-|', "git",
472 "-c", "diff.renamelimit=0",
473 "-c", "diff.renames=True",
474 "-c", "diff.algorithm=histogram",
475 "show", "--no-mailmap",
476 "--patch-with-stat", $hash) ||
477 die "$P: git show $hash - $!\n";
504 open($FILE, '-|', "diff -u /dev/null $filename") ||
505 die "$P: $filename: diff failed - $!\n";
506 } elsif ($filename eq '-') {
510 die "$P: $filename: open failed - $!\n";
512 if ($filename eq '-') {
539 "linux-user", "system"
543 if (! -e $root . '/' . $check) {
554 if (-e "$path/$bin") {
701 my $line = $linenr - 1;
704 my $coff = $off - 1;
718 @stack = (['', 0]) if ($#stack == -1);
726 next if ($lines[$line] =~ /^-/);
727 $remain--;
750 ($type, $level) = @{$stack[$#stack - 1]};
766 $coff = $off + length($1) - 1;
769 #warn "[" . substr($blk, $soff, $coff - $soff + 1) . "]\n";
777 $level--;
791 $level--;
807 $remain--;
810 my $statement = substr($blk, $soff, $off - $soff + 1);
811 my $condition = substr($blk, $soff, $coff - $soff + 1);
819 $line, $remain + 1, $off - $loff + 1, $level);
876 if (!($remain > 0 && $condition =~ /^\s*(?:\n[+-])?\s*(?:if|else|do)\b/s)) {
886 last if (!($remain > 0 && $condition =~ /^(?:\s*\n[+-])*\s*(?:else|do)\b/s));
897 my $start = $linenr - 1;
906 next if ($rawlines[$line] =~ /^-/);
907 $remain--;
915 $level = $stack[$#stack - 1];
923 $off--;
928 $level--;
977 my ($current_comment) = ($rawlines[$end_line - 1] =~ m@.*(/\*.*\*/)\s*(?:\\\s*)?$@);
985 my $line = $rawlines[$linenr - 1];
1009 ##print "LINE: $rawlines[$end_line - 1 ]\n";
1018 my $offset = $linenr - 1;
1024 next if (defined($line) && $line =~ /^-/);
1025 $cnt--;
1173 print "PAREN('$1') -> $type\n"
1229 } elsif ($cur =~ /^(-(?![->])|\+(?!\+)|\*|\&\&|\&)/o) {
1244 if ($1 ne '++' && $1 ne '--') {
1348 # Imported Linux headers probably have SPDX tags, but if they
1352 if ($file =~ m,include/standard-headers, ||
1353 $file =~ m,linux-headers, ||
1360 # Flatten sub-expressions
1365 $expr =~ s/\s+WITH\s+/-WITH-/g;
1373 my $prefer = "GPL-2.0-or-later";
1375 GPL-2.0-only
1376 LGPL-2.1-only
1377 LGPL-2.1-or-later
1378 BSD-2-Clause
1379 BSD-3-Clause
1431 # According to tests/qtest/bios-tables-test.c: do not
1441 if ($fileinfo->{filenew} =~ m#^tests/data/acpi/# &&
1442 $fileinfo->{filenew} !~ m#^\.sh$#) {
1443 push @acpi_testexpected, $fileinfo->{filenew};
1444 } elsif ($fileinfo->{filenew} !~
1445 m#^tests/qtest/bios-tables-test-allowed-diff.h$#) {
1446 push @acpi_nontestexpected, $fileinfo->{filenew};
1452 "tests/qtest/bios-tables-test.c. Files\n\n " .
1462 if ($fileinfo->{action} ne "modified" &&
1463 $fileinfo->{filenew} !~ m#^tests/data/acpi/#) {
1464 push @maybemaintainers, $fileinfo->{filenew};
1466 if ($fileinfo->{filenew} eq "MAINTAINERS") {
1471 # If we don't see a MAINTAINERS update, prod the user to check
1484 if ($fileinfo->{action} eq "new" && ($fileinfo->{mode} & 0111)) {
1485 my $permhere = $fileinfo->{linestart} . "FILE: " .
1486 $fileinfo->{filenew} . "\n";
1487 if ($fileinfo->{filenew} =~
1499 if ($fileinfo->{action} eq "new" &&
1500 !exists $fileinfo->{facts}->{sawspdx}) {
1501 if ($fileinfo->{filenew} =~
1504 ERROR("New file '" . $fileinfo->{filenew} .
1505 "' requires 'SPDX-License-Identifier'");
1508 WARN("Does new file '" . $fileinfo->{filenew} .
1509 "' need 'SPDX-License-Identifier'?");
1512 if ($fileinfo->{action} eq "new" &&
1513 exists $fileinfo->{facts}->{sawboilerplate}) {
1514 ERROR("New file '" . $fileinfo->{filenew} . "' must " .
1516 "the SPDX-License-Identifier, unless this file was " .
1572 # Pre-scan the patch sanitizing the lines.
1580 if ($rawline=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) {
1581 $realline=$1-1;
1596 next if (defined $rawlines[$ln - 1] &&
1597 $rawlines[$ln - 1] =~ /^-/);
1598 $cnt--;
1599 #print "RAW<$rawlines[$ln - 1]>\n";
1600 last if (!defined $rawlines[$ln - 1]);
1601 if ($rawlines[$ln - 1] =~ m@(/\*|\*/)@ &&
1602 $rawlines[$ln - 1] !~ m@"[^"]*(?:/\*|\*/)[^"]*"@) {
1625 # simplify matching -- only bother with positive lines.
1631 $realcnt-- if ($line =~ /^(?:\+| |$)/);
1637 #print "-->$line\n";
1647 my $rawline = $rawlines[$linenr - 1];
1650 if ($line=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) {
1653 $realline=$1-1;
1672 $realcnt-- if ($realcnt != 0);
1685 $realcnt--;
1699 if ($line =~ /^diff --git\s+(\S+)\s+(\S+)$/) {
1704 $fileinfo->{lineend} = $oldhere;
1724 } elsif (defined $fileinfo && $fileinfo->{githeader} &&
1725 $line =~ /^(new|deleted) (?:file )?mode\s+([0-7]+)$/) {
1726 $fileinfo->{action} = $1;
1727 $fileinfo->{mode} = oct($2);
1728 } elsif (defined $fileinfo && $fileinfo->{githeader} &&
1730 $fileinfo->{similarity} = int($1);
1731 } elsif (defined $fileinfo && $fileinfo->{githeader} &&
1732 $line =~ /^rename (from|to) [\w\/\.\-]+\s*$/) {
1733 $fileinfo->{action} = "renamed";
1734 # For a no-change rename, we'll never have any "+++..."
1736 if ($1 eq "to" && $fileinfo->{similarity} == 100) {
1745 -e "$root/$p1_prefix") {
1746 WARN("patch prefix '$p1_prefix' exists, appears to be a -p0 patch\n");
1749 if (defined $fileinfo && !$fileinfo->{isgit}) {
1750 $fileinfo->{lineend} = $oldhere;
1754 if (!defined $fileinfo || !$fileinfo->{isgit}) {
1769 $fileinfo->{githeader} = 0;
1791 if ($line =~ /^(?:rename|copy) (?:from|to) [\w\/\.\-]+\s*$/) {
1795 if ($line =~ /^(Author|From): .* via .*<qemu-\w+\@nongnu\.org>/) {
1800 if ($line =~ /^\s*signed-off-by:/i) {
1805 if (!($line =~ /^\s*Signed-off-by:/)) {
1806 ERROR("The correct form is \"Signed-off-by\"\n" .
1809 if ($line =~ /^\s*signed-off-by:\S/i) {
1810 ERROR("space required after Signed-off-by:\n" .
1815 # Check SPDX-License-Identifier references a permitted license
1816 if ($rawline =~ m,SPDX-License-Identifier: (.*?)(\*/)?\s*$,) {
1817 $fileinfo->{facts}->{sawspdx} = 1;
1822 $fileinfo->{facts}->{sawboilerplate} = 1;
1825 if ($rawline =~ m,(SPDX-[a-zA-Z0-9-_]+):,) {
1828 SPDX-License-Identifier
1839 if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) {
1844 # UTF-8 regex found at http://www.w3.org/International/questions/qa-forms-utf-8.en.php
1853 ERROR("Invalid UTF-8, patch and commit message should be encoded in UTF-8\n" . $hereptr);
1857 ERROR("Doubly-encoded UTF-8\n" . $herecurr);
1863 $rawline =~ /^(commit\b|from\b|[\w-]+:).*$/i)) {
1868 # Check if there is UTF-8 in a commit log when a mail header has explicitly
1871 $rawline =~ /^Content-Type:.+charset="(.+)".*$/ &&
1872 $1 !~ /utf-8/i) {
1878 WARN("8-bit UTF-8 used in possible commit log\n" . $herecurr);
1884 while ($rawline =~ /(?:^|[^\w\-'`])($misspellings)(?:[^\w\-'`]|$)/gi) {
1887 my $ptr = substr($blank, 0, $-[1]) . "^" x length($typo);
1890 $typo_fix = ucfirst($typo_fix) if ($typo =~ /^[A-Z]/);
1891 $typo_fix = uc($typo_fix) if ($typo =~ /^[A-Z]+$/);
1892 WARN("'$typo' may be misspelled - perhaps '$typo_fix'?\n" . $hereptr);
1896 # ignore non-hunk lines and lines being removed
1897 next if (!$hunk_line || $line =~ /^-/);
1899 # Check that updating imported files from Linux are not mixed with other changes
1900 if ($realfile =~ /^(linux-headers|include\/standard-headers)\//) {
1903 "imported from Linux, are you using " .
1904 "scripts/update-linux-headers.sh?\n" .
1914 ERROR("headers imported from Linux should be self-" .
1920 # ignore files that are being periodically imported from Linux
1921 next if ($realfile =~ /^(linux-headers|include\/standard-headers)\//);
1932 # (surrounding text is 4-column aligned)
1944 # checks for trace-events files
1945 if ($realfile =~ /trace-events$/ && $line =~ /^\+/) {
1946 if ($rawline =~ /%[-+ 0]*#/) {
1948 "trace-events, use '0x' prefix instead\n" . $herecurr);
1951 qr/%[-+ *.0-9]*([hljztL]|ll|hh)?(x|X|"\s*PRI[xX][^"]*"?)/;
1999 next if ($realfile =~ /^target\/hexagon\/imported\/*/);
2016 if ($commentline =~ m@^\+.*/\*\*?+[ \t]*[^ \t]@) { # /* or /** non-blank
2072 (!defined $lines[$realline_next - 1] ||
2073 substr($lines[$realline_next - 1], $off_next) =~ /^\s*$/)) {
2156 my $ctx_cnt = $realcnt - $#ctx - 1;
2163 defined $lines[$ctx_ln - 1] &&
2164 $lines[$ctx_ln - 1] =~ /^-/)) {
2166 $ctx_skip-- if (!defined $lines[$ctx_ln - 1] || $lines[$ctx_ln - 1] !~ /^-/);
2171 #print "pre<$pre_ctx>\nline<$line>\nctx<$ctx>\nnext<$lines[$ctx_ln - 1]>\n";
2178 defined($lines[$ctx_ln - 1]) && $lines[$ctx_ln - 1] =~ /^\+\s*\{/ &&
2179 defined($lines[$ctx_ln - 2]) && length($lines[$ctx_ln - 2]) < 80) {
2181 "$here\n$ctx\n$rawlines[$ctx_ln - 1]\n");
2185 defined $lines[$ctx_ln - 1])
2187 my ($nlength, $nindent) = line_stats($lines[$ctx_ln - 1]);
2190 "$here\n$ctx\n$rawlines[$ctx_ln - 1]\n");
2212 # none on the first line, and are going to re-add them
2244 my $cond_ptr = -1;
2302 $prev_values = substr($curr_values, -1);
2347 $rawline !~ m{// SPDX-License-Identifier: }) {
2420 # 1. with a type on the left -- int [] a;
2421 # 2. at the beginning of a line for slice initialisers -- [0...10] = 5,
2422 # 3. inside a curly brace -- = { [0...10] = 5 }
2423 # 4. after a comma -- [1] = 5, [2] = 6
2424 # 5. in a macro definition -- #define abc(x) [x] = y
2426 my ($where, $prefix) = ($-[1], $1);
2438 my $ctx_before = substr($line, 0, $-[1]);
2452 # cpp #define statements have non-optional spaces, ie
2472 \+=|-=|\*=|\/=|%=|\^=|\|=|&=|
2473 =>|->|<<|>>|<|>|=|!|~|
2474 &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/|%|
2550 # ->
2552 } elsif ($op eq '->' || $opv eq ':B') {
2565 # '*' as part of a type definition -- reported already.
2573 $opv eq '*U' || $opv eq '-U' ||
2578 } elsif ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) {
2588 # unary ++ and unary -- are allowed no space on one side.
2589 } elsif ($op eq '++' or $op eq '--') {
2687 $value !~ /(?:$Ident|-?$Constant)\s*
2689 (?:$Ident|-?$Constant)/x &&
2693 if ($value =~ /^\s*(?:$Ident|-?$Constant)\s*$/ &&
2701 # Return of what appears to be an errno should normally be -'ve
2702 if ($line =~ /^.\s*return\s*(E[A-Z]*)\s*;/) {
2705 ERROR("return of an errno should typically be -ve (return -$1)\n" . $herecurr);
2719 # Check for illegal assignment in if conditional -- and check for trailing
2731 ($stat_next =~ /^((?:\s*\n[+-])*\s*)/s);
2733 statement_rawlines($whitespace) - 1;
2774 \s*0[xX][0-9]+\s*
2778 \s*0[xX][0-9]+\s*
2830 # if (($line=~/[\w_][a-z\d]+[A-Z]/) and !($line=~/print/)) {
2841 # multi-statement macros should be enclosed in a do while loop, grab the
2855 while ($cnt > 0 && defined $lines[$ln - 1] &&
2856 $lines[$ln - 1] =~ /^(?:-|..*\\$)/)
2858 $ctx .= $rawlines[$ln - 1] . "\n";
2859 $cnt-- if ($lines[$ln - 1] !~ /^-/);
2862 $ctx .= $rawlines[$ln - 1];
2865 ctx_statement_block($linenr, $ln - $linenr + 1, 0);
2867 #print "LINE<$lines[$ln-1]> len<" . length($lines[$ln-1]) . "\n";
2873 #print "ADDING cnt<$cnt> $off <" . substr($lines[$ln - 1], $off) . "> rest<$rest>\n";
2874 if ($off != 0 || $lines[$ln - 1] !~ /^-/) {
2875 $rest .= substr($lines[$ln - 1], $off) . "\n";
2876 $cnt--;
2920 …ERROR("Macros with multiple statements should be enclosed in a do - while loop\n" . "$here\n$ctx\n…
2925 $dstat !~ /^(?:$Ident|-?$Constant)$/ &&
2940 # Check the pre-context.
2960 my $ln = $linenr - 1;
2965 my ($whitespace) = ($cond =~ /^((?:\s*\n[+-])*\s*)/s);
2966 my $offset = statement_rawlines($whitespace) - 1;
2974 $ln += statement_rawlines($block) - 1;
3006 if (!defined $suppress_ifbraces{$linenr - 1} &&
3012 # Check the pre-context.
3013 if (substr($line, 0, $-[0]) =~ /(\}\s*)$/) {
3024 ctx_statement_full($linenr, $realcnt, $-[0]);
3048 # Check the post-context.
3055 print "APW: ALLOWED: chunk-1 block<$block>\n"
3205 # check for module_init(), use category-specific init macros explicitly please
3224 Spice[A-Z][a-zA-Z0-9]*Interface|
3226 USBDesc[A-Z][a-zA-Z0-9]*|
3239 $string = substr($rawline, $-[1], $+[1] - $-[1]);
3243 ERROR("\%Ld/%Lu are not-standard C, use %lld/%llu\n" . $herecurr);
3245 # check for %# or %0# in printf-style format strings
3294 my $i = $linenr - 2;
3297 $i--;
3305 # check for non-portable libc calls that have portable alternatives in QEMU
3363 ERROR("Missing Signed-off-by: line(s)\n");
3368 if ($#rawlines == -1) {
3378 # This is not a patch, and we are are in 'no-patch' mode so
3384 if (!$is_patch && $filename !~ /cover-letter\.patch$/) {
3385 ERROR("Does not appear to be a unified-diff format patch\n");