cons-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: System includes


From: Gary Oberbrunner
Subject: Re: System includes
Date: Thu, 17 Jan 2002 08:53:33 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:0.9.6) Gecko/20011120

I had some problems with cons not getting my includes a while ago; of course it was my misconfiguration problem, but it wasn't easy to track down. So I wrote this little patch for cons to add a -wi (warn about missing includes) command-line arg; it tells you all the include files it can't find in its idea of CPPPATH, and what it's using for that path. It makes this kind of thing much easier to debug. Anything it says it can't find that you think it should, you just need to add to CPPPATH.

The patch is attached; it's against a modified 2.3 so the line numbers may not match exactly.

-- Gary Oberbrunner
*** c:/tmp/cons.old     Thu Jan 17 08:52:00 2002
--- c:/tmp/cons.new     Thu Jan 17 08:51:44 2002
***************
*** 25,30 ****
--- 25,31 ----
  # Note: includes dynamictargets (AddTarget) patch.
  # Note: includes AtEnd patch.
  # Note: includes build::multiple patch from Steven Knight.
+ # Note: includes -wi (warn if missing includes) patch.
  
  # Cons: A Software Construction Tool.
  # Copyright (c) 1996-2001 Free Software Foundation, Inc.
***************
*** 209,214 ****
--- 210,216 ----
                                #   w/files.
  $param::conscript_chdir = 0;  # Change dir to Conscript directory
  $param::quiet = 0;            # should we show the command being executed.
+ $param::warn_missing_include = 0; # warn about missing include files
  
  @param::defaults = ();
  
***************
*** 339,344 ****
--- 341,347 ----
                    't' =>    sub { $param::traverse = 1; },
                    'v' =>    sub { print($version); },
                    'V' =>    sub { print($version), exit(0); },
+                   'wi' =>   sub { $param::warn_missing_include = 1; },
                    'x' =>    sub { print($usage), exit 0; },
                );
  
***************
*** 2304,2328 ****
  
      my $name;
      for $name (@$angles) {
!       my $dir;
        for $dir (@shortpath) {
            my($include) = $dir->lookup_accessible($name);
            if ($include) {
                push(@includes, $include) unless $include->ignore;
                last;
            }
        }
      }
  
      for $name (@$quotes) {
!       my $dir;
        for $dir(@longpath) {
            my($include) = $dir->lookup_accessible($name);
            if ($include) {
                push(@includes, $include) unless $include->ignore;
                last;
            }
        }
      }
  
      return @includes
--- 2307,2342 ----
  
      my $name;
      for $name (@$angles) {
!       my $dir, $found;
        for $dir (@shortpath) {
            my($include) = $dir->lookup_accessible($name);
            if ($include) {
                push(@includes, $include) unless $include->ignore;
+               $found = 1;
                last;
            }
        }
+       if ($param::warn_missing_include && !$found) {
+           print "Cons warning: missing include file <$name> in ".
+               $file->path."\n";
+           print "  Not found in ",join(', ', map {$_->path} @shortpath),"\n";
+       }
      }
  
      for $name (@$quotes) {
!       my $dir, $found;
        for $dir(@longpath) {
            my($include) = $dir->lookup_accessible($name);
            if ($include) {
                push(@includes, $include) unless $include->ignore;
+               $found = 1;
                last;
            }
        }
+       if ($param::warn_missing_include && !$found) {
+           print "Cons warning: missing include file \"$name\" in 
".$file->path."\n";
+           print "  Not found in ",join(', ', map {$_->path} @longpath),"\n";
+       }
      }
  
      return @includes
***************
*** 6676,6681 ****
--- 6690,6700 ----
  =item C<-wf> <file>
  
  Write all filenames considered into I<file>.
+ 
+ =item C<-wi> <file>
+ 
+ Warn about missing include files: these are files which cons couldn't
+ find in your env's C<CPPPATH> while scanning a source file.
  
  =item C<-x>
  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]