This is the mail archive of the gcc-patches@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]

brace matching in init_gcc_specs


Rather a long time ago, I had cause to make some tweaks to this
function, and made an error due to mismatched braces.  This formatting
fix makes the braces match inside conditionally compiled areas, and
saves a couple of concat args by using string concatentation where
possible.  Applying to mainline as obvious.  Bootstrapped hundreds of
times over the last year or so.

	* gcc.c (init_gcc_specs): Match braces inside conditionally
	compiled strings.

Index: gcc/gcc.c
===================================================================
--- gcc/gcc.c	(revision 108149)
+++ gcc/gcc.c	(working copy)
@@ -1600,25 +1600,30 @@ init_gcc_specs (struct obstack *obstack,
 {
   char *buf;
 
-  buf = concat ("%{static|static-libgcc:", static_name, " ", eh_name,
-		"}%{!static:%{!static-libgcc:",
+  buf = concat ("%{static|static-libgcc:", static_name, " ", eh_name, "}"
+		"%{!static:%{!static-libgcc:"
 #if USE_LD_AS_NEEDED
-		"%{!shared-libgcc:", static_name,
-		" --as-needed ", shared_name, " --no-as-needed}"
-		"%{shared-libgcc:", shared_name, "%{!shared: ", static_name,
-		"}",
+		"%{!shared-libgcc:",
+		static_name, " --as-needed ", shared_name, " --no-as-needed"
+		"}"
+		"%{shared-libgcc:",
+		shared_name, "%{!shared: ", static_name, "}"
+		"}"
 #else
-		"%{!shared:%{!shared-libgcc:", static_name, " ",
-		eh_name, "}%{shared-libgcc:", shared_name, " ",
-		static_name, "}}%{shared:",
+		"%{!shared:"
+		"%{!shared-libgcc:", static_name, " ", eh_name, "}"
+		"%{shared-libgcc:", shared_name, " ", static_name, "}"
+		"}"
 #ifdef LINK_EH_SPEC
-		"%{shared-libgcc:", shared_name,
-		"}%{!shared-libgcc:", static_name, "}",
+		"%{shared:"
+		"%{shared-libgcc:", shared_name, "}"
+		"%{!shared-libgcc:", static_name, "}"
+		"}"
 #else
-		shared_name,
+		"%{shared:", shared_name, "}"
 #endif
 #endif
-		"}}}", NULL);
+		"}}", NULL);
 
   obstack_grow (obstack, buf, strlen (buf));
   free (buf);

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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