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: Building libstdc++ on Alpha



Loren James Rittle wrote:
> [...]
> >/usr/local/lib/gcc-lib/alphaev56-dec-osf4.0c/2.96/include/sys/lc_core.h:64,
> >                 from /usr/include/sys/localedef.h:79,
> >                 from /usr/include/ctype.h:111,
> >                 from ../../../egcs/libstdc++/cctype:6,
> >                 from ../../../egcs/libstdc++/std/straits.h:105,
> >                 from ../../../egcs/libstdc++/std/bastring.h:36,
> >                 from ../../../egcs/libstdc++/string:6,
> >                 from ../../../egcs/libstdc++/sinst.cc:36:
> >/usr/local/lib/gcc-lib/alphaev56-dec-osf4.0c/2.96/include/reg_types.h:56:
> >syntax error before `;'
> >/usr/local/lib/gcc-lib/alphaev56-dec-osf4.0c/2.96/include/reg_types.h:58:
> >syntax error before `;'
> [... later error is a cascade problem...]
> 
> Please inspect
> /usr/local/lib/gcc-lib/alphaev56-dec-osf4.0c/2.96/include/reg_types.h
> on your system closely, I think it has been munged badly by the
> fixincludes process.  Bruce Korb has always been quite helpful fixing
> these issues quickly (given Mark's request to help you ASAP, I have
> preemptively CC'd Bruce).

Here is the relevant include fix.  Since I do not have a DEC Alpha,
my comments are based solely on the reading of the fix comments and
instructions below.  Clearly, the intent is to remove the versions of
the regular expression structs that are being defined inappropriately
inside of reg_types.h.  Since we are clobbering those structs and it
may be the case that there is code expecting to be able to use working
versions of those structures from merely including reg_types.h, perhaps
we should also stuff a ``#include <regex.h>'' into the file while we
are at this?

  /*
   *  sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by
   *  defining regex.h related types.  This causes libg++ build and usage
   *  failures.  Fixing this correctly requires checking and modifying 3 files.
   */
  fix = {
    hackname = osf_namespace_a;
    files    = reg_types.h;
    files    = sys/lc_core.h;
    test     = " -r reg_types.h";   /* this file must exist */
    test     = " -r sys/lc_core.h"; /* so must this one     */
    /*
     *  A definition of regex_t must be found, and there must
     *  *not* be an occurrance of '__regex_t' in regex.h:
     */
    test     = " -n \"`grep '} regex_t;' reg_types.h`\"";
    test     = " -z \"`grep __regex_t regex.h`\"";

    /*
     *  IF all the above conditions are met,
     *  THEN prefix all references to 'reg(ex|off|match)_t' with '__'
     */
    c_fix     = format;
    c_fix_arg = "__%0";
    c_fix_arg = "reg(ex|off|match)_t[^;]";

    test_text = "`touch sys/lc_core.h`"
    "typedef struct {\n  int stuff, mo_suff;\n} regex_t;\n"
    "extern regex_t    re;\n"
    "extern regoff_t   ro;\n"
    "extern regmatch_t rm;\n";
  };

  fix = {
    hackname = osf_namespace_c;
    files    = regex.h;
    test     = " -r reg_types.h";
    test     = " -r sys/lc_core.h";
    test     = " -n \"`grep '} regex_t;' reg_types.h`\"";
    test     = " -z \"`grep __regex_t regex.h`\"";

    /*
     *  IF the same above tests also yield TRUE,  *AND* regex.h
     *  #include-s reg_types.h (I.e. regex.h gets its structure
     *  definitions from reg_types.h instead of defining them itself),
     *  THEN typedef the POSIXly correct names to the funny names
     *  we created with the previous fix
     */
    select    = "#include <reg_types\.h>.*";
    c_fix     = format;
    c_fix_arg = "%0\n"
                "typedef __regex_t\tregex_t;\n"
                "typedef __regoff_t\tregoff_t;\n"
                "typedef __regmatch_t\tregmatch_t;";

    test_text = "#include <reg_types.h>";
  };

> I have 2.95 built on alpha-dec-osf4.0d and 2.95.1 built on
> alpha-dec-osf4.0f.  In both cases, here is the patch applied
> by fixinclude to /usr/include/reg_types.h:
> 
> --- /usr/include/reg_types.h    Sat Nov 16 00:34:24 1996
> +++ /usr/local/lib/gcc-lib/alpha-dec-osf4.0f/2.95.1/include/reg_types.h Mon Aug 16 14:16:40 1999
> @@ -47,17 +47,17 @@
>          uchar_t **re_esub;      /* end subexp array                     */
>         void    *re_filler[8];  /* Filler for any future 'extensions'   */
>          uchar_t re_map[256];    /* map of valid pattern characters      */
> -} regex_t;
> +} __regex_t;
> 
> -typedef off_t regoff_t;
> +typedef off_t __regoff_t;
> 
> 
>  typedef struct {                /* substring locations - from regexec() */
> -        regoff_t   rm_so;      /* Byte offset from start of string to  */
> +        __regoff_t   rm_so;    /* Byte offset from start of string to  */
>                                  /*   start of substring                 */
> -        regoff_t   rm_eo;      /* Byte offset from start of string of  */
> +        __regoff_t   rm_eo;    /* Byte offset from start of string of  */
>                                  /*   first character after substring    */
> -} regmatch_t;
> +} __regmatch_t;
> 
>  #ifdef __cplusplus
>  }

