Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-23143

Compilation database project breaks if -std exists in the compilation arguments of a C source file

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • Qt Creator 4.11.0
    • Qt Creator 4.10.1, Qt Creator 4.11.0-beta1
    • None
    • Qt Creator installed using the official online installer.
      Gentoo Linux AMD64.
    • Linux/X11
    • ec4e9e91908e84c1d8778ae2b485ab10a3161025

    Description

      When using the CompilationDatabaseProjectManager plugin and opening a project from a compile_commands.json file, none of the C source files in it are recognized as part of the project if the first one of them contains an "-std=" option in "arguments". Example: 

      [
          {
              "arguments": [
                  "gcc",
                  "-c",
                  "-std=gnu99",
                  "-o",
                  "obj/test.o",
                  "src/test.c"
              ],
              "directory": "/home/realnc/projects/CompDatabaseTest",
              "file": "src/test.c"
          }
      ]
      

      It doesn't matter if I replace "gcc" with g+, clang or clang+. If it's a *.c file, the "-std" argument prevents Creator from being able to parse any of the C files correctly and a yellow icon appears at the top that says: "This file is not part of any project."

      The problem doesn't exist with C++ sources. For example, this works fine: 

      [
          {
              "arguments": [
                  "g++",
                  "-c",
                  "-std=c++14",
                  "-o",
                  "obj/test.o",
                  "src/test.cpp"
              ],
              "directory": "/home/realnc/projects/CompDatabaseTest",
              "file": "src/test.cpp"
          }
      ]

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kandeler Christian Kandeler
            realnc Nikos Chantziaras
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes