[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#31198: 25.1; Semantic fails to find system include (header) files

From: johol
Subject: bug#31198: 25.1; Semantic fails to find system include (header) files
Date: Tue, 17 Apr 2018 10:00:30 +0000
User-agent: Horde Application Framework 5

GNU Emacs 25.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.18.9)
System Description: CentOS release 6.4 (Final)


Semantic fails to locate C/C++ system header files when a system header file in turn uses double quotes instead of angle brackets in include statements.


Assume the trivial C++ source file Foo.cpp that just contains a single include statement

---- 8< -----
#include <QFile>
---- 8< -----

The system include path for the ede-cpp-project points to the directory /usr/include and Semantic is able to properly locate the QFile header in /usr/include/QtCore/.

However, the header file /usr/include/QtCore/QFile contains only a single include statement that points to the file qfile.h. This include statement uses double quotes instead of angle brackets, i.e. the contents of the file QFile is

---- 8< -----
#include "qfile.h"
---- 8< -----

What happens is that Semantic gets confused since the include statement is using the syntax for local include files instead of system include files. Thus Semantic is unable to locate qfile.h header since it is located in the system include directory /usr/include/QtCore and the project local include path does not include this directory (and it should not need to do that).

Proposed solution
When a system include/header file (a header file found via system include path) uses double quotes Semantic should treat the include statement as if it really was using angle brackets instead of double quotes and thus be able to properly locate qfile.h via QFile. As it is now Semantic will always mark the row with the #include <QFile> as a not parsed header. That is, within "system header files" (header files that are located via the system include path) include statements using angle bracket and double quote are synonyms with each other.

This change in Semantic behavior could be controlled via a setting that is default off in order to be backward compatible.

Note: If the Foo.cpp example source file instead looked like this

---- 8< -----
#include <qfile.h>
---- 8< -----

Semantic is able to locate the qfile.h header file and parse it.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]