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

Code model can't parse libc headers when _GNU_SOURCE is defined

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • Qt Creator 4.9.0-beta1
    • Qt Creator 4.8.0
    • None
    • Ubuntu 18.04
      gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
      libc6 2.27-3ubuntu1
    • Linux/X11

    Description

      Something like this:

       

      #define _GNU_SOURCE
      #include <math.h>
      

      cannot be parsed by clang, causing all the remaining code to be basically un-readable because there are many errors for any libc function/types used.

       

      The parse error is the following:

       

      Warning: The code model could not parse an included file, which might lead to incorrect code completion and highlighting, for example.

      mathcalls.h:53:1: error: unknown type name '_Float32'
      main.c:1:1: note: in file included from /home/fabien/projects/qtcreator-clangbug/qtcreator-clangbug/main.c:1:
      main.c:1:10: note: in file included from /home/fabien/projects/qtcreator-clangbug/qtcreator-clangbug/main.c:1:
      test.h:6:10: note: in file included from /home/fabien/projects/qtcreator-clangbug/qtcreator-clangbug/test.h:6:
      math.h:440:12: note: in file included from /usr/include/math.h:440:

       

      Note that the code is valid and compiles fine.

      The issue happens with ubuntu base gcc:

       - gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0

       - libc6 2.27-3ubuntu1

      I don't reproduce it with e.g. the android clang toolchain.

      I attach a minimal project reproducing the issue.

       

      Attachments

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

        Activity

          People

            kosjar Nikolai Kosjar
            xalioth Fabien Chéreau
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes