diff options
author | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2008-10-22 17:04:04 +0000 |
---|---|---|
committer | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2008-10-22 17:04:04 +0000 |
commit | cf51c2bad7ec12f8cd3902b532357f31807c3b2d (patch) | |
tree | a7ced051eb111cf9927011d2d718a3a312b0744e | |
parent | 146c919b64d22ebf8c001388cb84b9b9420165d1 (diff) |
Also preprocess files included via '#include <header.h>' (as opposed to '#include "header.h").
This type of file inclusion is occasionally used throughout Carpet to include
Cactus header files. The Cactus preprocessor had a problem with that
(see thread http://www.cactuscode.org/old/pipermail/developers/2008-October/005633.html) which should be fixed by this patch.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4508 17b73243-c579-4c4c-a9d2-2d5706c11dac
-rwxr-xr-x | lib/sbin/cpp.pl | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/lib/sbin/cpp.pl b/lib/sbin/cpp.pl index a7c62f38..a0ac000c 100755 --- a/lib/sbin/cpp.pl +++ b/lib/sbin/cpp.pl @@ -502,29 +502,30 @@ sub ParseFile if($active) { my $argument = $1; - if($argument =~ m/<[^>]*>\s*/) + + # Allow people to use macros to define name of include file + ($argument,undef) = &ParseAndExpand($argument,$filename,$linenumber); + + if($argument !~ m/\s*(\"|<)(.+)(\"|>)\s*$/) { - # Ignore system includes - print OUTSTREAM "$line\n" if $printline; + print STDERR "Invalid filename $argument in #include directive at $filename:$linenumber\n"; } else { - # Allow people to use macros to define name of include file - ($argument,undef) = &ParseAndExpand($argument,$filename,$linenumber); - - if($argument !~ m/\s*\"(.+)\"\s*$/) + # Process the new file. + # Don't need to pass $active since wouldn't be here if inactive. + # + # Silently ignore files which are included via '#include <header>' + # but couldn't be found in the include path. + my $token = $1; + my ($dummy, $fullpath) = &FindFile($2,$current_wd,\@include_path); + if (-r $fullpath or $token eq '"') { - print STDERR "Invalid filename $argument in #include directive at $filename:$linenumber\n"; + &ProcessFile($2,$filename,$linenumber,$printline); } - else + if($printline && $active) { - # Process the new file. Don't need to pass $active since wouldn't be here if inactive. - &ProcessFile($1,$filename,$linenumber,$printline); - - if($printline && $active) - { - print "# $linenumber \"$filename\"\n"; - } + print "# $linenumber \"$filename\"\n"; } } } |