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

--- Comment #13 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-06-30 
10:05:34 UTC ---
There seem to be two NULL fixincludes, one for openBSD and one for AIX, both
look suspicious (though I'd have to lookup the exact working of
fixincludes/inclhack.def):

/*
 * Fix OpenBSD's NULL definition.
 */
fix = {
  hackname  = openbsd_null_definition;
  mach      = "*-*-openbsd*";
  files     = locale.h, stddef.h, stdio.h, string.h,
  time.h, unistd.h, wchar.h, sys/param.h;
  select    = "__GNUG__";
  c_fix = format;
  c_fix_arg = "#ifndef NULL\n"
              "#ifdef __cplusplus\n"
              "#ifdef __GNUG__\n"
              "#define NULL\t__null\n"
              "#else\t /* ! __GNUG__  */\n"
              "#define NULL\t0L\n"
              "#endif\t /* __GNUG__  */\n"
              "#else\t /* ! __cplusplus  */\n"
              "#define NULL\t((void *)0)\n"
              "#endif\t /* __cplusplus  */\n"
              "#endif\t /* !NULL  */";

  c_fix_arg = "^#ifndef[ \t]*NULL\n"
              "^#ifdef[ \t]*__GNUG__\n"
              "^#define[ \t]*NULL[ \t]*__null\n"
              "^#else\n"
              "^#define[ \t]*NULL[ \t]*0L\n"
              "^#endif\n"
              "^#endif";
  test_text =
        "#ifndef NULL\n"
        "#ifdef  __GNUG__\n"
        "#define NULL    __null\n"
        "#else\n"
        "#define NULL    0L\n"
        "#endif\n"
        "#endif\n";
};

and

/*
 *  AIX and Interix headers define NULL to be cast to a void pointer,
 *  which is illegal in ANSI C++.
 */
fix = {
    hackname  = void_null;
    files     = curses.h;
    files     = dbm.h;
    files     = locale.h;
    files     = stdio.h;
    files     = stdlib.h;
    files     = string.h;
    files     = time.h;
    files     = unistd.h;
    files     = sys/dir.h;
    files     = sys/param.h;
    files     = sys/types.h;
    /* avoid changing C++ friendly NULL */
    bypass    = __cplusplus;
    select    = "^#[ \t]*define[ \t]+NULL[ \t]+\\(\\(void[ \t]*\\*\\)0\\)";
    c_fix     = format;
    c_fix_arg = "#define NULL 0";
    test_text = "# define\tNULL \t((void *)0)  /* typed NULL */";
};

maybe they work against each other somehow.

Can you attach the un-fixed string.h?

Reply via email to