What warnings are included in Clang's -Wall and -Wextra?

后端 未结 2 1786
渐次进展
渐次进展 2021-01-03 22:23

I\'ve found Clang\'s documentation to be quite poor. I haven\'t been able to find much of a list of available Clang warning flags. I\'m interested particularly in C/C++ warn

2条回答
  •  北海茫月
    2021-01-03 23:21

    You can check the source code:

    For example,

    def : DiagGroup<"all", [Most, Parentheses, Switch]>;
    
    // Warnings enabled by -pedantic.  This is magically filled in by TableGen.
    def Pedantic : DiagGroup<"pedantic">;
    
    // Aliases.
    def : DiagGroup<"", [Extra]>;                   // -W = -Wextra
    

    For -Wall look at the Most, Parentheses, Switch. You can find:

    def Most : DiagGroup<"most", [ 
    ....
    

    further down the file. Similarly, for extra:

    def Extra : DiagGroup<"extra", [
        MissingFieldInitializers,
        IgnoredQualifiers,
        InitializerOverrides,
        SemiBeforeMethodBody,
        MissingMethodReturnType,
        SignCompare,
        UnusedParameter
      ]>;
    

提交回复
热议问题