This is the mail archive of the gcc-bugs@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: aggressive fixincludes




Mark Mitchell wrote:
> 
> >>>>> "korbb" == korbb  <korbb@sourceware.cygnus.com> writes:
> 
>     korbb> Sure.  Tell me how to identify the fact that "FlexLexer.h"
>     korbb> is a C++ file.
> 
> One thing I am concerned about is that fixincluded files to not get
> updated when packages get updated.  So, to prevent skew, we should
> keep the number of fixincluded files to a minimum, even if the fixes
> do not in any way break the file.

I also prefer to reduce clutter....

> As for a solution, finding an `extern "C++"' is a good hint it's not C
> file.  (`extern "C"' might appear in a C header that can be included
> from C++, but `extern "C++"' is much less likely.)  That would cover
> FlexLexer.h.
> 
> And anything in /usr/include/g++* (g++,g++-2,g++-3) should be excluded
> from this test, as those are C++ files.

Current code:

  /*  First, check to see if the file is in a C++ directory */
  if (strstr( fname, "CC/" ) != NULL)
    return SKIP_FIX;
  if (strstr( fname, "xx/" ) != NULL)
    return SKIP_FIX;
  if (strstr( fname, "++/" ) != NULL)
    return SKIP_FIX;

How about changing the last test to:

  if (strstr( fname, "++" ) != NULL)
    return SKIP_FIX;

and adding:

  if (strstr( text, "extern \"C++\"" ) != NULL)
    return SKIP_FIX;

=========

As for the ^M stuff, I liked it because it did not cause
interesting stuff to scroll off the screen.


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