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]

Re: system include directories


On Sun, Jul 01, 2001 at 10:19:52PM +0100, Nathan Sidwell wrote:
> "Joseph S. Myers" wrote:
> > 
> > This "%ssystem" usage won't work properly with i18n.  As a minimum you
> > would need to use _ around the "non-" string, but better to use two
> > separate strings with "system" and "non-system".
> > 
> > The documentation in gcc.texi under "Use of @samp{-I/usr/include} may
> > cause trouble." needs updating.  I'd suggest not telling people how to
> > specify include directories manually, but rather telling them "don't do
> > that" and saying that GCC will warn if you try.
> Is this patch what you had in mind?

We're making progress, but I still have some concerns:-

>         for (other = head; other != cur; other = other->next)
>           if (INO_T_EQ (cur->ino, other->ino) && cur->dev == other->dev)
>   	  {
> + 	    if (cur->sysp)
> + 	      {
> + 		const char *non = other->sysp ? "" : "non-";

Unused variable left in...

> + 		
> + 		cpp_warning (pfile,
> + 			     _("changing search order for system directory \"%s\""),

Don't need _() here.  In fact, you shouldn't need any of them, I think
gettext has the brains to extract the other strings despite their
being inside a ?: expression.  Take them all out, regenerate gcc.pot,
and see if any of the strings are missing.

> + 			     cur->name);
> + 		if (strcmp (cur->name, other->name))
> + 		  cpp_warning (pfile, other->sysp
> + 			       ? _("  as it is aliased to system directory \"%s\"")
> + 			       : _("  as it is aliased to non-system directory \"%s\""),

I-the-naive-user don't know what "aliased" means in this context.
"as it is the same as" is probably better.

> *************** merge_include_chains (pfile)
> *** 370,375 ****
> --- 389,395 ----
>   
>   /* Sets internal flags correctly for a given language, and defines
>      macros if necessary.  */
> + 
>   static void
>   set_lang (pfile, lang)
>        cpp_reader *pfile;

Gratuitous delta here.

> *************** not use this option to add directories t
> *** 4351,4356 ****
> --- 4351,4360 ----
>   system header files (use @option{-isystem} for that).  If you use more than
>   one @option{-I} option, the directories are scanned in left-to-right
>   order; the standard system directories come after.
> + 
> + GCC will detect and warn you, if a directory is specified with both the
> + @option{-I} and also is a system search directory (either by default, or
> + with @option{-isystem}).

This wants a fair bit more explanation.

  If a standard system include directory, or a directory specified
  with @option{-isystem}, is also specified with @option{-I}, it will
  be searched only in the position requested by @option{-I}.  Also, it
  will not be considered a system include directory.

  If that directory really does contain system headers, there is a
  good chance that they will break.  For instance, if GCC's
  installation procedure edited the headers in @file{/usr/include} to
  fix bugs, @samp{-I/usr/include} will cause the original, buggy
  headers to be found instead of the corrected ones.

  GCC 3.0.1 and later will issue a warning when this happens.

[change that to 3.1 if this is judged not necessary for the branch]

You should also discuss this in cpp.texi.

zw


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