rspec/rules/S3730/rule.adoc

20 lines
822 B
Plaintext
Raw Normal View History

2021-01-27 13:42:22 +01:00
``++#include_next++`` is a gcc-specific language extension that alters the search path for the specified header file by starting the search from the header file directory _after_ the one in which the directive was encountered. It also ignores the distinction between ``++"file"++`` and ``++<file>++``. It is typically used when you have two (probably related) header files with the same name, although there is nothing in the extension to enforce or limit the use to same-name files.
2020-06-30 12:48:39 +02:00
2021-02-02 15:02:10 +01:00
2021-01-27 13:42:22 +01:00
Use of this extension can be tricky to get right, and is almost never justified. Instead, you should use an absolute path in the ``++#include++`` statement or rename one of the files.
2020-06-30 12:48:39 +02:00
== Noncompliant Code Example
----
#include_next "foo.h" // Noncompliant
----
== Compliant Solution
----
#include "/usr/local/include/foo.h"
----