As noted in the PR, c.opt's description of -Wendif-labels erroneously refers to #elif, rather than #else.
warn_endif_labels is used by: libcpp/directives.c: do_else libcpp/directives.c: do_endif in which they use it to guard calls to check_eol_endif_labels. It's not used by do_elif. doc/cppwarnopts.texi gets this right: > Do not warn whenever an @code{#else} or an @code{#endif} are followed by text. > This sometimes happens in older programs with code of the form This patch fixes the description in c.opt. Successfully bootstrapped®rtested on x86_64-pc-linux-gnu. Committed to trunk as obvious (r246616). gcc/c-family/ChangeLog: PR documentation/78732 * c.opt (Wendif-labels): Fix description to refer to #else rather than #elif. --- gcc/c-family/c.opt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 78fea61..13b930d 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -486,7 +486,7 @@ Warn about an empty body in an if or else statement. Wendif-labels C ObjC C++ ObjC++ CPP(warn_endif_labels) CppReason(CPP_W_ENDIF_LABELS) Var(cpp_warn_endif_labels) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wpedantic) -Warn about stray tokens after #elif and #endif. +Warn about stray tokens after #else and #endif. Wenum-compare C ObjC C++ ObjC++ Var(warn_enum_compare) Init(-1) Warning LangEnabledBy(C ObjC,Wall || Wc++-compat) -- 1.8.5.3