This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

patch for long lines in makefile


Whenever I open gcc/Makefile in my usual editor, Visual C++ 5.0,
which is often, I get a warning about lines being
wrapped at 2048. I can't edit the file, without fixing this.


It is annoying.


This fixes it.
There are two parts and you can take either or both.
 Either newline for each language, or newline for every few files, or both.
 If there are any quotes, the second part gives up, since they could be quoting
  spaces and lead to breaks at incorrect points.
I only tested this on Cygwin, but could test on a few others if required.
I know it's not a huge issue, but it would be nice to fix.
It sadly took quite a while to get to work. I tried with just one temp file, and failed.
The diff is against the 4.3.1 release.


--- /src/gcc.orig/gcc/configure 2008-05-21 01:54:15.000000000 -0700
+++ /src/gcc/gcc/configure      2008-07-28 01:55:52.692206100 -0700
@@ -17026,13 +17026,31 @@
        all_languages="$all_languages $language"
        all_compilers="$all_compilers $compilers"
        all_outputs="$all_outputs $outputs"
-       all_gtfiles="$all_gtfiles [$subdir] $gtfiles"
+    # Three slashes: Later, via sed/AC_SUBST, first two will become one, third escapes the newline.
+       all_gtfiles="$all_gtfiles"' \\\
+  '"[$subdir] $gtfiles"
 done

 # Pick up gtfiles for c
 gtfiles=
 . ${srcdir}/c-config-lang.in
-all_gtfiles="$all_gtfiles [c] $gtfiles"
+# Three slashes: Later, via sed/AC_SUBST, first two will become one, third escapes the newline.
+all_gtfiles="$all_gtfiles"' \\\
+  '"[c] $gtfiles"
+
+#
+# Wrap every few elements in all_gtfiles, to keep line lengths
+# somewhat down, unless it has any quotes, which confuse things.
+#
+cat < conftest.gt1
+$all_gtfiles
+EOF
+if grep [\"\'] conftest.gt1; then :; else
+  # Six slashes will immediately become three slashes. Later, via sed/AC_SUBST, first two will become one, third escapes the newline.
+  # The seventh slash is for the newline the first time.
+  sed 's/\([^ \\][^ \\]* \)\{5\}/\0\\\\\\\n  /g' conftest.gt1> conftest.gt2
+  all_gtfiles=`cat conftest.gt2`
+fi

 check_languages=
 for language in $all_selected_languages


--- /src/gcc.orig/gcc/configure.ac      2008-05-21 01:54:15.000000000 -0700
+++ /src/gcc/gcc/configure.ac   2008-07-28 01:55:43.270331100 -0700
@@ -3639,13 +3639,33 @@
        all_languages="$all_languages $language"
        all_compilers="$all_compilers $compilers"
        all_outputs="$all_outputs $outputs"
-       all_gtfiles="$all_gtfiles [[$subdir]] $gtfiles"
+    # Three slashes: Later, via sed/AC_SUBST, first two will become one, third escapes the newline.
+       all_gtfiles="$all_gtfiles"' \\\
+  '"[[$subdir]] $gtfiles"
 done

 # Pick up gtfiles for c
 gtfiles=
 . ${srcdir}/c-config-lang.in
-all_gtfiles="$all_gtfiles [[c]] $gtfiles"
+# Three slashes: Later, via sed/AC_SUBST, first two will become one, third escapes the newline.
+all_gtfiles="$all_gtfiles"' \\\
+  '"[[c]] $gtfiles"
+
+#
+# Wrap every few elements in all_gtfiles, to keep line lengths
+# somewhat down, unless it has any quotes, which confuse things.
+#
+cat < conftest.gt1
+$all_gtfiles
+EOF
+changequote(,)dnl
+if grep [\"\'] conftest.gt1; then :; else
+  # Six slashes will immediately become three slashes. Later, via sed/AC_SUBST, first two will become one, third escapes the newline.
+  # The seventh slash is for the newline the first time.
+  sed 's/\([^ \\][^ \\]* \)\{5\}/\0\\\\\\\n  /g' conftest.gt1> conftest.gt2
+  all_gtfiles=`cat conftest.gt2`
+fi
+changequote([,])dnl

 check_languages=
 for language in $all_selected_languages


Thanks,
 - Jay

Attachment: diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]