Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Recoskie2009-10-28 12:54:00 -0400
committerChris Recoskie2009-10-28 12:54:00 -0400
commit3bc854ae15292069bc4790fa8741164727a958e7 (patch)
tree1524def723cbe64dfc4440115de856d870dd37d7
parentf08064a05e4d044eb2997dbdb38561737f62be0a (diff)
downloadorg.eclipse.cdt-3bc854ae15292069bc4790fa8741164727a958e7.tar.gz
org.eclipse.cdt-3bc854ae15292069bc4790fa8741164727a958e7.tar.xz
org.eclipse.cdt-3bc854ae15292069bc4790fa8741164727a958e7.zip
backport v10.1 support, reorganize/improve scanner info support
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.core.prefs245
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.ui.prefs5
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/AbstractXLCBuildOutputParser.java412
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerFileXLCScannerInfoCollector.java53
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerProjectXLCScannerInfoCollector.java (renamed from xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/DefaultXlCScannerInfoCollector.java)12
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCBuildOutputParserUtility.java712
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerFileBuildOutputParser.java117
-rw-r--r--xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerProjectBuildOutputParser.java173
8 files changed, 1479 insertions, 250 deletions
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.core.prefs b/xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.core.prefs
index 1e6493a155..d2e238245f 100644
--- a/xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.core.prefs
+++ b/xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.core.prefs
@@ -1,248 +1,5 @@
-#Thu Oct 04 14:01:28 BRT 2007
+#Tue Sep 29 13:43:38 EDT 2009
eclipse.preferences.version=1
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=1
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
org.eclipse.jdt.core.formatter.comment.format_comments=true
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
-org.eclipse.jdt.core.formatter.comment.line_length=80
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
-org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=80
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=tab
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.ui.prefs b/xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.ui.prefs
index cc1ab0b907..819de56145 100644
--- a/xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.ui.prefs
+++ b/xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.ui.prefs
@@ -1,5 +1,4 @@
-#Thu Oct 04 14:01:28 BRT 2007
+#Tue Sep 29 13:43:38 EDT 2009
eclipse.preferences.version=1
-formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile
-formatter_settings_version=10
+formatter_settings_version=11
internal.default.compliance=default
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/AbstractXLCBuildOutputParser.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/AbstractXLCBuildOutputParser.java
new file mode 100644
index 0000000000..783aef0316
--- /dev/null
+++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/AbstractXLCBuildOutputParser.java
@@ -0,0 +1,412 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.make.xlc.core.scannerconfig;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.IMarkerGenerator;
+import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
+import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser;
+import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
+import org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParserUtility;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
+import org.eclipse.cdt.make.internal.core.scannerconfig2.SCProfileInstance;
+import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
+import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfile.BuildOutputProvider;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.core.runtime.content.IContentTypeManager;
+
+import sun.misc.FpUtils;
+
+/**
+ * @author crecoskie
+ *
+ */
+public abstract class AbstractXLCBuildOutputParser implements IScannerInfoConsoleParser {
+
+ protected static final String[] COMPILER_INVOCATION = { "xlc", "xlC"//$NON-NLS-1$ //$NON-NLS-2$
+ };
+ protected static final String DASHIDASH = "-I-"; //$NON-NLS-1$
+ protected static final String DASHI = "-I"; //$NON-NLS-1$
+ protected static final String DASHD = "-D"; //$NON-NLS-1$
+
+ protected IProject fProject;
+ protected IScannerInfoCollector fCollector;
+ protected IPath fWorkingDir;
+ protected IMarkerGenerator fMarkerGenerator;
+ protected XLCBuildOutputParserUtility fUtility;
+
+ protected boolean fBMultiline = false;
+ protected String fSMultiline = ""; //$NON-NLS-1$
+
+ protected String[] fCompilerCommands = { "xlc", "xlC" };
+
+ /**
+ * @return Returns the fProject.
+ */
+ protected IProject getProject() {
+ return fProject;
+ }
+
+ /**
+ * @return Returns the fCollector.
+ */
+ protected IScannerInfoCollector getCollector() {
+ return fCollector;
+ }
+
+ public void startup(IProject project, IScannerInfoCollector collector) {
+ fProject = project;
+ fCollector = collector;
+ fCompilerCommands = computeCompilerCommands();
+ }
+
+ /**
+ * Returns array of additional compiler commands to look for
+ *
+ * @return String[]
+ */
+ protected String[] computeCompilerCommands() {
+ if (fProject != null) {
+ SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().getSCProfileInstance(
+ fProject, ScannerConfigProfileManager.NULL_PROFILE_ID);
+ BuildOutputProvider boProvider = profileInstance.getProfile().getBuildOutputProviderElement();
+ if (boProvider != null) {
+ String compilerCommandsString = boProvider.getScannerInfoConsoleParser().getCompilerCommands();
+ if (compilerCommandsString != null && compilerCommandsString.length() > 0) {
+ String[] compilerCommands = compilerCommandsString.split(",\\s*"); //$NON-NLS-1$
+ if (compilerCommands.length > 0) {
+ String[] compilerInvocation = new String[COMPILER_INVOCATION.length + compilerCommands.length];
+ System.arraycopy(COMPILER_INVOCATION, 0, compilerInvocation, 0, COMPILER_INVOCATION.length);
+ System.arraycopy(compilerCommands, 0, compilerInvocation, COMPILER_INVOCATION.length,
+ compilerCommands.length);
+ return compilerInvocation;
+ }
+ }
+ }
+ }
+ return COMPILER_INVOCATION;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#processLine
+ * (java.lang.String)
+ */
+ public boolean processLine(String line) {
+ boolean rc = false;
+ int lineBreakPos = line.length() - 1;
+ char[] lineChars = line.toCharArray();
+ while (lineBreakPos >= 0 && Character.isWhitespace(lineChars[lineBreakPos])) {
+ lineBreakPos--;
+ }
+ if (lineBreakPos >= 0) {
+ if (lineChars[lineBreakPos] != '\\' || (lineBreakPos > 0 && lineChars[lineBreakPos - 1] == '\\')) {
+ lineBreakPos = -1;
+ }
+ }
+ // check for multiline commands (ends with '\')
+ if (lineBreakPos >= 0) {
+ fSMultiline += line.substring(0, lineBreakPos);
+ fBMultiline = true;
+ return rc;
+ }
+ if (fBMultiline) {
+ line = fSMultiline + line;
+ fBMultiline = false;
+ fSMultiline = ""; //$NON-NLS-1$
+ }
+ line = line.trim();
+ TraceUtil.outputTrace("XLCBuildOutputParser parsing line: [", line, "]"); //$NON-NLS-1$ //$NON-NLS-2$
+ // make\[[0-9]*\]: error_desc
+ int firstColon = line.indexOf(':');
+ String make = line.substring(0, firstColon + 1);
+ if (firstColon != -1 && make.indexOf("make") != -1) { //$NON-NLS-1$
+ boolean enter = false;
+ String msg = line.substring(firstColon + 1).trim();
+ if ((enter = msg.startsWith("Entering directory")) || //$NON-NLS-1$
+ (msg.startsWith("Leaving directory"))) { //$NON-NLS-1$
+ int s = msg.indexOf('`');
+ int e = msg.indexOf('\'');
+ if (s != -1 && e != -1) {
+ String dir = msg.substring(s + 1, e);
+ if (getUtility() != null) {
+ getUtility().changeMakeDirectory(dir, getDirectoryLevel(line), enter);
+ }
+ return rc;
+ }
+ }
+ }
+ // call sublclass to process a single line
+ return processSingleLine(line.trim());
+ }
+
+ protected XLCBuildOutputParserUtility getUtility() {
+ if (fUtility == null)
+ fUtility = new XLCBuildOutputParserUtility(fProject, fWorkingDir, fMarkerGenerator);
+
+ return fUtility;
+ }
+
+ protected int getDirectoryLevel(String line) {
+ int s = line.indexOf('[');
+ int num = 0;
+ if (s != -1) {
+ int e = line.indexOf(']');
+ String number = line.substring(s + 1, e).trim();
+ try {
+ num = Integer.parseInt(number);
+ } catch (NumberFormatException exc) {
+ }
+ }
+ return num;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#shutdown
+ * ()
+ */
+ public void shutdown() {
+ if (getUtility() != null) {
+ getUtility().reportProblems();
+ }
+ }
+
+ /**
+ * Tokenizes a line into an array of commands. Commands are separated by
+ * ';', '&&' or '||'. Tokens are separated by whitespace unless found inside
+ * of quotes, back-quotes, or double quotes. Outside of single-, double- or
+ * back-quotes a backslash escapes white-spaces, all quotes, the backslash,
+ * '&' and '|'. A backslash used for escaping is removed. Quotes other than
+ * the back-quote plus '&&', '||', ';' are removed, also.
+ *
+ * @param line
+ * to tokenize
+ * @return array of commands
+ */
+ protected String[][] tokenize(String line, boolean escapeInsideDoubleQuotes) {
+ ArrayList<String[]> commands = new ArrayList<String[]>();
+ ArrayList<String> tokens = new ArrayList<String>();
+ StringBuffer token = new StringBuffer();
+
+ final char[] input = line.toCharArray();
+ boolean nextEscaped = false;
+ char currentQuote = 0;
+ for (int i = 0; i < input.length; i++) {
+ final char c = input[i];
+ final boolean escaped = nextEscaped;
+ nextEscaped = false;
+
+ if (currentQuote != 0) {
+ if (c == currentQuote) {
+ if (escaped) {
+ token.append(c);
+ } else {
+ if (c == '`') {
+ token.append(c); // preserve back-quotes
+ }
+ currentQuote = 0;
+ }
+ } else {
+ if (escapeInsideDoubleQuotes && currentQuote == '"' && c == '\\') {
+ nextEscaped = !escaped;
+ if (escaped) {
+ token.append(c);
+ }
+ } else {
+ if (escaped) {
+ token.append('\\');
+ }
+ token.append(c);
+ }
+ }
+ } else {
+ switch (c) {
+ case '\\':
+ if (escaped) {
+ token.append(c);
+ } else {
+ nextEscaped = true;
+ }
+ break;
+ case '\'':
+ case '"':
+ case '`':
+ if (escaped) {
+ token.append(c);
+ } else {
+ if (c == '`') {
+ token.append(c);
+ }
+ currentQuote = c;
+ }
+ break;
+ case ';':
+ if (escaped) {
+ token.append(c);
+ } else {
+ endCommand(token, tokens, commands);
+ }
+ break;
+ case '&':
+ case '|':
+ if (escaped || i + 1 >= input.length || input[i + 1] != c) {
+ token.append(c);
+ } else {
+ i++;
+ endCommand(token, tokens, commands);
+ }
+ break;
+
+ default:
+ if (Character.isWhitespace(c)) {
+ if (escaped) {
+ token.append(c);
+ } else {
+ endToken(token, tokens);
+ }
+ } else {
+ if (escaped) {
+ token.append('\\'); // for windows put backslash
+ // back onto the token.
+ }
+ token.append(c);
+ }
+ }
+ }
+ }
+ endCommand(token, tokens, commands);
+ return commands.toArray(new String[commands.size()][]);
+ }
+
+ protected void endCommand(StringBuffer token, ArrayList<String> tokens, ArrayList<String[]> commands) {
+ endToken(token, tokens);
+ if (!tokens.isEmpty()) {
+ commands.add(tokens.toArray(new String[tokens.size()]));
+ tokens.clear();
+ }
+ }
+
+ protected void endToken(StringBuffer token, ArrayList<String> tokens) {
+ if (token.length() > 0) {
+ tokens.add(token.toString());
+ token.setLength(0);
+ }
+ }
+
+ protected boolean processSingleLine(String line) {
+ boolean rc = false;
+ String[][] tokens = tokenize(line, true);
+ for (int i = 0; i < tokens.length; i++) {
+ String[] command = tokens[i];
+ if (processCommand(command)) {
+ rc = true;
+ } else { // go inside quotes, if the compiler is called per wrapper
+ // or shell script
+ for (int j = 0; j < command.length; j++) {
+ String[][] subtokens = tokenize(command[j], true);
+ for (int k = 0; k < subtokens.length; k++) {
+ String[] subcommand = subtokens[k];
+ if (subcommand.length > 1) { // only proceed if there is
+ // any additional info
+ if (processCommand(subcommand)) {
+ rc = true;
+ }
+ }
+ }
+ }
+ }
+ }
+ return rc;
+ }
+
+ protected int findCompilerInvocation(String[] tokens) {
+ for (int i = 0; i < tokens.length; i++) {
+ final String token = tokens[i].toLowerCase();
+ final int searchFromOffset = Math.max(token.lastIndexOf('/'), token.lastIndexOf('\\')) + 1;
+ for (int j = 0; j < fCompilerCommands.length; j++) {
+ if (token.indexOf(fCompilerCommands[j], searchFromOffset) != -1) {
+ return i;
+ }
+ }
+ }
+ return -1;
+ }
+
+ public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector,
+ IMarkerGenerator markerGenerator) {
+ fProject = project;
+ fWorkingDir = workingDirectory;
+ fCollector = collector;
+ fMarkerGenerator = markerGenerator;
+
+ }
+
+ abstract protected boolean processCommand(String[] tokens);
+
+ protected List<String> getFileExtensionsList() {
+ IContentTypeManager manager = Platform.getContentTypeManager();
+ List<String> extensions = new LinkedList<String>();
+ IContentType cSource = manager.getContentType(CCorePlugin.CONTENT_TYPE_CSOURCE);
+ IContentType cppSource = manager.getContentType(CCorePlugin.CONTENT_TYPE_CXXSOURCE);
+
+ String[] cExtensions = cSource.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
+ String[] cppExtensions = cppSource.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
+
+ for (int k = 0; k < cExtensions.length; k++) {
+ extensions.add("." + cExtensions[k]);
+ }
+
+ for (int k = 0; k < cppExtensions.length; k++) {
+ extensions.add("." + cppExtensions[k]);
+ }
+
+ return extensions;
+ }
+
+ protected String[] getFileExtensions() {
+ IContentTypeManager manager = Platform.getContentTypeManager();
+ List<String> extensions = new LinkedList<String>();
+ IContentType cSource = manager.getContentType(CCorePlugin.CONTENT_TYPE_CSOURCE);
+ IContentType cppSource = manager.getContentType(CCorePlugin.CONTENT_TYPE_CXXSOURCE);
+
+ String[] cExtensions = cSource.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
+ String[] cppExtensions = cppSource.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
+
+ for (int k = 0; k < cExtensions.length; k++) {
+ extensions.add("." + cExtensions[k]);
+ }
+
+ for (int k = 0; k < cppExtensions.length; k++) {
+ extensions.add("." + cppExtensions[k]);
+ }
+
+ return extensions.toArray(new String[0]);
+ }
+
+}
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerFileXLCScannerInfoCollector.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerFileXLCScannerInfoCollector.java
new file mode 100644
index 0000000000..1021e7e6ed
--- /dev/null
+++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerFileXLCScannerInfoCollector.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.make.xlc.core.scannerconfig;
+
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3;
+import org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector;
+import org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector;
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * @author laggarcia
+ *
+ */
+public class PerFileXLCScannerInfoCollector extends PerFileSICollector
+ implements IScannerInfoCollector3, IManagedScannerInfoCollector {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector#getDefinedSymbols()
+ */
+ public Map getDefinedSymbols() {
+ return getAllSymbols();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector#getIncludePaths()
+ */
+ public List getIncludePaths() {
+ List<String> pathStrings = new LinkedList<String>();
+
+ List<IPath> paths = Arrays.asList(getAllIncludePaths(INCLUDE_PATH));
+ paths.addAll(Arrays.asList(getAllIncludePaths(QUOTE_INCLUDE_PATH)));
+
+ for(IPath path : paths) {
+ pathStrings.add(path.toString());
+ }
+
+ return pathStrings;
+ }
+
+} \ No newline at end of file
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/DefaultXlCScannerInfoCollector.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerProjectXLCScannerInfoCollector.java
index d76fecee47..5cd2469976 100644
--- a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/DefaultXlCScannerInfoCollector.java
+++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/PerProjectXLCScannerInfoCollector.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 20089 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,15 +10,21 @@
*******************************************************************************/
package org.eclipse.cdt.make.xlc.core.scannerconfig;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3;
+import org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector;
import org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector;
import org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector;
+import org.eclipse.core.runtime.IPath;
/**
* @author laggarcia
*
*/
-public class DefaultXlCScannerInfoCollector extends PerProjectSICollector
+public class PerProjectXLCScannerInfoCollector extends PerProjectSICollector
implements IScannerInfoCollector3, IManagedScannerInfoCollector {
-
}
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCBuildOutputParserUtility.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCBuildOutputParserUtility.java
new file mode 100644
index 0000000000..444958debf
--- /dev/null
+++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCBuildOutputParserUtility.java
@@ -0,0 +1,712 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.make.xlc.core.scannerconfig;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import org.eclipse.cdt.core.IMarkerGenerator;
+import org.eclipse.cdt.core.ProblemMarkerInfo;
+import org.eclipse.cdt.make.core.MakeCorePlugin;
+import org.eclipse.cdt.make.internal.core.MakeMessages;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.KVStringPair;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.SCDOptionsEnum;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
+import org.eclipse.cdt.utils.FileSystemUtilityManager;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+/**
+ * @author crecoskie
+ *
+ */
+public class XLCBuildOutputParserUtility {
+ protected class Problem {
+ protected String description;
+ protected IResource file;
+ protected int lineNumber;
+ protected int severity;
+ protected String variableName;
+
+ public Problem(IResource file, int lineNumber, String desciption, int severity, String variableName) {
+ this.file = file;
+ this.lineNumber = lineNumber;
+ this.description = desciption;
+ this.severity = severity;
+ this.variableName = variableName;
+ }
+ }
+ public static IPath convertCygpath(IPath path) {
+ if (path.segmentCount() > 1 && path.segment(0).equals("cygdrive")) { //$NON-NLS-1$
+ StringBuffer buf = new StringBuffer(2);
+ buf.append(Character.toUpperCase(path.segment(1).charAt(0)));
+ buf.append(':');
+ path = path.removeFirstSegments(2);
+ path = path.setDevice(buf.toString());
+ path = path.makeAbsolute();
+ }
+ return path;
+ }
+ private List commandsList2;
+ private int commandsN = 0;
+ private List compiledFileList;
+
+ private Map directoryCommandListMap;
+
+ private IPath fBaseDirectory;
+ private String fDefaultMacroDefinitionValue= "1"; //$NON-NLS-1$
+ private Vector<IPath> fDirectoryStack;
+ private ArrayList<Problem> fErrors;
+ private int filesN = 0;
+
+ private IMarkerGenerator fMarkerGenerator;
+
+ private IProject project;
+
+ private int workingDirsN = 0;
+
+ /*
+ * For tracking the location of files being compiled
+ */
+ private Map<String, IFile> fFilesInProject;
+ private List<String> fCollectedFiles;
+ private List<String> fNameConflicts;
+
+ /**
+ *
+ */
+ public XLCBuildOutputParserUtility(IProject project, IPath workingDirectory,
+ IMarkerGenerator markerGenerator) {
+ fDirectoryStack = new Vector<IPath>();
+ fErrors = new ArrayList<Problem>();
+ this.project = project;
+ fBaseDirectory = getPathForResource(project);
+ if (workingDirectory != null) {
+ pushDirectory(workingDirectory);
+ }
+ }
+
+ private IPath getPathForResource(IResource resource) {
+ // TODO: when the file system utility stuff is in, this will have to call it to get the path
+ // for now, get the path from the URI
+ URI locationURI = resource.getLocationURI();
+ IPath path = new Path(locationURI.getPath());
+ return path;
+ }
+
+ /**
+ * Adds a mapping filename, generic_command
+ * @param longFileName
+ * @param genericLine
+ */
+ void addGenericCommandForFile(String longFileName, String genericCommand) {
+ // if a file name has already been added once, return
+ if (compiledFileList.contains(longFileName))
+ return;
+ compiledFileList.add(longFileName);
+
+ String workingDir = getWorkingDirectory().toString();
+ List directoryCommandList = (List) directoryCommandListMap.get(workingDir);
+ if (directoryCommandList == null) {
+ directoryCommandList = new ArrayList();
+ directoryCommandListMap.put(workingDir, directoryCommandList);
+ ++workingDirsN;
+ }
+ Map command21FileListMap = null;
+ for (Iterator i = directoryCommandList.iterator(); i.hasNext(); ) {
+ command21FileListMap = (Map) i.next();
+ List fileList = (List) command21FileListMap.get(genericCommand);
+ if (fileList != null) {
+ if (!fileList.contains(longFileName)) {
+ fileList.add(longFileName);
+ ++filesN;
+ }
+ return;
+ }
+ }
+ command21FileListMap = new HashMap(1);
+ directoryCommandList.add(command21FileListMap);
+ ++commandsN;
+ List fileList = new ArrayList();
+ command21FileListMap.put(genericCommand, fileList);
+ fileList.add(longFileName);
+ ++filesN;
+ }
+
+ /**
+ * Adds a mapping command line -> file, this time without a dir
+ * @param longFileName
+ * @param genericLine
+ */
+ void addGenericCommandForFile2(String longFileName, String genericLine) {
+ // if a file name has already been added once, return
+ if (compiledFileList.contains(longFileName))
+ return;
+ compiledFileList.add(longFileName);
+
+ String[] tokens = genericLine.split("\\s+"); //$NON-NLS-1$
+ CCommandDSC command = getNewCCommandDSC(tokens, 0, false); // assume .c file type
+ int index = commandsList2.indexOf(command);
+ if (index == -1) {
+ commandsList2.add(command);
+ ++commandsN;
+ }
+ else {
+ command = (CCommandDSC) commandsList2.get(index);
+ }
+// // add a file
+// command.addFile(longFileName);
+// ++filesN;
+ }
+
+ public void changeMakeDirectory(String dir, int dirLevel, boolean enterDir) {
+ if (enterDir) {
+ /* Sometimes make screws up the output, so
+ * "leave" events can't be seen. Double-check level
+ * here.
+ */
+ for (int parseLevel = getDirectoryLevel(); dirLevel < parseLevel; parseLevel = getDirectoryLevel()) {
+ popDirectory();
+ }
+ pushDirectory(new Path(dir));
+ } else {
+ popDirectory();
+ /* Could check to see if they match */
+ }
+ }
+
+ /**
+ * Called by the console line parsers to generate a problem marker.
+ */
+ public void generateMarker(IResource file, int lineNumber, String desc, int severity, String varName) {
+ // No need to collect markers if marker generator is not present
+ if (fMarkerGenerator != null) {
+ Problem problem = new Problem(file, lineNumber, desc, severity, varName);
+ fErrors.add(problem);
+ }
+ }
+
+ /**
+ *
+ */
+ void generateReport() {
+ TraceUtil.metricsTrace("Stats for directory ", //$NON-NLS-1$
+ "Generic command: '", "' applicable for:", //$NON-NLS-1$ //$NON-NLS-2$
+ directoryCommandListMap);
+ TraceUtil.summaryTrace("Discovery summary", workingDirsN, commandsN, filesN); //$NON-NLS-1$
+ }
+
+ /**
+ * @param filePath : String
+ * @return filePath : IPath - not <code>null</code>
+ */
+ public IPath getAbsolutePath(String filePath) {
+ IPath pFilePath;
+ if (filePath.startsWith("/")) { //$NON-NLS-1$
+ return convertCygpath(new Path(filePath));
+ }
+ else if (filePath.startsWith("\\") || //$NON-NLS-1$
+ (!filePath.startsWith(".") && //$NON-NLS-1$
+ filePath.length() > 2 && filePath.charAt(1) == ':' &&
+ (filePath.charAt(2) == '\\' || filePath.charAt(2) == '/'))) {
+ // absolute path
+ pFilePath = new Path(filePath);
+ }
+ else {
+ // relative path
+ IPath cwd = getWorkingDirectory();
+ if (!cwd.isAbsolute()) {
+ cwd = getBaseDirectory().append(cwd);
+ }
+ if (filePath.startsWith("`pwd`")) { //$NON-NLS-1$
+ if (filePath.length() > 5 && (filePath.charAt(5) == '/' || filePath.charAt(5) == '\\')) {
+ filePath = filePath.substring(6);
+ }
+ else {
+ filePath = filePath.substring(5);
+ }
+ }
+ pFilePath = cwd.append(filePath);
+ }
+ return pFilePath;
+ }
+ /**
+ * @return Returns the fBaseDirectory.
+ */
+ public IPath getBaseDirectory() {
+ return fBaseDirectory;
+ }
+
+ /**
+ * Returns all CCommandDSC collected so far.
+ * Currently this list is not filled, so it will always return an empty list.
+ * @return List of CCommandDSC
+ */
+ public List getCCommandDSCList() {
+ return new ArrayList(commandsList2);
+ }
+
+ protected int getDirectoryLevel() {
+ return fDirectoryStack.size();
+ }
+ /**
+ * @return Returns the fDirectoryStack.
+ */
+ protected Vector<IPath> getDirectoryStack() {
+ return fDirectoryStack;
+ }
+ /**
+ * @return Returns the fErrors.
+ */
+ protected ArrayList<Problem> getErrors() {
+ return fErrors;
+ }
+ /**
+ * @return Returns the fMarkerGenerator.
+ */
+ protected IMarkerGenerator getMarkerGenerator() {
+ return fMarkerGenerator;
+ }
+
+ /**
+ * @param genericLine
+ * @param cppFileType
+ * @return CCommandDSC compile command description
+ */
+ public CCommandDSC getNewCCommandDSC(String[] tokens, final int idxOfCompilerCommand, boolean cppFileType) {
+ ArrayList dirafter = new ArrayList();
+ ArrayList includes = new ArrayList();
+ CCommandDSC command = new CCommandDSC(cppFileType, getProject());
+ command.addSCOption(new KVStringPair(SCDOptionsEnum.COMMAND.toString(), tokens[idxOfCompilerCommand]));
+ for (int i = idxOfCompilerCommand+1; i < tokens.length; ++i) {
+ String token = tokens[i];
+ //Target specific options: see GccScannerInfoConsoleParser
+ if (token.startsWith("-m") || //$NON-NLS-1$
+ token.equals("-ansi") || //$NON-NLS-1$
+ token.equals("-posix") || //$NON-NLS-1$
+ token.equals("-pthread") || //$NON-NLS-1$
+ token.startsWith("-O") || //$NON-NLS-1$
+ token.equals("-fno-inline") || //$NON-NLS-1$
+ token.startsWith("-finline") || //$NON-NLS-1$
+ token.equals("-fno-exceptions") || //$NON-NLS-1$
+ token.equals("-fexceptions") || //$NON-NLS-1$
+ token.equals("-fshort-wchar") || //$NON-NLS-1$
+ token.equals("-fshort-double") || //$NON-NLS-1$
+ token.equals("-fno-signed-char") || //$NON-NLS-1$
+ token.equals("-fsigned-char") || //$NON-NLS-1$
+ token.startsWith("-fabi-version=") //$NON-NLS-1$
+ ) {
+ command.addSCOption(new KVStringPair(SCDOptionsEnum.COMMAND.toString(), token));
+ continue;
+ }
+ for (int j = SCDOptionsEnum.MIN; j <= SCDOptionsEnum.MAX; ++j) {
+ final SCDOptionsEnum optionKind = SCDOptionsEnum.getSCDOptionsEnum(j);
+ if (token.startsWith(optionKind.toString())) {
+ String option = token.substring(
+ optionKind.toString().length()).trim();
+ if (option.length() > 0) {
+ // ex. -I/dir
+ }
+ else if (optionKind.equals(SCDOptionsEnum.IDASH)) {
+ for (Iterator iter=includes.iterator(); iter.hasNext(); ) {
+ option = (String)iter.next();
+ KVStringPair pair = new KVStringPair(SCDOptionsEnum.IQUOTE.toString(), option);
+ command.addSCOption(pair);
+ }
+ includes = new ArrayList();
+ // -I- has no parameter
+ }
+ else {
+ // ex. -I /dir
+ // take a next token
+ if (i+1 < tokens.length && !tokens[i+1].startsWith("-")) { //$NON-NLS-1$
+ option = tokens[++i];
+ }
+ else break;
+ }
+
+ if (option.length() > 0 && (
+ optionKind.equals(SCDOptionsEnum.INCLUDE) ||
+ optionKind.equals(SCDOptionsEnum.INCLUDE_FILE) ||
+ optionKind.equals(SCDOptionsEnum.IMACROS_FILE) ||
+ optionKind.equals(SCDOptionsEnum.IDIRAFTER) ||
+ optionKind.equals(SCDOptionsEnum.ISYSTEM) ||
+ optionKind.equals(SCDOptionsEnum.IQUOTE) )) {
+ option = (getAbsolutePath(option)).toString();
+ }
+
+ if (optionKind.equals(SCDOptionsEnum.IDIRAFTER)) {
+ KVStringPair pair = new KVStringPair(SCDOptionsEnum.INCLUDE.toString(), option);
+ dirafter.add(pair);
+ }
+ else if (optionKind.equals(SCDOptionsEnum.INCLUDE)) {
+ includes.add(option);
+ }
+ else { // add the pair
+ if (optionKind.equals(SCDOptionsEnum.DEFINE)) {
+ if (option.indexOf('=') == -1) {
+ option += '='+ fDefaultMacroDefinitionValue;
+ }
+ }
+ KVStringPair pair = new KVStringPair(optionKind.toString(), option);
+ command.addSCOption(pair);
+ }
+ break;
+ }
+ }
+ }
+ String option;
+ for (Iterator iter=includes.iterator(); iter.hasNext(); ) {
+ option = (String)iter.next();
+ KVStringPair pair = new KVStringPair(SCDOptionsEnum.INCLUDE.toString(), option);
+ command.addSCOption(pair);
+ }
+ for (Iterator iter=dirafter.iterator(); iter.hasNext(); ) {
+ command.addSCOption((KVStringPair)iter.next());
+ }
+ return command;
+ }
+
+ /**
+ * @return Returns the project.
+ */
+ protected IProject getProject() {
+ return project;
+ }
+
+ public IPath getWorkingDirectory() {
+ if (fDirectoryStack.size() != 0) {
+ return fDirectoryStack.lastElement();
+ }
+ // Fallback to the Project Location
+ // FIXME: if the build did not start in the Project ?
+ return fBaseDirectory;
+ }
+
+ protected IPath popDirectory() {
+ int i = getDirectoryLevel();
+ if (i != 0) {
+ IPath dir = fDirectoryStack.lastElement();
+ fDirectoryStack.removeElementAt(i - 1);
+ return dir;
+ }
+ return new Path(""); //$NON-NLS-1$
+ }
+
+ protected void pushDirectory(IPath dir) {
+ if (dir != null) {
+ IPath pwd = null;
+ if (fBaseDirectory != null && fBaseDirectory.isPrefixOf(dir)) {
+ pwd = dir.removeFirstSegments(fBaseDirectory.segmentCount());
+ } else {
+ // check if it is a cygpath
+ pwd= convertCygpath(dir);
+ }
+ fDirectoryStack.addElement(pwd);
+ }
+ }
+
+ public boolean reportProblems() {
+ boolean reset = false;
+ for (Iterator<Problem> iter = fErrors.iterator(); iter.hasNext(); ) {
+ Problem problem = iter.next();
+ if (problem.severity == IMarkerGenerator.SEVERITY_ERROR_BUILD) {
+ reset = true;
+ }
+ if (problem.file == null) {
+ fMarkerGenerator.addMarker(new ProblemMarkerInfo(
+ project,
+ problem.lineNumber,
+ problem.description,
+ problem.severity,
+ problem.variableName));
+ } else {
+ fMarkerGenerator.addMarker(new ProblemMarkerInfo(
+ problem.file,
+ problem.lineNumber,
+ problem.description,
+ problem.severity,
+ problem.variableName));
+ }
+ }
+ fErrors.clear();
+ return reset;
+ }
+
+ public void setDefaultMacroDefinitionValue(String val) {
+ if (val != null) {
+ fDefaultMacroDefinitionValue= val;
+ }
+ }
+
+ public String getDefaultMacroDefinitionValue() {
+ return fDefaultMacroDefinitionValue;
+ }
+
+ public String normalizePath(String path) {
+ int column = path.indexOf(':');
+ if (column > 0) {
+ char driveLetter = path.charAt(column - 1);
+ if (Character.isLowerCase(driveLetter)) {
+ StringBuffer sb = new StringBuffer();
+ if (column - 1 > 0) {
+ sb.append(path.substring(0, column-1));
+ }
+ sb.append(Character.toUpperCase(driveLetter));
+ sb.append(path.substring(column));
+ path = sb.toString();
+ }
+ }
+ if (path.indexOf('.') == -1 || path.equals(".")) { //$NON-NLS-1$
+ return (new Path(path)).toString(); // convert separators to '/'
+ }
+ // lose "./" segments since they confuse the Path normalization
+ StringBuffer buf = new StringBuffer(path);
+ int len = buf.length();
+ StringBuffer newBuf = new StringBuffer(buf.length());
+ int scp = 0; // starting copy point
+ int ssp = 0; // starting search point
+ int sdot;
+ boolean validPrefix;
+ while (ssp < len && (sdot = buf.indexOf(".", ssp)) != -1) { //$NON-NLS-1$
+ validPrefix = false;
+ int ddot = buf.indexOf("..", ssp);//$NON-NLS-1$
+ if (sdot < ddot || ddot == -1) {
+ newBuf.append(buf.substring(scp, sdot));
+ scp = sdot;
+ ssp = sdot + 1;
+ if (ssp < len) {
+ if (sdot == 0 || buf.charAt(sdot - 1) == '/' || buf.charAt(sdot - 1) == '\\') {
+ validPrefix = true;
+ }
+ char nextChar = buf.charAt(ssp);
+ if (validPrefix && nextChar == '/') {
+ ++ssp;
+ scp = ssp;
+ }
+ else if (validPrefix && nextChar == '\\') {
+ ++ssp;
+ if (ssp < len - 1 && buf.charAt(ssp) == '\\') {
+ ++ssp;
+ }
+ scp = ssp;
+ }
+ else {
+ // no path delimiter, must be '.' inside the path
+ scp = ssp - 1;
+ }
+ }
+ }
+ else if (sdot == ddot) {
+ ssp = sdot + 2;
+ }
+ }
+ newBuf.append(buf.substring(scp, len));
+
+ IPath orgPath = new Path(newBuf.toString());
+ return orgPath.toString();
+ }
+
+
+ /**
+ * Called by the console line parsers to find a file with a given name.
+ * @param fileName
+ * @return IFile or null
+ */
+ public IFile findFile(String fileName) {
+ IFile file = findFilePath(fileName);
+ if (file == null) {
+ // Try the project's map.
+ file = findFileName(fileName);
+ if (file != null) {
+ // If there is a conflict then try all files in the project.
+ if (isConflictingName(fileName)) {
+ file = null;
+
+ // Create a problem marker
+ final String error = MakeMessages.getString("ConsoleParser.Ambiguous_Filepath_Error_Message"); //$NON-NLS-1$
+ TraceUtil.outputError(error, fileName);
+ generateMarker(getProject(), -1, error+fileName, IMarkerGenerator.SEVERITY_WARNING, null);
+ }
+ }
+ }
+ return file;
+ }
+
+ /**
+ * @param filePath
+ * @return
+ */
+ protected IFile findFilePath(String filePath) {
+ IPath path = null;
+ IPath fp = new Path(filePath);
+ if (fp.isAbsolute()) {
+ if (getBaseDirectory().isPrefixOf(fp)) {
+ int segments = getBaseDirectory().matchingFirstSegments(fp);
+ path = fp.removeFirstSegments(segments);
+ } else {
+ path = fp;
+ }
+ } else {
+ path = getWorkingDirectory().append(filePath);
+ }
+
+ IFile file = null;
+ // The workspace may throw an IllegalArgumentException
+ // Catch it and the parser should fallback to scan the entire project.
+ try {
+ file = findFileInWorkspace(path);
+ } catch (Exception e) {
+ }
+
+ // We have to do another try, on Windows for cases like "TEST.C" vs "test.c"
+ // We use the java.io.File canonical path.
+ if (file == null || !file.exists()) {
+ File f = path.toFile();
+ try {
+ String canon = f.getCanonicalPath();
+ path = new Path(canon);
+ file = findFileInWorkspace(path);
+ } catch (IOException e1) {
+ }
+ }
+ return (file != null && file.exists()) ? file : null;
+ }
+
+ /**
+ * @param fileName
+ * @return
+ */
+ protected IFile findFileName(String fileName) {
+ IPath path = new Path(fileName);
+ return (IFile) fFilesInProject.get(path.lastSegment());
+ }
+
+ protected IFile findFileInWorkspace(IPath path) {
+ IFile file = null;
+ if (path.isAbsolute()) {
+ IWorkspaceRoot root = getProject().getWorkspace().getRoot();
+
+ // construct a URI, based on the project's locationURI, that points
+ // to the given path
+ URI projectURI = project.getLocationURI();
+
+ URI newURI = FileSystemUtilityManager.getDefault().replacePath(projectURI, path.toString());
+
+ IFile[] files = root.findFilesForLocationURI(newURI);
+
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].getProject().equals(getProject())) {
+ file = files[i];
+ break;
+ }
+ }
+
+ } else {
+ file = getProject().getFile(path);
+ }
+ return file;
+ }
+
+ protected void collectFiles(IContainer parent, List result) {
+ try {
+ IResource[] resources = parent.members();
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ if (resource instanceof IFile) {
+ result.add(resource);
+ } else if (resource instanceof IContainer) {
+ collectFiles((IContainer) resource, result);
+ }
+ }
+ } catch (CoreException e) {
+ MakeCorePlugin.log(e.getStatus());
+ }
+ }
+
+ protected boolean isConflictingName(String fileName) {
+ IPath path = new Path(fileName);
+ return fNameConflicts.contains(path.lastSegment());
+ }
+
+ public List translateRelativePaths(IFile file, String fileName, List includes) {
+ List translatedIncludes = new ArrayList(includes.size());
+ for (Iterator i = includes.iterator(); i.hasNext(); ) {
+ String include = (String) i.next();
+ IPath includePath = new Path(include);
+ if (!includePath.isAbsolute() && !includePath.isUNC()) { // do not translate UNC paths
+ // First try the current working directory
+ IPath cwd = getWorkingDirectory();
+ if (!cwd.isAbsolute()) {
+ cwd = getBaseDirectory().append(cwd);
+ }
+
+ IPath filePath = new Path(fileName);
+ if (!filePath.isAbsolute()) {
+ // check if the cwd is the right one
+ // appending fileName to cwd should yield file path
+ filePath = cwd.append(fileName);
+ }
+ if (!filePath.toString().equalsIgnoreCase(file.getLocation().toString())) {
+ // must be the cwd is wrong
+ // check if file name starts with ".."
+ if (fileName.startsWith("..")) { //$NON-NLS-1$
+ // probably multiple choices for cwd, hopeless
+ final String error = MakeMessages.getString("ConsoleParser.Working_Directory_Error_Message"); //$NON-NLS-1$
+ TraceUtil.outputError(error, fileName);
+ generateMarker(file, -1, error, IMarkerGenerator.SEVERITY_WARNING, fileName);
+ break;
+ }
+ else {
+ // remove common segments at the end
+ IPath tPath = new Path(fileName);
+ if (fileName.startsWith(".")) { //$NON-NLS-1$
+ tPath = tPath.removeFirstSegments(1);
+ }
+ // get the file path from the file
+ filePath = file.getLocation();
+ IPath lastFileSegment = filePath.removeFirstSegments(filePath.segmentCount() - tPath.segmentCount());
+ if (lastFileSegment.matchingFirstSegments(tPath) == tPath.segmentCount()) {
+ cwd = filePath.removeLastSegments(tPath.segmentCount());
+ }
+ }
+ }
+
+ IPath candidatePath = cwd.append(includePath);
+ File dir = candidatePath.toFile();
+ include = candidatePath.toString();
+ if (!dir.exists()) {
+ final String error = MakeMessages.getString("ConsoleParser.Nonexistent_Include_Path_Error_Message"); //$NON-NLS-1$
+ TraceUtil.outputError(error, include);
+// generateMarker(file, -1, error+include, IMarkerGenerator.SEVERITY_WARNING, fileName);
+ }
+ }
+ // TODO VMIR for now add unresolved paths as well
+ translatedIncludes.add(include);
+ }
+ return translatedIncludes;
+ }
+}
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerFileBuildOutputParser.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerFileBuildOutputParser.java
new file mode 100644
index 0000000000..b898ebae66
--- /dev/null
+++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerFileBuildOutputParser.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.make.xlc.core.scannerconfig;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * @author crecoskie
+ *
+ */
+public class XLCPerFileBuildOutputParser extends AbstractXLCBuildOutputParser {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.xlc.core.scannerconfig.AbstractXLCBuildOutputParser#processCommand(java.lang.String[])
+ */
+ @Override
+ protected boolean processCommand(String[] tokens) {
+ // GCC C/C++ compiler invocation
+ int compilerInvocationIndex= findCompilerInvocation(tokens);
+ if (compilerInvocationIndex < 0) {
+ return false;
+ }
+
+ // find a file name
+ int extensionsIndex = -1;
+ boolean found = false;
+ String filePath = null;
+ for (int i = compilerInvocationIndex+1; i < tokens.length; i++) {
+ String token= tokens[i];
+ int k = token.lastIndexOf('.');
+ if (k != -1 && (token.length() - k < 5)) {
+ String fileExtension = token.substring(k);
+ extensionsIndex = getFileExtensionsList().indexOf(fileExtension);
+ if (extensionsIndex != -1) {
+ filePath = token;
+ found = true;
+ break;
+ }
+ }
+ }
+ if (!found) {
+ TraceUtil.outputTrace("Error identifying file name :1", tokens, TraceUtil.EOL); //$NON-NLS-1$
+ return false;
+ }
+ // sanity check
+ if (filePath.indexOf(getFileExtensions()[extensionsIndex]) == -1) {
+ TraceUtil.outputTrace("Error identifying file name :2", tokens, TraceUtil.EOL); //$NON-NLS-1$
+ return false;
+ }
+ if (fUtility != null) {
+ IPath pFilePath = fUtility.getAbsolutePath(filePath);
+ String shortFileName = pFilePath.removeFileExtension().lastSegment();
+
+ // generalize occurrences of the file name
+ for (int i = compilerInvocationIndex+1; i < tokens.length; i++) {
+ String token = tokens[i];
+ if (token.equals("-include")) { //$NON-NLS-1$
+ ++i;
+ }
+ else if (token.equals("-imacros")) { //$NON-NLS-1$
+ ++i;
+ }
+ else if (token.equals(filePath)) {
+ tokens[i]= "LONG_NAME"; //$NON-NLS-1$
+ }
+ else if (token.startsWith(shortFileName)) {
+ tokens[i]= token.replaceFirst(shortFileName, "SHORT_NAME"); //$NON-NLS-1$
+ }
+ }
+
+ IFile file= null;
+ IPath baseDirectory= fUtility.getBaseDirectory();
+ if (baseDirectory.isPrefixOf(pFilePath)) {
+ IPath relPath = pFilePath.removeFirstSegments(baseDirectory.segmentCount());
+ //Note: We add the scanner-config even if the resource doesn't actually
+ //exist below this project (which may happen when reading existing
+ //build logs, because resources can be created as part of the build
+ //and may not exist at the time of analyzing the config but re-built
+ //later on.
+ //if (getProject().exists(relPath)) {
+ file = getProject().getFile(relPath);
+ } else {
+ file = getUtility().findFileInWorkspace(pFilePath);
+ }
+ if (file != null) {
+ CCommandDSC cmd = getUtility().getNewCCommandDSC(tokens, compilerInvocationIndex, extensionsIndex > 0);
+ List cmdList = new ArrayList();
+ cmdList.add(cmd);
+ Map sc = new HashMap(1);
+ sc.put(ScannerInfoTypes.COMPILER_COMMAND, cmdList);
+ getCollector().contributeToScannerConfig(file, sc);
+ } else
+ TraceUtil.outputError("Build command for file outside project: "+pFilePath.toString(), tokens); //$NON-NLS-1$
+ }
+ return true; }
+
+}
diff --git a/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerProjectBuildOutputParser.java b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerProjectBuildOutputParser.java
new file mode 100644
index 0000000000..7c9f6b72f9
--- /dev/null
+++ b/xlc/org.eclipse.cdt.make.xlc.core/src/org/eclipse/cdt/make/xlc/core/scannerconfig/XLCPerProjectBuildOutputParser.java
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.make.xlc.core.scannerconfig;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.core.IMarkerGenerator;
+import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
+import org.eclipse.cdt.make.internal.core.MakeMessages;
+import org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParserUtility;
+import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+/**
+ * @author crecoskie
+ *
+ */
+public class XLCPerProjectBuildOutputParser extends
+ AbstractXLCBuildOutputParser {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.xlc.core.scannerconfig.AbstractXLCBuildOutputParser#processCommand(java.lang.String[])
+ */
+ @Override
+ protected boolean processCommand(String[] tokens) {
+ int compilerInvocationIdx= findCompilerInvocation(tokens);
+ if (compilerInvocationIdx<0) {
+ return false;
+ }
+
+ if (compilerInvocationIdx+1 >= tokens.length) {
+ return false;
+ }
+
+ // Recognized gcc or g++ compiler invocation
+ List includes = new ArrayList();
+ List symbols = new ArrayList();
+ List targetSpecificOptions = new ArrayList();
+
+ String fileName = null;
+ for (int j= compilerInvocationIdx+1; j < tokens.length; j++) {
+ String token = tokens[j];
+ if (token.equals(DASHIDASH)) {
+ }
+ else if (token.startsWith(DASHI)) {
+ String candidate= null;
+ if (token.length() > 2) {
+ candidate= token.substring(2).trim();
+ }
+ else if (j+1 < tokens.length) {
+ candidate= tokens[j+1];
+ if (candidate.startsWith("-")) { //$NON-NLS-1$
+ candidate= null;
+ }
+ else {
+ j++;
+ }
+ }
+ if (candidate != null && candidate.length() > 0) {
+ if (getUtility() != null) {
+ candidate= getUtility().normalizePath(candidate);
+ }
+ if (!includes.contains(candidate)) {
+ includes.add(candidate);
+ }
+ }
+ }
+ else if (token.startsWith(DASHD)) {
+ String candidate= null;
+ if (token.length() > 2) {
+ candidate= token.substring(2).trim();
+ }
+ else if (j+1 < tokens.length) {
+ candidate= tokens[j+1];
+ if (candidate.startsWith("-")) { //$NON-NLS-1$
+ candidate= null;
+ }
+ else {
+ j++;
+ }
+ }
+ if (candidate != null && candidate.length() > 0) {
+ if (candidate.indexOf('=') == -1) {
+ candidate+= '='+ getUtility().getDefaultMacroDefinitionValue();
+ }
+ if (!symbols.contains(candidate)) {
+ symbols.add(candidate);
+ }
+ }
+ }
+
+ else if (fileName == null) {
+ int extIndex = token.lastIndexOf('.');
+ String extension=null;
+
+ if(extIndex != -1)
+ extension = token.substring(extIndex);
+
+ List<String> extensions = getFileExtensionsList();
+ if(extension != null && extensions.contains(extension))
+ fileName = token;
+ }
+ }
+
+ if (fileName == null) {
+ return false; // return when no file was given (analogous to GCCPerFileBOPConsoleParser)
+ }
+
+ IProject project = getProject();
+ IFile file = null;
+ List translatedIncludes = includes;
+ if (includes.size() > 0) {
+ if (fileName != null) {
+ if (getUtility() != null) {
+ file = getUtility().findFile(fileName);
+ if (file != null) {
+ project = file.getProject();
+ translatedIncludes = getUtility().translateRelativePaths(file, fileName, includes);
+ }
+ }
+ }
+ else {
+ StringBuffer line= new StringBuffer();
+ for (int j = 0; j < tokens.length; j++) {
+ line.append(tokens[j]);
+ line.append(' ');
+ }
+ final String error = MakeMessages.getString("ConsoleParser.Filename_Missing_Error_Message"); //$NON-NLS-1$
+ TraceUtil.outputError(error, line.toString());
+ if (getUtility() != null) {
+ getUtility().generateMarker(getProject(), -1, error + line.toString(), IMarkerGenerator.SEVERITY_WARNING, null);
+ }
+ }
+ if (file == null && getUtility() != null) { // real world case
+ // remove include paths since there was no chance to translate them
+ translatedIncludes.clear();
+ }
+ }
+ // Contribute discovered includes and symbols to the ScannerInfoCollector
+ if (translatedIncludes.size() > 0 || symbols.size() > 0) {
+ Map scannerInfo = new HashMap();
+ scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, translatedIncludes);
+ scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols);
+ scannerInfo.put(ScannerInfoTypes.TARGET_SPECIFIC_OPTION, targetSpecificOptions);
+ getCollector().contributeToScannerConfig(project, scannerInfo);
+
+ TraceUtil.outputTrace("Discovered scanner info for file \'" + fileName + '\'', //$NON-NLS-1$
+ "Include paths", includes, translatedIncludes, "Defined symbols", symbols); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return true;
+
+}
+
+
+
+}

Back to the top