Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Suggested change to String option command generation.

I'd like to suggest a change to how String options generate their tool command line contribution. Currently, the build model ignores what it finds in the command attribute.  This is fine for the current use of String options - that is, to collect "additional options" where the user enters a full command or commands.  See the Cygwin Executable "Other optimization flags" and "Other debugging flags" as examples.

I also want to use String options for other individual "options that cannot be easily specified using lists or enumerations", as the managed build design spec says.  For example, Intel C++ has a "Loop Unroll Count" optimization.  The command line syntax is -unrolln.  I want to be able to define a "Loop Unroll Count" property and have the user enter the value of n.  To do that, I would like to define a String option where the command is "-unroll", and the value is whatever is entered by the user into the text field.

The proposal is that the build model does NOT ignore what it finds in the command attribute.  Instead, if the defaultValue attribute is present, and contains a string of length > 0, then the command string (if any) is prepended to the defaultValue string to form the command line string.  

The change is mostly upward compatible as the current uses of String options in the CDT "reference" tool chains do not need to be changed because the command attribute is not specified.  Therefore whether the command is ignored, or not, makes no difference.

The change to the code is small and I have included proposed patches below.

Regards,
Leo Treggiari
Intel Corp.


Index: Tool.java
===================================================================
retrieving revision 1.7
diff -u -r1.7 Tool.java
--- Tool.java	2 Mar 2004 16:35:03 -0000	1.7
+++ Tool.java	3 Mar 2004 16:00:52 -0000
@@ -216,8 +216,11 @@
 					break;
 				
 				case IOption.STRING :
+					String strCmd = option.getCommand();
 					String val = option.getStringValue();
 					if (val.length() > 0) { 
+						if (strCmd != null)
+							buf.append(strCmd);
 						buf.append(val + WHITE_SPACE);
 					}
 					break;


Index: ToolReference.java
===================================================================
retrieving revision 1.6
diff -u -r1.6 ToolReference.java
--- ToolReference.java	2 Mar 2004 15:26:50 -0000	1.6
+++ ToolReference.java	3 Mar 2004 16:01:24 -0000
@@ -182,8 +182,11 @@
 					break;
 				
 				case IOption.STRING :
+					String strCmd = option.getCommand();
 					String val = option.getStringValue();
 					if (val.length() > 0) { 
+						if (strCmd != null)
+							buf.append(strCmd);
 						buf.append(val + WHITE_SPACE);
 					}
 					break;



Back to the top