lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 7 May 2010 09:59:52 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	Randy Dunlap <rdunlap@...otime.net>
Cc:	kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux@....linux.org.uk, ysato@...rs.sourceforge.jp,
	tony.luck@...el.com, dhowells@...hat.com, kyle@...artin.ca,
	benh@...nel.crashing.org, schwidefsky@...ibm.com,
	jgarzik@...ox.com, hare@...e.de, felipe.balbi@...ia.com
Subject: Re: [PATCH] removing redundant ifdefs

On Thu, May 06, 2010 at 10:43:43AM -0700, Randy Dunlap wrote:
> On Thu,  6 May 2010 19:36:04 +0200 Jiri Olsa wrote:
> 
> > removing redundant ifdefs.
> > 
> > the pattern is
> > 
> > 	#ifdef DEF1
> > 	...
> > 	#ifdef DEF1
> > 	...
> > 	#endif
> > 	...
> > 	#endif
> > 
> > and removing the inner ifdef.
> > 
> > I found them using script all over the kernel so
> > I haven't even compile-tested some of them.
> 
> what script, please?
> 
> ---
> ~Randy
> *** Remember to use Documentation/SubmitChecklist when testing your code ***

I made one after I spot one place like that.. it's simple
perl script, which spits many false warnings (attached).
I took what I thought was right. I did not want to spend
much time with that. ;)

wbr,
jirka

---
#!/usr/bin/perl

my @ifdefs;
my $lnb = 0;
my $file = $ARGV[0];

open FILE, $file or die $!;

while($line = <FILE>) {
        chop $line;
        $lnb++;

        if ($line =~ /^#[ ]*ifdef|^#[ ]*if/) {
                my @ifdef = split(/\s/, $line);
                my $def = $ifdef[1];

                foreach $d(@ifdefs) {
                        next if ($d ne $def);
                        print "$file: [$line]\n";
                        print "$file:  got duplicate $def, line $lnb\n";
                }

                push(@ifdefs, $def);
        }

        if ($line =~ /^#[ ]*endif/) {
                pop(@ifdefs);
        }
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