~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/scripts/checkversion.pl

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /scripts/checkversion.pl (Version linux-6.12-rc7) and /scripts/checkversion.pl (Version linux-6.7.12)


  1 #! /usr/bin/env perl                                1 #! /usr/bin/env perl
  2 # SPDX-License-Identifier: GPL-2.0                  2 # SPDX-License-Identifier: GPL-2.0
  3 #                                                   3 #
  4 # checkversion finds uses of all macros in <li      4 # checkversion finds uses of all macros in <linux/version.h>
  5 # where the source files do not #include <linu      5 # where the source files do not #include <linux/version.h>; or cases
  6 # of including <linux/version.h> where it is n      6 # of including <linux/version.h> where it is not needed.
  7 # Copyright (C) 2003, Randy Dunlap <rdunlap@inf      7 # Copyright (C) 2003, Randy Dunlap <rdunlap@infradead.org>
  8                                                     8 
  9 use strict;                                         9 use strict;
 10                                                    10 
 11 $| = 1;                                            11 $| = 1;
 12                                                    12 
 13 my $debugging;                                     13 my $debugging;
 14                                                    14 
 15 foreach my $file (@ARGV) {                         15 foreach my $file (@ARGV) {
 16     next if $file =~ "include/generated/uapi/l     16     next if $file =~ "include/generated/uapi/linux/version\.h";
 17     next if $file =~ "usr/include/linux/versio     17     next if $file =~ "usr/include/linux/version\.h";
 18     # Open this file.                              18     # Open this file.
 19     open( my $f, '<', $file )                      19     open( my $f, '<', $file )
 20       or die "Can't open $file: $!\n";             20       or die "Can't open $file: $!\n";
 21                                                    21 
 22     # Initialize variables.                        22     # Initialize variables.
 23     my ($fInComment, $fInString, $fUseVersion)     23     my ($fInComment, $fInString, $fUseVersion);
 24     my $iLinuxVersion = 0;                         24     my $iLinuxVersion = 0;
 25                                                    25 
 26     while (<$f>) {                                 26     while (<$f>) {
 27         # Strip comments.                          27         # Strip comments.
 28         $fInComment && (s+^.*?\*/+ +o ? ($fInC     28         $fInComment && (s+^.*?\*/+ +o ? ($fInComment = 0) : next);
 29         m+/\*+o && (s+/\*.*?\*/+ +go, (s+/\*.*     29         m+/\*+o && (s+/\*.*?\*/+ +go, (s+/\*.*$+ +o && ($fInComment = 1)));
 30                                                    30 
 31         # Pick up definitions.                     31         # Pick up definitions.
 32         if ( m/^\s*#/o ) {                         32         if ( m/^\s*#/o ) {
 33             $iLinuxVersion      = $. if m/^\s*     33             $iLinuxVersion      = $. if m/^\s*#\s*include\s*"linux\/version\.h"/o;
 34         }                                          34         }
 35                                                    35 
 36         # Strip strings.                           36         # Strip strings.
 37         $fInString && (s+^.*?"+ +o ? ($fInStri     37         $fInString && (s+^.*?"+ +o ? ($fInString = 0) : next);
 38         m+"+o && (s+".*?"+ +go, (s+".*$+ +o &&     38         m+"+o && (s+".*?"+ +go, (s+".*$+ +o && ($fInString = 1)));
 39                                                    39 
 40         # Pick up definitions.                     40         # Pick up definitions.
 41         if ( m/^\s*#/o ) {                         41         if ( m/^\s*#/o ) {
 42             $iLinuxVersion      = $. if m/^\s*     42             $iLinuxVersion      = $. if m/^\s*#\s*include\s*<linux\/version\.h>/o;
 43         }                                          43         }
 44                                                    44 
 45         # Look for uses: LINUX_VERSION_CODE, K     45         # Look for uses: LINUX_VERSION_CODE, KERNEL_VERSION,
 46         # LINUX_VERSION_MAJOR, LINUX_VERSION_P     46         # LINUX_VERSION_MAJOR, LINUX_VERSION_PATCHLEVEL, LINUX_VERSION_SUBLEVEL
 47         if (($_ =~ /LINUX_VERSION_CODE/) || ($     47         if (($_ =~ /LINUX_VERSION_CODE/) || ($_ =~ /\WKERNEL_VERSION/) ||
 48             ($_ =~ /LINUX_VERSION_MAJOR/) || (     48             ($_ =~ /LINUX_VERSION_MAJOR/) || ($_ =~ /LINUX_VERSION_PATCHLEVEL/) ||
 49             ($_ =~ /LINUX_VERSION_SUBLEVEL/))      49             ($_ =~ /LINUX_VERSION_SUBLEVEL/)) {
 50             $fUseVersion = 1;                      50             $fUseVersion = 1;
 51             last if $iLinuxVersion;                51             last if $iLinuxVersion;
 52         }                                          52         }
 53     }                                              53     }
 54                                                    54 
 55     # Report used version IDs without include?     55     # Report used version IDs without include?
 56     if ($fUseVersion && ! $iLinuxVersion) {        56     if ($fUseVersion && ! $iLinuxVersion) {
 57         print "$file: $.: need linux/version.h     57         print "$file: $.: need linux/version.h\n";
 58     }                                              58     }
 59                                                    59 
 60     # Report superfluous includes.                 60     # Report superfluous includes.
 61     if ($iLinuxVersion && ! $fUseVersion) {        61     if ($iLinuxVersion && ! $fUseVersion) {
 62         print "$file: $iLinuxVersion linux/ver     62         print "$file: $iLinuxVersion linux/version.h not needed.\n";
 63     }                                              63     }
 64                                                    64 
 65     # debug: report OK results:                    65     # debug: report OK results:
 66     if ($debugging) {                              66     if ($debugging) {
 67         if ($iLinuxVersion && $fUseVersion) {      67         if ($iLinuxVersion && $fUseVersion) {
 68             print "$file: version use is OK ($     68             print "$file: version use is OK ($iLinuxVersion)\n";
 69         }                                          69         }
 70         if (! $iLinuxVersion && ! $fUseVersion     70         if (! $iLinuxVersion && ! $fUseVersion) {
 71             print "$file: version use is OK (n     71             print "$file: version use is OK (none)\n";
 72         }                                          72         }
 73     }                                              73     }
 74                                                    74 
 75     close($f);                                     75     close($f);
 76 }                                                  76 }
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php