This is the mail archive of the 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]

Disable some bogus fixincludes operations

I noticed that, for all of the headers that get edited by fixincludes
on my system, the change is bogus.

 * stdio.h has its SUSv2-mandated (and properly guarded against
   appearing in strict-C89 mode) definition of va_list edited out.
 * curses.h, ncurses.h, and X11/Xlib.h get edited to put a __cplusplus guard
   around a definition of wchar_t, but they are already defended from that.
 * linux/nls.h gets the same fix, but that header is (a) never
   intended to be used for C++, (b) broken by the change (it depends
   on 'wchar_t' being exactly 16 bits and unsigned).
 * gmp.h is edited to avoid "__STDC__ != 1" even though this is
   guarded by a check of __SCO_VERSION__ which GCC does not define.

This is a proposed patch to prevent all of these edits.  I have high
confidence in the stdio.h and gmp.h changes, but the wchar_t stuff may
cast too wide a net.  The *right* check would be "if the selection
pattern matches, run this file through the preprocessor in -x c++
mode, then see if it still matches."  But I do not see how to do that,
and this change may be good enough.

Andi, this should get most of the edits you saw; the others, I either
do not have that header, or I have a newer version that doesn't get
edited.  Given how finicky fixinc is I am not inclined to make changes
I can't validate.



        * fixinc/inclhack.def (avoid_wchar_t_type): Add bypass
        expressions to prevent triggering on recent curses.h,
        linux/nls.h, or X11/Xlib.h.
        (stdio_va_list): Add _G_va_list to bypass pattern.
        (strict_ansi_not): Add bypass pattern for __SCO_VERSION__.

Index: fixinc/inclhack.def
--- fixinc/inclhack.def	7 May 2003 01:29:58 -0000	1.155
+++ fixinc/inclhack.def	18 May 2003 20:48:44 -0000
@@ -633,12 +633,19 @@ fix = {
  *  For C++, avoid any typedef definition of wchar_t,
  *  and use the built in type instead.
+ *  Don't do this for headers that are smart enough to do the right
+ *  thing (recent [n]curses.h and Xlib.h).
+ *  Don't do it for <linux/nls.h> which is never used from C++ anyway,
+ *  and will be broken by the edit.
 fix = {
     hackname = avoid_wchar_t_type;
     select    = "^[ \t]*typedef[ \t].*[ \t]wchar_t[ \t]*;";
+    bypass    = "we must use the C\\+\\+ compiler's type";
+    bypass    = "_LINUX_NLS_H";
+    bypass    = "XFree86: xc/lib/X11/Xlib\\.h";
     c_fix     = format;
     c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
@@ -2277,13 +2284,16 @@ fix = {
  *  Don't use or define the name va_list in stdio.h.
- *  This is for ANSI and also to interoperate properly with gcc's varargs.h.
- *  Note _BSD_VA_LIST_ is dealt with elsewhere.
+ *  This is for ANSI and also to interoperate properly with gcc's
+ *  varargs.h.  Note _BSD_VA_LIST_ is dealt with elsewhere.  The
+ *  presence of __gnuc_va_list, __DJ_va_list, or _G_va_list is taken
+ *  to indicate that the header knows what it's doing -- under SUSv2,
+ *  stdio.h is required to define va_list, and we shouldn't break that.
 fix = {
     hackname = stdio_va_list;
     files    = stdio.h;
-    bypass   = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list';
+    bypass   = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list';
      * Use __gnuc_va_list in arg types in place of va_list.
@@ -2325,6 +2335,9 @@ fix = {
                "|__STDC__[ \t]*-[ \t]*0[ \t]*==[ \t]*0)";
     /* Tru64 UNIX V4.0F/V5.1 <standards.h> supports GCC usage of __STDC__. */
     bypass = 'GNU and MIPS C compilers define __STDC__ differently';
+    /* GNU gmp.h uses "__STDC__ != 1" only if __SCO_VERSION__, which
+       is not defined by GCC, so it is safe.  */
+    bypass = '__SCO_VERSION__.*__STDC__ != 1';
     c_test   = stdc_0_in_system_headers;
     c_fix     = format;

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