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]
Other format: [Raw text]

Re: [PATCH 3.3/3.4]: Several new include hacks for PA HP-UX


John David Anglin wrote:

> Ok for main and 3.3?

Have you run "make check" in the fixinc directory?
The output will show you exactly what has changed.
Are the differences what you would expect?  If so,
then please ensure that the "base" directory is an
exact copy of the "res" directory:

  ${top_builddir}/gcc/fixinc/tests/res
    ${top_srcdir}/gcc/ficinc/tests/base

The diff output will tell you what needs changing.

> Index: fixinc/inclhack.def
> ===================================================================
> RCS file: /cvsroot/gcc/gcc/gcc/fixinc/inclhack.def,v
> retrieving revision 1.141
> diff -u -3 -p -r1.141 inclhack.def
> --- fixinc/inclhack.def 17 Jan 2003 02:07:45 -0000      1.141
> +++ fixinc/inclhack.def 6 Feb 2003 18:58:51 -0000
> @@ -1017,6 +1017,26 @@ fix = {
> 
> 
>  /*
> + * HP-UX long_double
> + */
> +fix = {
> +    hackname  = hpux_long_double;
> +    files     = stdlib.h;
> +    select    = "long_double";
> +    sed       = "/^#[ \t]*ifndef _LONG_DOUBLE/,/\\/\\* _LONG_DOUBLE \\*\\//D";
> +    sed       = "s/long_double/long double/g";
> +
> +    test_text = "#  ifndef _LONG_DOUBLE\n"
> +               "#    define _LONG_DOUBLE\n"
> +               "     typedef struct {\n"
> +               "       unsigned int word1, word2, word3, word4;\n"
> +               "     } long_double;\n"
> +               "#  endif /* _LONG_DOUBLE */\n"
> +               "extern long_double strtold(const char *, char **);\n";

Looking at what is going on here, my guess would be that you might
want to do the substitution on any HP/UX header that had ``long_double''.
'course as of now, "stdlib.h" is the complete list.  I don't know.
Up to you.

> +/*
> + *  Fix hpux 10.X missing ctype declarations 1
> + */
> +fix = {
> +    hackname = hpux10_ctype_declarations1;
> +    files    = ctype.h;
> +    select   = "^#[ \t]*define _toupper\\(__c\\)[ \t]*__toupper\\(__c\\)";
> +    bypass   = "^[ \t]*extern[ \t]*int[ \t]*__tolower[ \t]*\\(int\\);";

This presumes a very precise format of the __tolower argument list.
This should be adequate, since you are looking for ``__tolower'' decl:

       bypass   = "^[ \t]*extern[ \t]*int[ \t]*__tolower[ \t]*\\(";

> +/*
> + *  Fix hpux 10.X missing ctype declarations 2
> + */
> +fix = {
> +    hackname = hpux10_ctype_declarations2;
> +    files    = ctype.h;
> +    select   = "^#  if defined\\(_SB_CTYPE_MACROS\\) && \\!defined\\(__lint\\)";
> +    bypass   = "^[ \t]*extern[ \t]*int[ \t]*_isalnum[ \t]*\\(int\\);";

As above.

> +/*
> + *  Fix hpux 10.X broken ctype macros
> + */
> +fix = {
> +    hackname = hpux10_ctype_macros;
> +    files    = ctype.h;
> +    select   = "([ \t]*: __SB_masks \\? )(__SB_masks\\[__alnum\\] & _IS)";
> +    c_fix     = format;
> +    c_fix_arg = "%1(int)%2";
> +
> +    test_text = ': __SB_masks ? __SB_masks[__alnum] & _ISCNTRL';
> +};
> +
> +
> +/*
> + *  Fix hpux 11.X broken ctype macros
> + */
> +fix = {
> +    hackname = hpux11_ctype_macros;
> +    files    = ctype.h;
> +    select   = "(^#[ \t]*define.*__SB_masks \\? )(__SB_masks\\[__c\\] & _IS)";
> +    c_fix     = format;
> +    c_fix_arg = "%1(int)%2";
> +
> +    test_text = '# define isalpha(__c) (__SB_masks ? __SB_masks[__c] & _IS';
>  };

I'd rather see a combined fix for these.  I think.
Dunno:  +1 fewer tests --> less wasted time
        -1 more complex

/*
 *  Fix hpux 10.X broken ctype macros
 */
fix = {
    hackname = hpux_ctype_macros;
    files    = ctype.h;
    select   = "((: |^#[ \t]*define.*)__SB_masks \\? )"
               "(__SB_masks\\[__(alnum|c)\\] & _IS)";
    c_fix     = format;
    c_fix_arg = "%1(int)%3";

    test_text = "whatever : __SB_masks ? __SB_masks[__alnum] & _ISCNTRL\n"
         "# define isalpha(__c) (__SB_masks ? __SB_masks[__c] & _ISCNTRL";
};

You will need to create a new test result file:  fixinc/tests/base/ctype.h
> 
> /*  DO NOT EDIT THIS FILE.
> 
>     It has been auto-edited by fixincludes from:
> 
>         "fixinc/tests/inc/ctype.h"
> 
>     This had to be done to correct non-standard usages in the
>     original, manufacturer supplied header file.  */
> 
> 
> 
> #if defined( HPUX_CTYPE_MACROS_CHECK )
> whatever : __SB_masks ? (int)__SB_masks[__alnum] & _ISCNTRL
> # define isalpha(__c) (__SB_masks ? (int)__SB_masks[__c] & _ISCNTRL
> #endif  /* HPUX_CTYPE_MACROS_CHECK */


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