[cfe-commits] r161695 - in /cfe/trunk: test/Misc/warning-flags.c utils/TableGen/ClangDiagnosticsEmitter.cpp
Ted Kremenek
kremenek at apple.com
Fri Aug 10 13:50:00 PDT 2012
Author: kremenek
Date: Fri Aug 10 15:50:00 2012
New Revision: 161695
URL: http://llvm.org/viewvc/llvm-project?rev=161695&view=rev
Log:
Fix horrible regression in control of warnings caused by introduction of -Wpedantic.
While -Wpedantic was reasonable, -Wno-pedantic would turn off a bunch of warnings that
are on by default. This counters the intention of this warning flag.
To fix this, -Wpedantic now includes extentions that are not on by default. The
remaining warnings will manifest anyway, and won't accidentally get turned off
by -Wno-pedantic.
Fixes <rdar://problem/12076105>
Modified:
cfe/trunk/test/Misc/warning-flags.c
cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp
Modified: cfe/trunk/test/Misc/warning-flags.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/warning-flags.c?rev=161695&r1=161694&r2=161695&view=diff
==============================================================================
--- cfe/trunk/test/Misc/warning-flags.c (original)
+++ cfe/trunk/test/Misc/warning-flags.c Fri Aug 10 15:50:00 2012
@@ -18,7 +18,27 @@
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_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_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_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 @@
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
Modified: cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp?rev=161695&r1=161694&r2=161695&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp Fri Aug 10 15:50:00 2012
@@ -204,6 +204,9 @@
/// 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 @@
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::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();
More information about the cfe-commits
mailing list