[cfe-dev] [RFC] How to communicate that -Wpedantic controls only certain cases of DiagGroups

Volodymyr Sapsai via cfe-dev cfe-dev at lists.llvm.org
Wed Apr 11 19:03:37 PDT 2018


Hello all,

I’ll illustrate the problem with a situation encountered by our user. For some code compiled with -Wpedantic they encountered some -Wextra-semi warnings. So they’ve assumed that -Wpedantic controls -Wextra-semi but documentation <https://clang.llvm.org/docs/DiagnosticsReference.html#wpedantic> doesn’t say so. And it is correct because -Wpedantic enables all extension warnings but not disabled-by-default warnings. And for -Wextra-semi the DiagGroups structure is

ExtraSemi
  ext_extra_semi
  warn_extra_semi_after_mem_fn_def, DefaultIgnore
  CXX98CompatExtraSemi
    warn_cxx98_compat_top_level_semi, DefaultIgnore
  CXX11ExtraSemi
    ext_extra_semi_cxx11

So there are -Wextra-semi warnings that won’t be enabled by -Wpedantic.

I don’t think that Clang users should understand the intricacies of the DiagGroup structure to use it successfully. And provided example shows we don’t always achieve this goal. Does anybody have an idea how we can communicate that -Wpedantic can enable some warnings in certain cases but not in all cases? And should it be the case at all? Maybe it would be better if we don’t mix extension warnings and regular warnings in the same DiagGroup. I don’t suggest to update all the warnings to adhere to this requirement. But it can be useful to pay more attention to this in the future.

Thanks,
Volodymyr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180411/ea24a382/attachment.html>


More information about the cfe-dev mailing list