The fix has correctly trashed the "regex_t", "regoff_t" and "regmatch_t" types.
"regex.h" should now typdef the correct types into these renamed types.
Where is that diff?

> In both cases, here is the patch applied by fixinclude to
> /usr/include/sys/lc_core.h:

I do not know why osf_namespace_a is applied to lc_core.h.
For that, you gotta ask the people that did it in the first
place (or browse multi-year-old archives)-:.


> --- /usr/include/sys/lc_core.h  Sat Nov 16 00:32:13 1996
> +++ /usr/local/lib/gcc-lib/alpha-dec-osf4.0f/2.95.1/include/sys/lc_core.h      Mon Aug 16 14:22:49 1999
> @@ -201,10 +201,10 @@
>      int      (*fnmatch) __((const char *, const char *, const char *, int, struct _LC_collate_t *));
> 
>      /* regular expression methods */
> -    int      (*regcomp) __LCPROTO((regex_t *, const char *, int, struct _LC_collate_t *));
> -    size_t   (*regerror) __LCPROTO((int, const regex_t *, char *, size_t, struct _LC_collate_t *));
> -    int      (*regexec) __LCPROTO((const regex_t *, const char *, size_t, regmatch_t *, int, struct _LC_collate_t *));
> -    void     (*regfree) __LCPROTO((regex_t *, struct _LC_collate_t *));
> +    int      (*regcomp) __LCPROTO((__regex_t *, const char *, int, struct _LC_collate_t *));
> +    size_t   (*regerror) __LCPROTO((int, const __regex_t *, char *, size_t, struct _LC_collate_t *));
> +    int      (*regexec) __LCPROTO((const __regex_t *, const char *, size_t, __regmatch_t *, int, struct _LC_collate_t *));
> +    void     (*regfree) __LCPROTO((__regex_t *, struct _LC_collate_t *));
> 
>      /* implementation initialization */
>      struct _LC_collate_t *(*init) __((struct _LC_locale_t *));
> 
> I don't know why the alpha headers were fixed like this, but...

Namespace pollution.

> If fixinclude did something different for you, there may be a problem...
> 
> For the exact error messages you posted, I speculate that fixinclude
> is still munging the typedef for regoff_t in /usr/include/reg_types.h,
> but not the later usage.
> 
> Another issue to consider, it is possible that Bruce already fixed
> this since I note you are building gcc against an already installed
> 2.96.
> 
> Please report to me and Bruce if your fixed reg_types.h header is
> indeed broken.  You can fix it by hand (using the diff I posted above
> as a guide).  Then, if a current alpha bootstrap still displays the
> problem, Bruce or I can work on a fix.

I will have to beg for you to do it.
I will be gone after tomorrow for a couple of weeks.  :-)

Regards,
	Bruce

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