ooo-build r12077 - in trunk: . bin



Author: thorstenb
Date: Tue Apr  1 15:51:39 2008
New Revision: 12077
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12077&view=rev

Log:
	* bin/strip-guards: some fine-tuning of header guard detection;
	manually added a bunch of common typos (to remove those guards
	when used externally as well)



Modified:
   trunk/ChangeLog
   trunk/bin/strip-guards

Modified: trunk/bin/strip-guards
==============================================================================
--- trunk/bin/strip-guards	(original)
+++ trunk/bin/strip-guards	Tue Apr  1 15:51:39 2008
@@ -31,10 +31,11 @@
         die "Couldn't open $include_fname";
     }
     while ( my $line = <$IN> ) {
-        if ( $line =~ /^#ifndef\s*([^\s\/]*)/ ) {
+        if ( $line =~ /^#\s*ifndef\s+([^\s\/]*)/ ||
+			 $line =~ /^#if\s+!defined\s+([^\s\/]*)/ ) {
             my $guard = $1;
             if ( defined ( $line = <$IN> ) ) {
-                if ( ( $line =~ /^#define\s*([^\s\/]*)/ ) && ( $guard eq $1 ) )
+                if ( ( $line =~ /^#\s*define\s+([^\s\/]*)/ ) && ( $guard eq $1 ) )
                 {
                     close $IN;
                     return $guard;
@@ -89,7 +90,7 @@
         my $buffer = $line;
         my $ok = 1;
 
-        if ( $line =~ /^#include/ ) {
+        if ( $line =~ /^#\s*include/ ) {
             $first_include = 1;
         }
         if ( $first_include && ( $line =~ /^$/ ) ) {
@@ -100,7 +101,7 @@
                 $ok = 0;
             }
         }
-        if ( $ok && ( $line =~ /^#ifndef\s*([^\s\/]*)/ ) ) {
+        if ( $ok && ( $line =~ /^#\s*ifndef\s+([^\s\/]*)/ ) ) {
             if ( defined( $line = <$IN> ) ) {
                 $buffer .= $line;
             }
@@ -109,7 +110,7 @@
             }
 
             my $guard = $1;
-            if ( $ok && ( $line =~ /^#include\s*["<]([^">]*)/ ) ) {
+            if ( $ok && ( $line =~ /^#\s*include\s+["<]([^">]*)/ ) ) {
                 $first_include = 1;
                 my $include_line = $line;
                 my $include = $1;
@@ -121,7 +122,7 @@
                     $ok = 0;
                 }
 
-                if ( $ok && ( $line =~ /^#endif/ ) && guards_include( $guard, $include ) ) {
+                if ( $ok && ( $line =~ /^#\s*endif/ ) && guards_include( $guard, $include ) ) {
                     print $OUT $include_line;
                 }
                 else {
@@ -180,4 +181,30 @@
 }
 
 File::Find::find( {wanted => \&find_guards}, $path );
+
+# add a few common typos
+$includes{"_GEN_HXX"} = "gen.hxx";
+$includes{"_TOOLS_GEN_HXX"} = "gen.hxx";
+$includes{"_SV_H"} = "sv.h";
+$includes{"_VCL_KEYCOD_HXX"} = "keycod.hxx";
+$includes{"_VCL_FONT_HXX"} = "font.hxx";
+$includes{"_VCL_FONT_HXX"} = "font.hxx";
+$includes{"_SV_SALCTYPE_H"} = "salctype.hxx";
+$includes{"_TIME_HXX"} = "time.hxx";
+$includes{"_TIMER_HXX"} = "timer.hxx";
+$includes{"_TOOLS_STRING_HXX"} = "string.hxx";
+$includes{"_GFXLINK_HXX"} = "gfxlink.hxx";
+$includes{"_COLOR_HXX"} = "color.hxx";
+$includes{"_DEBUG_HXX"} = "debug.hxx";
+$includes{"_SVX_ACCESSIBILITY_ACCESSIBLE_COMPONENT_BASE_HXX"} = "AccessibleComponentBase.hxx";
+$includes{"_SD_ACCESSIBILITY_ACCESSIBLE_DOCUMENT_VIEW_BASE_HXX"} = "AccessibleDocumentViewBase.hxx";
+$includes{"_SVX_ACCESSIBILITY_ACCESSIBLE_IVIEW_FORWARDER_HXX"} = "IAccessibleViewForwarder.hxx";
+$includes{"_SVX_ACCESSIBILITY_ACCESSIBLE_IVIEW_FORWARDER_HXX"} = "IAccessibleViewForwarder.hxx";
+$includes{"_SFX_HRC"} = "sfx.hrc";
+$includes{"_SFXSIDS_HRC"} = "sfxsids.hrc";
+$includes{"_RTL_USTRING_H"} = "ustring.h";
+$includes{"_RTL_USTRING_"} = "ustring.hxx";
+$includes{"_RTL_OUSTRING_HXX_"} = "ustring.hxx";
+$includes{"_OSL_INTERLCK_H_"} = "interlck.h";
+
 File::Find::find( {wanted => \&strip_guards}, $path );



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