IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 202


Ignore:
Timestamp:
Mar 9, 2004, 5:59:06 PM (22 years ago)
Author:
rhl
Message:

More C-parsing hacks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/utils/check-namespace

    r143 r202  
    33# Check that a set of .h files and .o and .a files satisfy the Pan-STARRS
    44# rules about namespaces.
     5#
     6# This is a real hack; it should be rewritten to parse the .h files correctly. XXX
    57#
    68# Robert Lupton (rhl@astro.princeton.edu)  February 2004
     
    3436Options:
    3537        -h, -?          Print this message
     38        -d              Don't warn about symbols defined in .h files but not found by nm
    3639        -p prefix       Change prefix from ps to \"prefix\"
    3740        -v              Be chatty (repeat for even more output)
     
    4750         $pprefix = "p_$prefix";
    4851      }
     52   } elsif($ARGV[0] eq "-d") {
     53      $allow_missing_definitions = 1;     
    4954   } elsif($ARGV[0] eq "-v") {
    5055      $verbose++;
     
    154159      # and should obey the same rules
    155160      #
    156       if (s/((typedef\s+)?enum)//) {
     161      if (s/((typedef\s+)?enum)(\s*{)/$3/) {
    157162         $typedef = $1;
    158163         $is_enum_typedef = ($typedef =~ /typedef/) ? 1 : 0;
     
    260265      }
    261266
    262       if ($type eq "b") { $type = "d"; } # don't distinguish BSS and Data
     267      if ($type eq "b") { $type = "d"; } # don't distinguish BSS, Common, and Data
    263268      if ($type eq "B") { $type = "D"; }
     269      if ($type eq "C") { $type = "D"; }
    264270
    265271      if ($type !~ /[DT]/i) {   # Data or Text section
     
    295301# Now check for unused declarations
    296302#
    297 foreach $name (sort keys %declarations) {
    298    if (!$used_declarations{$name} && !$typedefs{$name} && !$defines{$name}) {
    299       warn "$name was declared in $declarations{$name} but not defined\n";
    300    }
    301 }
     303if (!$allow_missing_definitions) {
     304   foreach $name (sort keys %declarations) {
     305      if (!$used_declarations{$name} && !$typedefs{$name} && !$defines{$name}) {
     306         warn "$name was declared in $declarations{$name} but not defined\n";
     307      }
     308   }
     309}
Note: See TracChangeset for help on using the changeset viewer.