This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR preprocessor/39533: -MM may list a header file twice


On Thu, Mar 26, 2009 at 12:34 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "HJ" == H J Lu <hongjiu.lu@intel.com> writes:
>
> HJ> -MM may list a header file twice. It is caused by duplicated cpp_dir
> HJ> entry in file hash. ?make_cpp_dir may create a cpp_dir for "foo/"
> HJ> when pfile->quote_include is set to "foo" by -I. We wind up creating
> HJ> a cpp_dir entry for "foo/" with the next cpp_dir entry points to "foo".
> HJ> This patch checks if pfile->quote_include points to the same directory
> HJ> as DIR_NAME. ?OK for 4.5?
>
> Can you give an example showing how to reproduce this?
>
> HJ> + ?unsigned int dir_len;
>
> Should be size_t.

I just use the same type as the len field in include/cpplib.h.

>
> HJ> + ?/* All non-empty directory names should end in a '/'. ?Check if
> HJ> + ? ? pfile->quote_include is the same as DIR_NAME. ?We don't want to
> HJ> + ? ? add an duplicated cpp_dir entry here. ?*/
> HJ> + ?dir_len = strlen (dir_name);
> HJ> + ?if (dir_len == (pfile->quote_include->len + 1)
> HJ> + ? ? ?&& strncmp (dir_name, pfile->quote_include->name,
> HJ> + ? ? ? ? ? ? pfile->quote_include->len) == 0)
> HJ> + ? ?dir = pfile->quote_include;
>
> I don't really understand this.
> I'd like to reproduce the problem myself.
>

There is a testcase in:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39533


-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]