From 2c072af95eafa6ac1749cf0b1c217b54bffb6746 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Mon, 12 Oct 2015 21:05:54 +0000 Subject: [PATCH] Add warning flags for #include_next and some nearby warnings. llvm-svn: 250105 --- clang/include/clang/Basic/DiagnosticGroups.td | 4 +++- clang/include/clang/Basic/DiagnosticLexKinds.td | 15 ++++++++++----- clang/test/Misc/warning-flags.c | 8 ++------ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td index bf655cc3aa56..39ed1318cd79 100644 --- a/clang/include/clang/Basic/DiagnosticGroups.td +++ b/clang/include/clang/Basic/DiagnosticGroups.td @@ -202,6 +202,7 @@ def InfiniteRecursion : DiagGroup<"infinite-recursion">; def GNUImaginaryConstant : DiagGroup<"gnu-imaginary-constant">; def IgnoredQualifiers : DiagGroup<"ignored-qualifiers">; def : DiagGroup<"import">; +def GNUIncludeNext : DiagGroup<"gnu-include-next">; def IncompatibleMSStruct : DiagGroup<"incompatible-ms-struct">; def IncompatiblePointerTypesDiscardsQualifiers : DiagGroup<"incompatible-pointer-types-discards-qualifiers">; @@ -708,7 +709,8 @@ def GNU : DiagGroup<"gnu", [GNUAlignofExpression, GNUAnonymousStruct, GNUEmptyInitializer, GNUEmptyStruct, VLAExtension, GNUFlexibleArrayInitializer, GNUFlexibleArrayUnionMember, GNUFoldingConstant, - GNUImaginaryConstant, GNULabelsAsValue, + GNUImaginaryConstant, GNUIncludeNext, + GNULabelsAsValue, RedeclaredClassMember, GNURedeclaredEnum, GNUStatementExpression, GNUStaticFloatInit, GNUStringLiteralOperatorTemplate, diff --git a/clang/include/clang/Basic/DiagnosticLexKinds.td b/clang/include/clang/Basic/DiagnosticLexKinds.td index 3384a34d61a2..77090e92929f 100644 --- a/clang/include/clang/Basic/DiagnosticLexKinds.td +++ b/clang/include/clang/Basic/DiagnosticLexKinds.td @@ -256,10 +256,13 @@ def err_pp_hash_error : Error<"%0">; } def pp_include_next_in_primary : Warning< - "#include_next in primary source file">; + "#include_next in primary source file">, + InGroup>; def pp_include_macros_out_of_predefines : Error< "the #__include_macros directive is only for internal use by -imacros">; -def pp_include_next_absolute_path : Warning<"#include_next with absolute path">; +def pp_include_next_absolute_path : Warning< + "#include_next with absolute path">, + InGroup>; def ext_c99_whitespace_required_after_macro_name : ExtWarn< "ISO C99 requires whitespace after the macro name">, InGroup; def ext_missing_whitespace_after_macro_name : ExtWarn< @@ -267,9 +270,11 @@ def ext_missing_whitespace_after_macro_name : ExtWarn< def warn_missing_whitespace_after_macro_name : Warning< "whitespace recommended after macro name">; -def pp_pragma_once_in_main_file : Warning<"#pragma once in main file">; +def pp_pragma_once_in_main_file : Warning<"#pragma once in main file">, + InGroup>; def pp_pragma_sysheader_in_main_file : Warning< - "#pragma system_header ignored in main file">; + "#pragma system_header ignored in main file">, + InGroup>; def pp_poisoning_existing_macro : Warning<"poisoning existing macro">; def pp_out_of_date_dependency : Warning< "current file is older than dependency %0">; @@ -316,7 +321,7 @@ def ext_pp_include_search_ms : ExtWarn< def ext_pp_ident_directive : Extension<"#ident is a language extension">; def ext_pp_include_next_directive : Extension< - "#include_next is a language extension">; + "#include_next is a language extension">, InGroup; def ext_pp_warning_directive : Extension<"#warning is a language extension">; def ext_pp_extra_tokens_at_eol : ExtWarn< diff --git a/clang/test/Misc/warning-flags.c b/clang/test/Misc/warning-flags.c index bd97c4ae8084..5cc769faad97 100644 --- a/clang/test/Misc/warning-flags.c +++ b/clang/test/Misc/warning-flags.c @@ -18,7 +18,7 @@ This test serves two purposes: The list of warnings below should NEVER grow. It should gradually shrink to 0. -CHECK: Warnings without flags (89): +CHECK: Warnings without flags (85): CHECK-NEXT: ext_excess_initializers CHECK-NEXT: ext_excess_initializers_in_char_array_initializer CHECK-NEXT: ext_expected_semi_decl_list @@ -35,13 +35,9 @@ 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_using_undefined_std -CHECK-NEXT: pp_include_next_absolute_path -CHECK-NEXT: pp_include_next_in_primary CHECK-NEXT: pp_invalid_string_literal CHECK-NEXT: pp_out_of_date_dependency CHECK-NEXT: pp_poisoning_existing_macro -CHECK-NEXT: pp_pragma_once_in_main_file -CHECK-NEXT: pp_pragma_sysheader_in_main_file CHECK-NEXT: w_asm_qualifier_ignored CHECK-NEXT: warn_accessor_property_type_mismatch CHECK-NEXT: warn_arcmt_nsalloc_realloc @@ -111,4 +107,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): 28 +CHECK: Number in -Wpedantic (not covered by other -W flags): 27 -- GitLab