diff options
-rw-r--r-- | test/Misc/warning-flags.c | 35 | ||||
-rw-r--r-- | utils/TableGen/ClangDiagnosticsEmitter.cpp | 16 |
2 files changed, 45 insertions, 6 deletions
diff --git a/test/Misc/warning-flags.c b/test/Misc/warning-flags.c index 98cfcd6741..06c70eb57c 100644 --- a/test/Misc/warning-flags.c +++ b/test/Misc/warning-flags.c @@ -18,7 +18,27 @@ This test serves two purposes: The list of warnings below should NEVER grow. It should gradually shrink to 0. -CHECK: Warnings without flags (128): +CHECK: Warnings without flags (159): +CHECK-NEXT: ext_delete_void_ptr_operand +CHECK-NEXT: ext_enum_friend +CHECK-NEXT: ext_expected_semi_decl_list +CHECK-NEXT: ext_explicit_specialization_storage_class +CHECK-NEXT: ext_implicit_lib_function_decl +CHECK-NEXT: ext_missing_declspec +CHECK-NEXT: ext_missing_whitespace_after_macro_name +CHECK-NEXT: ext_new_paren_array_nonconst +CHECK-NEXT: ext_plain_complex +CHECK-NEXT: ext_pp_macro_redef +CHECK-NEXT: ext_template_arg_extra_parens +CHECK-NEXT: ext_typecheck_comparison_of_distinct_pointers +CHECK-NEXT: ext_typecheck_comparison_of_distinct_pointers_nonstandard +CHECK-NEXT: ext_typecheck_comparison_of_pointer_integer +CHECK-NEXT: ext_typecheck_cond_incompatible_operands +CHECK-NEXT: ext_typecheck_cond_incompatible_operands_nonstandard +CHECK-NEXT: ext_typecheck_ordered_comparison_of_function_pointers +CHECK-NEXT: ext_typecheck_ordered_comparison_of_pointer_integer +CHECK-NEXT: ext_unknown_escape +CHECK-NEXT: ext_using_undefined_std CHECK-NEXT: pp_include_next_absolute_path CHECK-NEXT: pp_include_next_in_primary CHECK-NEXT: pp_invalid_string_literal @@ -62,22 +82,30 @@ CHECK-NEXT: warn_enum_too_large CHECK-NEXT: warn_enum_value_overflow CHECK-NEXT: warn_enumerator_too_large CHECK-NEXT: warn_exception_caught_by_earlier_handler +CHECK-NEXT: warn_excess_initializers +CHECK-NEXT: warn_excess_initializers_in_char_array_initializer +CHECK-NEXT: warn_expected_qualified_after_typename CHECK-NEXT: warn_extraneous_char_constant CHECK-NEXT: warn_fe_cc_log_diagnostics_failure CHECK-NEXT: warn_fe_cc_print_header_failure CHECK-NEXT: warn_fe_macro_contains_embedded_newline CHECK-NEXT: warn_file_asm_volatile +CHECK-NEXT: warn_hex_escape_too_large CHECK-NEXT: warn_ignoring_ftabstop_value CHECK-NEXT: warn_implements_nscopying CHECK-NEXT: warn_incompatible_qualified_id +CHECK-NEXT: warn_initializer_string_for_char_array_too_long CHECK-NEXT: warn_inline_namespace_reopened_noninline CHECK-NEXT: warn_integer_too_large CHECK-NEXT: warn_integer_too_large_for_signed CHECK-NEXT: warn_invalid_asm_cast_lvalue +CHECK-NEXT: warn_many_braces_around_scalar_init CHECK-NEXT: warn_maynot_respond CHECK-NEXT: warn_member_extra_qualification CHECK-NEXT: warn_method_param_redefinition +CHECK-NEXT: warn_mismatched_exception_spec CHECK-NEXT: warn_missing_case_for_condition +CHECK-NEXT: warn_missing_dependent_template_keyword CHECK-NEXT: warn_missing_exception_specification CHECK-NEXT: warn_missing_whitespace_after_macro_name CHECK-NEXT: warn_multiple_method_decl @@ -86,8 +114,10 @@ CHECK-NEXT: warn_nonnull_pointers_only CHECK-NEXT: warn_not_compound_assign CHECK-NEXT: warn_objc_property_copy_missing_on_block CHECK-NEXT: warn_objc_protocol_qualifier_missing_id +CHECK-NEXT: warn_octal_escape_too_large CHECK-NEXT: warn_odr_tag_type_inconsistent CHECK-NEXT: warn_on_superclass_use +CHECK-NEXT: warn_param_default_argument_redefinition CHECK-NEXT: warn_partial_specs_not_deducible CHECK-NEXT: warn_pp_convert_lhs_to_positive CHECK-NEXT: warn_pp_convert_rhs_to_positive @@ -134,6 +164,7 @@ CHECK-NEXT: warn_second_parameter_of_va_start_not_last_named_argument CHECK-NEXT: warn_second_parameter_to_va_arg_never_compatible CHECK-NEXT: warn_standalone_specifier CHECK-NEXT: warn_static_inline_explicit_inst_ignored +CHECK-NEXT: warn_static_non_static CHECK-NEXT: warn_template_export_unsupported CHECK-NEXT: warn_template_spec_extra_headers CHECK-NEXT: warn_tentative_incomplete_array @@ -150,4 +181,4 @@ CHECK-NEXT: warn_weak_import The list of warnings in -Wpedantic should NEVER grow. -CHECK: Number in -Wpedantic (not covered by other -W flags): 70 +CHECK: Number in -Wpedantic (not covered by other -W flags): 39 diff --git a/utils/TableGen/ClangDiagnosticsEmitter.cpp b/utils/TableGen/ClangDiagnosticsEmitter.cpp index 8e7f454aac..8615d2db8c 100644 --- a/utils/TableGen/ClangDiagnosticsEmitter.cpp +++ b/utils/TableGen/ClangDiagnosticsEmitter.cpp @@ -204,6 +204,9 @@ private: /// Determine if the diagnostic is an extension. bool isExtension(const Record *Diag); + /// Determine if the diagnostic is off by default. + bool isOffByDefault(const Record *Diag); + /// Increment the count for a group, and transitively marked /// parent groups when appropriate. void markGroup(const Record *Group); @@ -234,6 +237,11 @@ bool InferPedantic::isExtension(const Record *Diag) { return ClsName == "CLASS_EXTENSION"; } +bool InferPedantic::isOffByDefault(const Record *Diag) { + const std::string &DefMap = Diag->getValueAsDef("DefaultMapping")->getName(); + return DefMap == "MAP_IGNORE"; +} + bool InferPedantic::groupInPedantic(const Record *Group, bool increment) { GMap::mapped_type &V = GroupCount[Group]; // Lazily compute the threshold value for the group count. @@ -265,12 +273,12 @@ void InferPedantic::markGroup(const Record *Group) { void InferPedantic::compute(VecOrSet DiagsInPedantic, VecOrSet GroupsInPedantic) { - // All extensions are implicitly in the "pedantic" group. For those that - // aren't explicitly included in -Wpedantic, mark them for consideration - // to be included in -Wpedantic directly. + // All extensions that are not on by default are implicitly in the + // "pedantic" group. For those that aren't explicitly included in -Wpedantic, + // mark them for consideration to be included in -Wpedantic directly. for (unsigned i = 0, e = Diags.size(); i != e; ++i) { Record *R = Diags[i]; - if (isExtension(R)) { + if (isExtension(R) && isOffByDefault(R)) { DiagsSet.insert(R); if (DefInit *Group = dynamic_cast<DefInit*>(R->getValueInit("Group"))) { const Record *GroupRec = Group->getDef(); |