⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.68
Server IP:
13.127.59.50
Server:
Linux ip-172-31-46-210 5.15.0-1033-aws #37~20.04.1-Ubuntu SMP Fri Mar 17 11:39:30 UTC 2023 x86_64
Server Software:
Apache/2.4.41 (Ubuntu)
PHP Version:
7.4.3-4ubuntu2.29
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
lib
/
modules
/
5.15.0-1083-aws
/
build
/
scripts
/
View File Name :
checkdeclares.pl
#!/usr/bin/env perl # SPDX-License-Identifier: GPL-2.0 # # checkdeclares: find struct declared more than once # # Copyright 2021 Wan Jiabing<wanjiabing@vivo.com> # Inspired by checkincludes.pl # # This script checks for duplicate struct declares. # Note that this will not take into consideration macros so # you should run this only if you know you do have real dups # and do not have them under #ifdef's. # You could also just review the results. use strict; sub usage { print "Usage: checkdeclares.pl file1.h ...\n"; print "Warns of struct declaration duplicates\n"; exit 1; } if ($#ARGV < 0) { usage(); } my $dup_counter = 0; foreach my $file (@ARGV) { open(my $f, '<', $file) or die "Cannot open $file: $!.\n"; my %declaredstructs = (); while (<$f>) { if (m/^\s*struct\s*(\w*);$/o) { ++$declaredstructs{$1}; } } close($f); foreach my $structname (keys %declaredstructs) { if ($declaredstructs{$structname} > 1) { print "$file: struct $structname is declared more than once.\n"; ++$dup_counter; } } } if ($dup_counter == 0) { print "No duplicate struct declares found.\n"; }