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

From: [email-masked]
Date: Tue, 17 Apr 2018 10:00:30 +0000

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

Summary
=======

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.

Example
=======

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.