check-sources.pl revision ec5347e2c775f027573ce5648b910361aa926c01
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews#! /usr/bin/perl -ws
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt#
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt# Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt# Copyright (C) 2000, 2001 Internet Software Consortium.
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt#
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt# Permission to use, copy, modify, and/or distribute this software for any
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt# purpose with or without fee is hereby granted, provided that the above
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt# copyright notice and this permission notice appear in all copies.
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt#
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt# PERFORMANCE OF THIS SOFTWARE.
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt# $Id: check-sources.pl,v 1.9 2007/06/18 23:47:57 tbox Exp $
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt# Rudimentary, primarily for use by the developers.
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt# This just evolved with no serious attempt at making it
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt# bulletproof or foolproof. Or pretty even. Probably would
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt# have done it differently if it were actually designed as opposed
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews# to just growing as a multi-tentacled thing as various messages
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt# were either added or selectively silenced.
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntuse strict;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntuse vars qw($help $debug);
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntsub
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntsortdir() {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt if (-d $::a) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt if (-d $::b) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt return ($::a cmp $::b);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt } else {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt return (-1);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt } elsif (-d $::b) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt return (1);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt } else {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt return ($::a cmp $::b);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt}
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntsub
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdo_dir($$) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt my($predir, $dir) = @_;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt my $newdir = $predir ne "" ? "$predir/$dir" : $dir;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print "================> $newdir\n";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt unless (chdir("$dir")) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print "cd $newdir: $1\n";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt return;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt unless (opendir(DIR, ".")) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print "opendir $predir/$dir: $!\n";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt return;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt foreach my $entry (sort sortdir readdir(DIR)) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt next if $entry =~ /^\.\.?$/;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt if (-d $entry) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt do_dir($newdir, $entry);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt next;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt next if $entry !~ /\.o$/;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt do_file($entry);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt closedir(DIR);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt chdir("..") or
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt die "major malfunction: can't chdir to parent dir: $!\n";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print "================> $predir\n";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt}
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntsub
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntdo_file($) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt my $objfile = $_[0];
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt my ($file, $savesource, $saveobj);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt my ($config_h, $cpp_if, $prefix, $elided, $comment, $prefix_extend, $body);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt unless ($objfile =~ /\.o$/) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print "$0: skipping non-object file $objfile\n";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt return;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt ($file = $objfile) =~ s%\.o$%.c%;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt ($savesource = $file) =~ s%$%.save%;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt ($saveobj = $objfile) =~ s%$%.save%;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt if (-f $savesource) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print "$savesource exists, skipping\n";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt return;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt unless (-f $file) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print "$file does not exist, skipping\n";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt return;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt rename($file, $savesource);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt rename($objfile, $saveobj);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt open(SOURCE, "< $savesource");
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt $_ = join('', <SOURCE>);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt close(SOURCE);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt $prefix = '';
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print "$file begin\n" if $debug;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt while (1) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt eval {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt # Note that only '#include <...>' is checked, not '#include "..."'.
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt # 1 23 4 5 6 78
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt if (m%(\A\Q$prefix\E((.*\n)*?))(\#include\s+(<.*?>)(.*)\n)((.*\n)*)%) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt $elided = $5;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt $prefix_extend = $2 . $4;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt $comment = $6;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt $body = $1 . $7;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt } else {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print "$file end\n" if $debug;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt $elided = ""; # stop processing this file.
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt };
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt if ($@ ne "") {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print "$file processing failed: $@\n";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt last;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt last if $elided eq "";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print STDERR "$file checking $elided\n" if $debug;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt if (! $config_h) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt $config_h = 1;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt if ($elided ne "<config.h>") {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print "$file should include <config.h> before any other\n";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt # Always required.
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt next if $elided eq "<config.h>";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt # Can mark in the header file when a #include should stay even
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt # though it might not appear that way otherwise.
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt next if $comment =~ /require|provide|extend|define|contract|explicit/i;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt if ($elided eq "<isc/print.h>") {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt next if m%snprintf%m;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt open(SOURCE, "> $file");
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print SOURCE "$body";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt close(SOURCE);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print "$file elided $elided, compiling\n" if $debug;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt if (compile($objfile) == 0) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt if (! defined($cpp_if)) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt $cpp_if = /^#if/m;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print "$file has CPP #if(def), doublecheck elision recommendations.\n"
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt if $cpp_if;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print "$file does not need $elided\n";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt } elsif ($elided eq "<string.h>") {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print "$file prefer <isc/string.h> to <string.h>\n";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt } continue {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt $prefix .= $prefix_extend;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt rename($savesource, $file);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt rename($saveobj, $objfile);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt}
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntsub
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntcompile($) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt my $obj = $_[0];
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt unless ($obj =~ /\.o$/) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt warn "$obj: not a .o object file\n";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt return;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt my $output = $debug ? "/dev/tty" : "/dev/null";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt open(COMPILE, "make -e $obj 2>&1 >$output |");
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt my $stderr_lines = join('', <COMPILE>);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print $stderr_lines if $debug;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt close(COMPILE);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt unlink($obj);
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt return ($stderr_lines ne "");
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt}
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntsub
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntmain() {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt $| = 1;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt $0 =~ s%.*/%%;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt die "Usage: $0 [-debug]\n" if $help;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt unless (-f 'configure' && -f 'Makefile') {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt die "$0: run from top of bind9 source tree, after configure has run\n";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print "========================\n";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print "building initial objects\n";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print "========================\n";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt # XXX bleah
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt unless (system("make") == 0) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt die "make all failed, couldn't be sure all objects were generated.\n";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt unless (system("cd bin/tests && make -k all_tests") == 0) {
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt warn "make all_tests failed, but pressging on anyway\n";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt }
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt print <<EOF;
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt================================================================
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt starting header elision
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan HuntWARNING: Since this script only removes one header at a time,
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntprograms might compile fine without the header because another
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntheader provides the required information. If that header is
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntalso recommend for removal, then removing both of them could
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntlead to a program that does *not* compile fine. So the only
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntway to be sure is to take them all out and then recompile to
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntsee if there are any residual warnings/errors.
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan HuntSimilar, this program is quite ignorant when it comes to CPP
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt#if/#ifdef. It might well be that a header file does not
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntappear to be necessary because the code that depends on it
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntis not being compiled. To prevent this program from complaining
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntabout such includes in later runs, put a "Required for ..."
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntcomment on the same line as the #include.
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt================================================================
ef421f66f47224a42073deaf087378c5d0c9952eEvan HuntEOF
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt # XXX gcc-specific
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt # Disable builtin memcmp/memcpy/strcmp/strcpy/etc. When they are
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt # available, gcc won't warn about the lack of a prototype in a header
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt # file.
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt $ENV{'CFLAGS'} = "-fno-builtin";
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt do_dir("", ".");
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt}
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt
ef421f66f47224a42073deaf087378c5d0c9952eEvan Huntmain();
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt