Issue Details (XML | Word | Printable)

Key: PCC-109
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Altamiranus
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
pcc

#include_next is not working

Created: 22/Jan/10 10:43 PM   Updated: 08/Jun/10 06:39 PM
Component/s: C preprocessor
Affects Version/s: None
Fix Version/s: None

File Attachments: 1. Text File include_next.patch (1 kB)

Environment: Any enviroment whose headers have the #include_next directive.


 Description  « Hide
In several distributions of Linux, there's an #include_next directive in limits.h. When attempting to compile a program that includes it, pcc fails with a "file not found" error. (Not the exact words, but anyway...) The problem is that the fsrch function returns 0 because it cannot find another file named limits.h in the search path. Official documentation for the #include_next directive is scant, but my guess is that #include_next should attempt to find the next named file, but shouldn't fail if it doesn't.

Oddly enough, of all the header files in the system, only one has this directive, and it is limits.h. Sigh.

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Alexander Vladimirov added a comment - 05/Jun/10 07:15 PM
Gcc treats #include_next directive as normal #include, with one exception: it starts lookup of specified file from the include directory where current include file was found, and continues further through the list. When there is no such file further in the include directory list, gcc throws the following error:
/usr/include/limits.h:125:26: error: no include path in which to search for limits.h
Creating empty limits.h file in /usr/lib/pcc/x86_64-unknown-linux-gnu/0.9.9/include//limits.h makes cpp generate incorrect output (it puts <limits.h> into output after included file) because function include_next in cc/cpp/cpp.c is incorrect (or it's just a stub).

Alexander Vladimirov added a comment - 05/Jun/10 07:18 PM
this patch fixes issue for me

Anders Magnusson added a comment - 08/Jun/10 06:39 PM
Fixed with additions to handle "foo.h" by me.