Bug 46444 - termination of preprocessing by cpp when no include file is found
Summary: termination of preprocessing by cpp when no include file is found
Status: RESOLVED DUPLICATE of bug 55115
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: 4.4.5
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-11 23:48 UTC by Igor Smirnov
Modified: 2014-09-14 15:31 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Smirnov 2010-11-11 23:48:48 UTC
Hi,

This is likely a change rather than a true accidental bug, but this 
looks like a wrong change.

This relates to preprocessor, but I assume that cpp is considering as part of gcc package?

The problem is that the cpp-preprocessor now terminates the treatment after the first non-resolved include directive, when no file is found. This did not happen in the past. This is first noticed by me at varsion gcc 4.4.5.

Still in version gcc 3.4.6 and numerous previous versions this did not happen.

The previous behaviour gave unique possibility to compile semi-preprocessed source files with all local (project-dependent) header files included but system-dependent files not included. After that a necessary set of include directoves could be added in the beginning of this file (by hand or automatically) and this file became compiled virtually at any computer.

An application program gathered into a single file by this way could be moved between different computers, compiled freely at any of them (even not necessarily Linux-based one) without installation of a whole set of project-related libraries (which could be difficult).

This is impossible to do in this way after this change.
If the preprocessor does not ignore the absent system include files (which 
are made inavailable by -nostdinc -nostdinc++ options), but writes as error diagnostics and quits, the project-dependent files cannot be gathered and preprocessed, unless they are specially prepared, which is very difficult.

If there is no any option which make possible ignoring by CPP absent includes (with possible issuing diagnostic),
I propose to add such an option or to return to previous behaviour, when absent
includes did not terminate cpp.

Regards
     Igor Smirnov
Comment 1 Paolo Carlini 2011-10-09 16:11:50 UTC
I suspect this is not going to happen. In any case, a preprocessor issue.
Comment 2 Manuel López-Ibáñez 2014-09-14 15:31:20 UTC
There are many work-arounds to achieve what you want to do.

*** This bug has been marked as a duplicate of bug 55115 ***