Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Variable expansion bug


I think I've found a bug regarding variable expansion in command strings. Given the following option definition

        <option
              category="..."
              command="--option=${myMacro} ${value}"
              defaultValue="defVal"
              id="..."

${myMacro} will not be expanded when the command line is displayed in the tool's "All options:" box, but it is expanded on the commandline. The offending code seems to be in Tool#getToolCommandFlags:

				case IOption.STRING :{
						String strCmd = option.getCommand();
						String val = option.getStringValue();
						IMacroContextInfo info = provider.getMacroContextInfo(BuildMacroProvider.CONTEXT_FILE, new FileContextData(inputFileLocation, outputFileLocation, option, this));
						if(info != null){
							macroSubstitutor.setMacroContextInfo(info);
							if (val.length() > 0
								&& (val = CdtVariableResolver.resolveToString(val, macroSubstitutor)).length() > 0) {
								sb.append( evaluateCommand( strCmd, val ) );
							}
						}
					}
					break;

The "strCmd" is never expanded before being appended to the string displayed in the GUI, causing the GUI to display "${myMacro}" instead the value of ${myMacro}.

Should I add a bugzilla-report on this?

--
/Jesper




Back to the top