rizsotto / Bear

Bear is a tool that generates a compilation database for clang tooling.
GNU General Public License v3.0
4.79k stars 314 forks source link

Configuration file for arduino-cli front-end #398

Closed m-dhooge closed 3 years ago

m-dhooge commented 3 years ago

Hello,

I use arduino-cli as a front-end to compile Arduino's programs.

With v2 of bear, I used the following line:
bear --use-c++ cc1plus make

Since v3, I must provide the verbatim path to cc1 and this is not robust to any changes…

    "compilers_to_recognize": [
      {
        "executable": "/home/michel/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/../lib/gcc/arm-none-eabi/4.8.3/cc1plus"
      }
    ],

Any idea on how this could be improved?

Thanks a lot M.

rizsotto commented 3 years ago

Hey @m-dhooge , good question.

Yes, in v3 most of the command line flags went to the configuration file. The drive behind is, that adding new functionalities to the tool would have created so many flags. And some of those functionalities would require multiple configuration which are belongs together, which is hard to represent with flags. The flag --use-cc and --use-c++ might arguable simple enough to keep it in the flags, but keep things simple I did move those to the config.

One simplification could be, the Bear picks up the CC and CXX variables and threat them as compiler names which has to be recognized, even if those are not in the config file. But I'm not sure if the cc1plus is a compiler in your project. (Sounds like this is a tool, you wish to see in the compilation database, but this is not the real compiler.)