Do not trash single-line C-style comments
authorLoren J. Rittle <ljrittle@acm.org>
Tue, 17 Aug 1999 18:32:32 +0000 (18:32 +0000)
committerBruce Korb <korbb@gcc.gnu.org>
Tue, 17 Aug 1999 18:32:32 +0000 (18:32 +0000)
From-SVN: r28735

gcc/ChangeLog
gcc/fixinc/fixincl.sh
gcc/fixinc/fixincl.x
gcc/fixinc/inclhack.def
gcc/fixinc/inclhack.sh

index 0758117e34d06a1322b50e077454c231dfa9c60c..c2b03a255c49f3875e4c06e2735561de0ae9b747 100644 (file)
@@ -1,3 +1,8 @@
+Tue Aug 17 01:40:54 1999  Loren Rittle  <ljrittle@acm.org>
+
+       * fixinc/inclhack.def (no_double_slash): Do not trash single-line
+       C-style comments.  Do not lose the character before double slash.
+
 Mon Aug 16 18:08:22 EDT 1999  Andrew MacLeod  <amacleod@cygnus.com>
 
        * basic-block.h (struct edge_list): Stucture to maintain a vector
index 9e9064e579e2a46997b1847f68fdb1564076619c..83d66919f0b4c0c939ee9e0a7f0fbac1e3b67bcf 100755 (executable)
@@ -6,7 +6,7 @@
 # files which are fixed to work correctly with ANSI C and placed in a
 # directory that GNU C will search.
 #
-# This script contains 105 fixup scripts.
+# This script contains 106 fixup scripts.
 #
 # See README-fixinc for more information.
 #
index 8fd28805f9d31a4cb9af5b8d455e99f4446e52a7..d17614b98594a8516688cbde384df9505dedc3d1 100644 (file)
@@ -709,7 +709,8 @@ tTestDesc aNo_Double_SlashTests[] = {
  */
 const char* apzNo_Double_SlashPatch[] = { "sed",
     "-e", "s,^//.*$,,",
-    "-e", "s,[^:]//[^\"].*$,,",
+    "-e", "s,\\(/\\*.*\\)//\\(.*\\*/\\),\\1/ /\\2,g",
+    "-e", "s,\\([^:]\\)//[^\"].*$,\\1,",
     (char*)NULL };
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
index 17da222cbaeeb9cf1785bed4167182ceace04d88..fbdc737a8555a033a9a793b6005c7c074870482f 100644 (file)
@@ -432,12 +432,14 @@ fix = {
     /*
      *  Test that the file-to-fix does not from a C++ directory
      *  Also, only accept double slashes that are not part of URL's
+     *  and do not appear to be within a single-line C-style comment
      *  and are not the end of a quoted string.
      */
     test   = ' -z "`echo ${file} | egrep \'(CC|cxx|\+\+)/\'`"';
     select = '(^|[^:])//[^"*]';
     sed    = 's,^//.*$,,';
-    sed    = 's,[^:]//[^"].*$,,';
+    sed    = 's,\(/\*.*\)//\(.*\*/\),\1/ /\2,g';
+    sed    = 's,\([^:]\)//[^"].*$,\1,';
 };
 
 
index 292c96791068d0d706cee1de3ab5083ab2d4e42e..457fc9702c85aeb8f2d477f37fb0a43abd1ca673 100755 (executable)
@@ -844,7 +844,8 @@ _EOF_
     else infile=${DESTFILE} ; fi 
 
     sed -e 's,^//.*$,,' \
-        -e 's,[^:]//[^"].*$,,' \
+        -e 's,\(/\*.*\)//\(.*\*/\),\1/ /\2,g' \
+        -e 's,\([^:]\)//[^"].*$,\1,' \
           < $infile > ${DESTDIR}/fixinc.tmp
     rm -f ${DESTFILE}
     mv -f ${DESTDIR}/fixinc.tmp ${DESTFILE}