GrammaTech / gtirb

Intermediate Representation for Binary analysis and transformation
https://grammatech.github.io/gtirb/
Other
305 stars 36 forks source link

Minor GCC 9 warnings #30

Closed XVilka closed 4 years ago

XVilka commented 5 years ago
[ 70%] Built target gtest_main
/home/akochkov/tmp/gtirb/src/CFG.cpp:24:54: warning: statement should be inside braces [readability-braces-around-statements]
  if (auto it = IdTable.find(N); it != IdTable.end())
                                                     ^
                                                      {
/home/akochkov/tmp/gtirb/src/CFG.cpp:36:54: warning: statement should be inside braces [readability-braces-around-statements]
  if (auto it = IdTable.find(N); it != IdTable.end())
                                                     ^
                                                      {
/home/akochkov/tmp/gtirb/src/CFG.cpp:107:5: warning: use auto when initializing with a template cast to avoid duplicating the type name [modernize-use-auto]
    CfgNode* N =
    ^~~~~~~
    auto
/home/akochkov/tmp/gtirb/src/Module.cpp:29:28: warning: pass by value and use std::move [modernize-pass-by-value]
Module::Module(Context& C, const std::string& X)
                           ^~~~~~~~~~~~~~~~~~
                           std::string 
/home/akochkov/tmp/gtirb/src/Module.cpp:40:7: warning: use auto when initializing with a template cast to avoid duplicating the type name [modernize-use-auto]
  if (Block* B = dyn_cast<Block>(N))
      ^~~~~
      auto
/home/akochkov/tmp/gtirb/src/Module.cpp:40:37: warning: statement should be inside braces [readability-braces-around-statements]
  if (Block* B = dyn_cast<Block>(N))
                                    ^
                                     {
/home/akochkov/tmp/gtirb/src/Module.cpp:42:12: warning: use auto when initializing with a template cast to avoid duplicating the type name [modernize-use-auto]
  else if (ProxyBlock* P = dyn_cast<ProxyBlock>(N))
           ^~~~~~~~~~
           auto
/home/akochkov/tmp/gtirb/src/Module.cpp:42:52: warning: statement should be inside braces [readability-braces-around-statements]
  else if (ProxyBlock* P = dyn_cast<ProxyBlock>(N))
                                                   ^
                                                    {
/home/akochkov/tmp/gtirb/src/Module.cpp:44:7: warning: statement should be inside braces [readability-braces-around-statements]
  else
      ^
       {
/home/akochkov/tmp/gtirb/src/Module.cpp:93:43: warning: statement should be inside braces [readability-braces-around-statements]
  for (const auto& Elt : Message.blocks())
                                          ^
                                           {
/home/akochkov/tmp/gtirb/src/Module.cpp:95:41: warning: statement should be inside braces [readability-braces-around-statements]
  for (const auto& Elt : Message.data())
                                        ^
                                         {
/home/akochkov/tmp/gtirb/src/Module.cpp:97:44: warning: statement should be inside braces [readability-braces-around-statements]
  for (const auto& Elt : Message.proxies())
                                           ^
                                            {
/home/akochkov/tmp/gtirb/src/Module.cpp:99:45: warning: statement should be inside braces [readability-braces-around-statements]
  for (const auto& Elt : Message.sections())
                                            ^
                                             {
AaronBallman commented 5 years ago

These look like clang-tidy warnings, not GCC diagnostics. I don't think we've explored which clang-tidy checks we think make sense for the project yet.

https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-auto.html https://clang.llvm.org/extra/clang-tidy/checks/modernize-pass-by-value.html

iconmaster5326 commented 4 years ago

Since this issue has been posted, we have added a .clang-tidy file. Do these warnings still appear with our new standards?

AaronBallman commented 4 years ago

I am closing this issue as I believe these issues are resolved now: https://github.com/GrammaTech/gtirb/blob/master/.clang-tidy

If there are specific checks that are unnecessarily noisy, please file a new issue. Thanks!