This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: New warning: -Wmissing-include-dirs
- From: Zack Weinberg <zack at codesourcery dot com>
- To: Ben Elliston <bje at au dot ibm dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 21 May 2004 18:47:00 -0700
- Subject: Re: New warning: -Wmissing-include-dirs
- References: <s9rr7tndavg.fsf@fs.ozlabs.ibm.com> <87zn81xnca.fsf@au.ibm.com>
Ben Elliston <bje@au.ibm.com> writes:
> Re-sending for Zack Weinberg to review (sorry for the noise).
>
>> A number of people have asked about such a warning, so I have
>> implemented it. Users are frequently bitten by -I switches that refer
>> to non-existent directories, leading to incorrect header files (of the
>> same name) being picked up from later in the include path. This is
>> best used in conjunction with -Werror to halt a built.
>>
>> I've included documentation and a test case. Okay for mainline?
>>
>> 2004-05-13 Ben Elliston <bje@au.ibm.com>
>>
>> * c.opt (Wmissing-include-dirs): New.
>> * c-opts.c (c_common_handle_option): Pass true for user_supplied_p
>> to add_path () for -I, but false for OPT_idirafter, OPT_iquote and
>> OPT_isystem. Handle case OPT_Wmissing_include_dirs.
>> * c-incpath.h (add_path): Add fourth (bool) argument.
>> * c-incpath.c (add_env_var_paths): Pass false to add_path ().
>> (add_standard_paths): Likewise.
>> (remove_duplicates) [REASON_NOENT]: Warn if -Wmissing-include-dirs
>> is used and the directory was user-supplied via -I.
>> (add_path): Set p->user_supplied_p. Remove duplicated code by
>> using add_cpp_dir_path ().
>> * cpplib.h (struct cpp_options): Add warn_missing_include_dirs.
>> (struct cpp_dir): Add user_supplied_p.
>> * doc/invoke.texi (Warning Options): Document new option.
OK.
zw