OSDN Git Service

* c-common.c (unsigned_conversion_warning, convert_and_check,
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 1 Apr 2002 08:46:10 +0000 (08:46 +0000)
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 1 Apr 2002 08:46:10 +0000 (08:46 +0000)
unsigned_type, signed_type, shorten_compare,
c_common_get_alias_set, c_common_nodes_and_builtins): Use new hooks.
(unsigned_type, signed_type, signed_or_unsigned_type): Rename.
* c-common.h (unsigned_type, signed_type, signed_or_unsigned_type):
New.
* c-decl.c (grokdeclarator): Update.
* c-format.c (check_format_types): Update.
* c-lang.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE,
LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New.
* c-typeck.c (build_binary_op, convert_for_assignment): Update.
* convert.c (convert_to_integer): Use new hooks.
* expmed.c (make_tree): Use new hooks.
* expr.c (store_expr): Use new hooks.
* fold-const.c (operand_equal_for_comparison_p, build_range_check,
all_ones_mask_p, unextend, fold): Use new hooks.
* langhooks.h (struct lang_hooks_for_types): New hooks.
* tree.h (signed_or_unsigned_type, signed_type,
unsigned_type): Remove.
ada:
* gigi.h (unsigned_type, signed_type, signed_or_unsigned_type):
Rename.
* misc.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE,
LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New.
* trans.c (tree_transform, convert_with_check): Update.
* utils.c (unsigned_type, signed_type, signed_or_unsigned_type):
Rename.
cp:
* cp-lang.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE,
LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New.
* decl.c (grokdeclarator): Update.
* mangle.c (write_integer_cst): Update.
* typeck.c (build_binary_op): Update.
f:
* com.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE,
LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New.
(unsigned_type, signed_type, signed_or_unsigned_type): Rename.
java:
* expr.c (build_java_binop): Update.
* java-tree.h (java_signed_type, java_unsigned_type,
java_signed_or_unsigned_type): Update.
* lang.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE,
LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New.
* parse.y (patch_binop): Update.
* typeck.c (signed_or_unsigned_type, unsigned_type,
signed_type): Update.
objc:
* objc-lang.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE,
LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@51684 138bc75d-0d04-0410-961f-82ee72b054a4

33 files changed:
gcc/ChangeLog
gcc/ada/ChangeLog
gcc/ada/gigi.h
gcc/ada/misc.c
gcc/ada/trans.c
gcc/ada/utils.c
gcc/c-common.c
gcc/c-common.h
gcc/c-decl.c
gcc/c-format.c
gcc/c-lang.c
gcc/c-typeck.c
gcc/convert.c
gcc/cp/ChangeLog
gcc/cp/cp-lang.c
gcc/cp/decl.c
gcc/cp/mangle.c
gcc/cp/typeck.c
gcc/expmed.c
gcc/expr.c
gcc/f/ChangeLog
gcc/f/com.c
gcc/fold-const.c
gcc/java/ChangeLog
gcc/java/expr.c
gcc/java/java-tree.h
gcc/java/lang.c
gcc/java/parse.y
gcc/java/typeck.c
gcc/langhooks-def.h
gcc/langhooks.h
gcc/objc/objc-lang.c
gcc/tree.h

index d7bc594..ba1c60b 100644 (file)
@@ -1,3 +1,28 @@
+2002-04-01  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       * c-common.c (unsigned_conversion_warning, convert_and_check,
+       unsigned_type, signed_type, shorten_compare,
+       c_common_get_alias_set, c_common_nodes_and_builtins): Use new hooks.
+       (unsigned_type, signed_type, signed_or_unsigned_type): Rename.
+       * c-common.h (unsigned_type, signed_type, signed_or_unsigned_type):
+       New.
+       * c-decl.c (grokdeclarator): Update.
+       * c-format.c (check_format_types): Update.
+       * c-lang.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE,
+       LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New.
+       * c-typeck.c (build_binary_op, convert_for_assignment): Update.
+       * convert.c (convert_to_integer): Use new hooks.
+       * expmed.c (make_tree): Use new hooks.
+       * expr.c (store_expr): Use new hooks.
+       * fold-const.c (operand_equal_for_comparison_p, build_range_check,
+       all_ones_mask_p, unextend, fold): Use new hooks.
+       * langhooks.h (struct lang_hooks_for_types): New hooks.
+       * tree.h (signed_or_unsigned_type, signed_type,
+       unsigned_type): Remove.
+objc:
+       * objc-lang.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE,
+       LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New.
+
 2002-03-31  Richard Henderson  <rth@redhat.com>
 
        * config/ia64/unwind-ia64.c (alloc_spill_area): Fix offset.
index 062c7e6..8e7367f 100644 (file)
@@ -1,3 +1,13 @@
+2002-04-01  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       * gigi.h (unsigned_type, signed_type, signed_or_unsigned_type):
+       Rename.
+       * misc.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE,
+       LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New.
+       * trans.c (tree_transform, convert_with_check): Update.
+       * utils.c (unsigned_type, signed_type, signed_or_unsigned_type):
+       Rename.
+
 2002-03-31  Neil Booth  <neil@daikokuya.demon.co.uk>
 
        * gigi.h (finish_incomplete_decl): Rename.
index de05d4e..32fcaef 100644 (file)
@@ -430,14 +430,14 @@ extern tree gnat_type_for_size            PARAMS ((unsigned, int));
 extern tree gnat_type_for_mode         PARAMS ((enum machine_mode, int));
 
 /* Return the unsigned version of a TYPE_NODE, a scalar type.  */
-extern tree unsigned_type              PARAMS ((tree));
+extern tree gnat_unsigned_type         PARAMS ((tree));
 
 /* Return the signed version of a TYPE_NODE, a scalar type.  */
-extern tree signed_type                        PARAMS ((tree));
+extern tree gnat_signed_type           PARAMS ((tree));
 
 /* Return a type the same as TYPE except unsigned or signed according to
    UNSIGNEDP.  */
-extern tree signed_or_unsigned_type    PARAMS ((int, tree));
+extern tree gnat_signed_or_unsigned_type PARAMS ((int, tree));
 
 /* This routine is called in tree.c to print an error message for invalid use
    of an incomplete type.  */
index 8edbba4..866afc3 100644 (file)
@@ -124,6 +124,12 @@ static rtx gnat_expand_expr                PARAMS ((tree, rtx, enum machine_mode,
 #define LANG_HOOKS_TYPE_FOR_MODE       gnat_type_for_mode
 #undef LANG_HOOKS_TYPE_FOR_SIZE
 #define LANG_HOOKS_TYPE_FOR_SIZE       gnat_type_for_size
+#undef LANG_HOOKS_SIGNED_TYPE
+#define LANG_HOOKS_SIGNED_TYPE         gnat_signed_type
+#undef LANG_HOOKS_UNSIGNED_TYPE
+#define LANG_HOOKS_UNSIGNED_TYPE       gnat_unsigned_type
+#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
+#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE gnat_signed_or_unsigned_type
 
 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
 
index c943a00..19c7b01 100644 (file)
@@ -1348,7 +1348,7 @@ tree_transform (gnat_node)
                /* 'Length or 'Range_Length.  */
                {
                  tree gnu_compute_type
-                   = signed_or_unsigned_type
+                   = gnat_signed_or_unsigned_type
                      (0, get_base_type (gnu_result_type));
 
                  gnu_result
@@ -1867,10 +1867,10 @@ tree_transform (gnat_node)
           so we may need to choose a different type.  */
        if (Nkind (gnat_node) == N_Op_Shift_Right
            && ! TREE_UNSIGNED (gnu_type))
-         gnu_type = unsigned_type (gnu_type);
+         gnu_type = gnat_unsigned_type (gnu_type);
        else if (Nkind (gnat_node) == N_Op_Shift_Right_Arithmetic
                 && TREE_UNSIGNED (gnu_type))
-         gnu_type = signed_type (gnu_type);
+         gnu_type = gnat_signed_type (gnu_type);
 
        if (gnu_type != gnu_result_type)
          {
@@ -4674,17 +4674,17 @@ convert_with_check (gnat_type, gnu_expr, overflow_p, range_p, truncate_p)
         comparing them properly.  Likewise, convert the upper bounds
         to unsigned types.  */
       if (INTEGRAL_TYPE_P (gnu_in_basetype) && TREE_UNSIGNED (gnu_in_basetype))
-       gnu_in_lb = convert (signed_type (gnu_in_basetype), gnu_in_lb);
+       gnu_in_lb = convert (gnat_signed_type (gnu_in_basetype), gnu_in_lb);
 
       if (INTEGRAL_TYPE_P (gnu_in_basetype)
          && ! TREE_UNSIGNED (gnu_in_basetype))
-       gnu_in_ub = convert (unsigned_type (gnu_in_basetype), gnu_in_ub);
+       gnu_in_ub = convert (gnat_unsigned_type (gnu_in_basetype), gnu_in_ub);
 
       if (INTEGRAL_TYPE_P (gnu_base_type) && TREE_UNSIGNED (gnu_base_type))
-       gnu_out_lb = convert (signed_type (gnu_base_type), gnu_out_lb);
+       gnu_out_lb = convert (gnat_signed_type (gnu_base_type), gnu_out_lb);
 
       if (INTEGRAL_TYPE_P (gnu_base_type) && ! TREE_UNSIGNED (gnu_base_type))
-       gnu_out_ub = convert (unsigned_type (gnu_base_type), gnu_out_ub);
+       gnu_out_ub = convert (gnat_unsigned_type (gnu_base_type), gnu_out_ub);
 
       /* Check each bound separately and only if the result bound
         is tighter than the bound on the input type.  Note that all the
index 6d8f637..58b7af6 100644 (file)
@@ -2022,7 +2022,7 @@ gnat_type_for_mode (mode, unsignedp)
 /* Return the unsigned version of a TYPE_NODE, a scalar type.  */
 
 tree
-unsigned_type (type_node)
+gnat_unsigned_type (type_node)
      tree type_node;
 {
   tree type = gnat_type_for_size (TYPE_PRECISION (type_node), 1);
@@ -2046,7 +2046,7 @@ unsigned_type (type_node)
 /* Return the signed version of a TYPE_NODE, a scalar type.  */
 
 tree
-signed_type (type_node)
+gnat_signed_type (type_node)
      tree type_node;
 {
   tree type = gnat_type_for_size (TYPE_PRECISION (type_node), 0);
@@ -2071,7 +2071,7 @@ signed_type (type_node)
    UNSIGNEDP.  */
 
 tree
-signed_or_unsigned_type (unsignedp, type)
+gnat_signed_or_unsigned_type (unsignedp, type)
      int unsignedp;
      tree type;
 {
index a3fa017..04cd3c4 100644 (file)
@@ -757,13 +757,15 @@ void
 unsigned_conversion_warning (result, operand)
      tree result, operand;
 {
+  tree type = TREE_TYPE (result);
+
   if (TREE_CODE (operand) == INTEGER_CST
-      && TREE_CODE (TREE_TYPE (result)) == INTEGER_TYPE
-      && TREE_UNSIGNED (TREE_TYPE (result))
+      && TREE_CODE (type) == INTEGER_TYPE
+      && TREE_UNSIGNED (type)
       && skip_evaluation == 0
-      && !int_fits_type_p (operand, TREE_TYPE (result)))
+      && !int_fits_type_p (operand, type))
     {
-      if (!int_fits_type_p (operand, signed_type (TREE_TYPE (result))))
+      if (!int_fits_type_p (operand, c_common_signed_type (type)))
        /* This detects cases like converting -129 or 256 to unsigned char.  */
        warning ("large integer implicitly truncated to unsigned type");
       else if (warn_conversion)
@@ -812,7 +814,8 @@ convert_and_check (type, expr)
               don't warn unless pedantic.  */
            if ((pedantic
                 || TREE_UNSIGNED (type)
-                || ! constant_fits_type_p (expr, unsigned_type (type)))
+                || ! constant_fits_type_p (expr,
+                                           c_common_unsigned_type (type)))
                && skip_evaluation == 0)
              warning ("overflow in implicit constant conversion");
        }
@@ -1435,7 +1438,7 @@ c_common_type_for_mode (mode, unsignedp)
 
 /* Return an unsigned type the same as TYPE in other respects.  */
 tree
-unsigned_type (type)
+c_common_unsigned_type (type)
      tree type;
 {
   tree type1 = TYPE_MAIN_VARIANT (type);
@@ -1464,13 +1467,13 @@ unsigned_type (type)
   if (type1 == intQI_type_node)
     return unsigned_intQI_type_node;
 
-  return signed_or_unsigned_type (1, type);
+  return c_common_signed_or_unsigned_type (1, type);
 }
 
 /* Return a signed type the same as TYPE in other respects.  */
 
 tree
-signed_type (type)
+c_common_signed_type (type)
      tree type;
 {
   tree type1 = TYPE_MAIN_VARIANT (type);
@@ -1499,14 +1502,14 @@ signed_type (type)
   if (type1 == unsigned_intQI_type_node)
     return intQI_type_node;
 
-  return signed_or_unsigned_type (0, type);
+  return c_common_signed_or_unsigned_type (0, type);
 }
 
 /* Return a type the same as TYPE except unsigned or
    signed according to UNSIGNEDP.  */
 
 tree
-signed_or_unsigned_type (unsignedp, type)
+c_common_signed_or_unsigned_type (unsignedp, type)
      int unsignedp;
      tree type;
 {
@@ -1755,7 +1758,8 @@ shorten_compare (op0_ptr, op1_ptr, restype_ptr, rescode_ptr)
       int unsignedp = TREE_UNSIGNED (*restype_ptr);
       tree val;
 
-      type = signed_or_unsigned_type (unsignedp0, TREE_TYPE (primop0));
+      type = c_common_signed_or_unsigned_type (unsignedp0,
+                                              TREE_TYPE (primop0));
 
       /* If TYPE is an enumeration, then we need to get its min/max
         values from it's underlying integral type, not the enumerated
@@ -1767,7 +1771,7 @@ shorten_compare (op0_ptr, op1_ptr, restype_ptr, rescode_ptr)
       minval = TYPE_MIN_VALUE (type);
 
       if (unsignedp && !unsignedp0)
-       *restype_ptr = signed_type (*restype_ptr);
+       *restype_ptr = c_common_signed_type (*restype_ptr);
 
       if (TREE_TYPE (primop1) != *restype_ptr)
        primop1 = convert (*restype_ptr, primop1);
@@ -1864,7 +1868,7 @@ shorten_compare (op0_ptr, op1_ptr, restype_ptr, rescode_ptr)
              default:
                break;
              }
-         type = unsigned_type (type);
+         type = c_common_unsigned_type (type);
        }
 
       if (!max_gt && !unsignedp0 && TREE_CODE (primop0) != INTEGER_CST)
@@ -1916,15 +1920,19 @@ shorten_compare (op0_ptr, op1_ptr, restype_ptr, rescode_ptr)
           && TYPE_PRECISION (TREE_TYPE (primop1)) < TYPE_PRECISION (*restype_ptr))
     {
       type = common_type (TREE_TYPE (primop0), TREE_TYPE (primop1));
-      type = signed_or_unsigned_type (unsignedp0
-                                     || TREE_UNSIGNED (*restype_ptr),
-                                     type);
+      type = c_common_signed_or_unsigned_type (unsignedp0
+                                              || TREE_UNSIGNED (*restype_ptr),
+                                              type);
       /* Make sure shorter operand is extended the right way
         to match the longer operand.  */
-      primop0 = convert (signed_or_unsigned_type (unsignedp0, TREE_TYPE (primop0)),
-                        primop0);
-      primop1 = convert (signed_or_unsigned_type (unsignedp1, TREE_TYPE (primop1)),
-                        primop1);
+      primop0
+       = convert (c_common_signed_or_unsigned_type (unsignedp0,
+                                                    TREE_TYPE (primop0)),
+                  primop0);
+      primop1
+       = convert (c_common_signed_or_unsigned_type (unsignedp1,
+                                                    TREE_TYPE (primop1)),
+                  primop1);
     }
   else
     {
@@ -1947,7 +1955,7 @@ shorten_compare (op0_ptr, op1_ptr, restype_ptr, rescode_ptr)
                 so suppress the warning.  */
              if (extra_warnings && !in_system_header
                  && ! (TREE_CODE (primop0) == INTEGER_CST
-                       && ! TREE_OVERFLOW (convert (signed_type (type),
+                       && ! TREE_OVERFLOW (convert (c_common_signed_type (type),
                                                     primop0))))
                warning ("comparison of unsigned expression >= 0 is always true");
              value = boolean_true_node;
@@ -1956,7 +1964,7 @@ shorten_compare (op0_ptr, op1_ptr, restype_ptr, rescode_ptr)
            case LT_EXPR:
              if (extra_warnings && !in_system_header
                  && ! (TREE_CODE (primop0) == INTEGER_CST
-                       && ! TREE_OVERFLOW (convert (signed_type (type),
+                       && ! TREE_OVERFLOW (convert (c_common_signed_type (type),
                                                     primop0))))
                warning ("comparison of unsigned expression < 0 is always false");
              value = boolean_false_node;
@@ -2365,7 +2373,7 @@ c_common_get_alias_set (t)
      variant as canonical.  */
   if (TREE_CODE (t) == INTEGER_TYPE && TREE_UNSIGNED (t))
     {
-      tree t1 = signed_type (t);
+      tree t1 = c_common_signed_type (t);
 
       /* t1 == t can happen for boolean nodes which are always unsigned.  */
       if (t1 != t)
@@ -2621,7 +2629,7 @@ c_common_nodes_and_builtins ()
      and this must agree, even if long and int are the same size.  */
   c_size_type_node =
     TREE_TYPE (identifier_global_value (get_identifier (SIZE_TYPE)));
-  signed_size_type_node = signed_type (c_size_type_node);
+  signed_size_type_node = c_common_signed_type (c_size_type_node);
   set_sizetype (c_size_type_node);
 
   build_common_tree_nodes_2 (flag_short_double);
@@ -2690,8 +2698,8 @@ c_common_nodes_and_builtins ()
     }
   else
     {
-      signed_wchar_type_node = signed_type (wchar_type_node);
-      unsigned_wchar_type_node = unsigned_type (wchar_type_node);
+      signed_wchar_type_node = c_common_signed_type (wchar_type_node);
+      unsigned_wchar_type_node = c_common_unsigned_type (wchar_type_node);
     }
 
   /* This is for wide string constants.  */
@@ -2709,7 +2717,7 @@ c_common_nodes_and_builtins ()
   default_function_type = build_function_type (integer_type_node, NULL_TREE);
   ptrdiff_type_node
     = TREE_TYPE (identifier_global_value (get_identifier (PTRDIFF_TYPE)));
-  unsigned_ptrdiff_type_node = unsigned_type (ptrdiff_type_node);
+  unsigned_ptrdiff_type_node = c_common_unsigned_type (ptrdiff_type_node);
 
   (*lang_hooks.decls.pushdecl)
     (build_decl (TYPE_DECL, get_identifier ("__builtin_va_list"),
index 263b227..5dde85a 100644 (file)
@@ -510,6 +510,9 @@ extern void c_common_insert_default_attributes      PARAMS ((tree));
 extern tree c_common_type_for_mode             PARAMS ((enum machine_mode,
                                                         int));
 extern tree c_common_type_for_size             PARAMS ((unsigned int, int));
+extern tree c_common_unsigned_type             PARAMS ((tree));
+extern tree c_common_signed_type               PARAMS ((tree));
+extern tree c_common_signed_or_unsigned_type   PARAMS ((int, tree));
 extern void c_apply_type_quals_to_decl         PARAMS ((int, tree));
 extern tree c_sizeof                           PARAMS ((tree));
 extern tree c_alignof                          PARAMS ((tree));
index d7e70a4..773beda 100644 (file)
@@ -4160,7 +4160,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
       else if (type == char_type_node)
        type = unsigned_char_type_node;
       else if (typedef_decl)
-       type = unsigned_type (type);
+       type = c_common_unsigned_type (type);
       else
        type = unsigned_type_node;
     }
@@ -4370,7 +4370,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
          tree itype = NULL_TREE;
          tree size = TREE_OPERAND (declarator, 1);
          /* The index is a signed object `sizetype' bits wide.  */
-         tree index_type = signed_type (sizetype);
+         tree index_type = c_common_signed_type (sizetype);
 
          array_ptr_quals = TREE_TYPE (declarator);
          array_parm_static = TREE_STATIC (declarator);
index d52cfba..c121167 100644 (file)
@@ -2386,8 +2386,8 @@ check_format_types (status, types)
          && TREE_CODE (cur_type) == INTEGER_TYPE
          && (! pedantic || i == 0 || (i == 1 && char_type_flag))
          && (TREE_UNSIGNED (wanted_type)
-             ? wanted_type == unsigned_type (cur_type)
-             : wanted_type == signed_type (cur_type)))
+             ? wanted_type == c_common_unsigned_type (cur_type)
+             : wanted_type == c_common_signed_type (cur_type)))
        continue;
       /* Likewise, "signed char", "unsigned char" and "char" are
         equivalent but the above test won't consider them equivalent.  */
index 3176358..735017b 100644 (file)
@@ -88,6 +88,12 @@ static void c_post_options PARAMS ((void));
 #define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode
 #undef LANG_HOOKS_TYPE_FOR_SIZE
 #define LANG_HOOKS_TYPE_FOR_SIZE c_common_type_for_size
+#undef LANG_HOOKS_SIGNED_TYPE
+#define LANG_HOOKS_SIGNED_TYPE c_common_signed_type
+#undef LANG_HOOKS_UNSIGNED_TYPE
+#define LANG_HOOKS_UNSIGNED_TYPE c_common_unsigned_type
+#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
+#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE c_common_signed_or_unsigned_type
 
 /* ### When changing hooks, consider if ObjC needs changing too!! ### */
 
index a4ba657..2c7a89a 100644 (file)
@@ -2385,22 +2385,24 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
              && unsigned0 == unsigned1
              && (unsigned0 || !uns))
            result_type
-             = signed_or_unsigned_type (unsigned0,
-                                        common_type (TREE_TYPE (arg0), TREE_TYPE (arg1)));
+             = c_common_signed_or_unsigned_type
+             (unsigned0, common_type (TREE_TYPE (arg0), TREE_TYPE (arg1)));
          else if (TREE_CODE (arg0) == INTEGER_CST
                   && (unsigned1 || !uns)
                   && (TYPE_PRECISION (TREE_TYPE (arg1))
                       < TYPE_PRECISION (result_type))
-                  && (type = signed_or_unsigned_type (unsigned1,
-                                                      TREE_TYPE (arg1)),
+                  && (type
+                      = c_common_signed_or_unsigned_type (unsigned1,
+                                                          TREE_TYPE (arg1)),
                       int_fits_type_p (arg0, type)))
            result_type = type;
          else if (TREE_CODE (arg1) == INTEGER_CST
                   && (unsigned0 || !uns)
                   && (TYPE_PRECISION (TREE_TYPE (arg0))
                       < TYPE_PRECISION (result_type))
-                  && (type = signed_or_unsigned_type (unsigned0,
-                                                      TREE_TYPE (arg0)),
+                  && (type
+                      = c_common_signed_or_unsigned_type (unsigned0,
+                                                          TREE_TYPE (arg0)),
                       int_fits_type_p (arg1, type)))
            result_type = type;
        }
@@ -2426,7 +2428,8 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
            {
              /* Do an unsigned shift if the operand was zero-extended.  */
              result_type
-               = signed_or_unsigned_type (unsigned_arg, TREE_TYPE (arg0));
+               = c_common_signed_or_unsigned_type (unsigned_arg,
+                                                   TREE_TYPE (arg0));
              /* Convert value-to-be-shifted to that type.  */
              if (TREE_TYPE (op0) != result_type)
                op0 = convert (result_type, op0);
@@ -2504,15 +2507,17 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
                     would fit in the result if the result were signed.  */
                  else if (TREE_CODE (uop) == INTEGER_CST
                           && (resultcode == EQ_EXPR || resultcode == NE_EXPR)
-                          && int_fits_type_p (uop, signed_type (result_type)))
+                          && int_fits_type_p
+                          (uop, c_common_signed_type (result_type)))
                    /* OK */;
                  /* Do not warn if the unsigned quantity is an enumeration
                     constant and its maximum value would fit in the result
                     if the result were signed.  */
                  else if (TREE_CODE (uop) == INTEGER_CST
                           && TREE_CODE (TREE_TYPE (uop)) == ENUMERAL_TYPE
-                          && int_fits_type_p (TYPE_MAX_VALUE (TREE_TYPE(uop)),
-                                              signed_type (result_type)))
+                          && int_fits_type_p
+                          (TYPE_MAX_VALUE (TREE_TYPE(uop)),
+                           c_common_signed_type (result_type)))
                    /* OK */;
                  else
                    warning ("comparison between signed and unsigned");
@@ -4161,8 +4166,8 @@ convert_for_assignment (type, rhs, errtype, fundecl, funname, parmnum)
         Meanwhile, the lhs target must have all the qualifiers of the rhs.  */
       if (VOID_TYPE_P (ttl) || VOID_TYPE_P (ttr)
          || comp_target_types (type, rhstype)
-         || (unsigned_type (TYPE_MAIN_VARIANT (ttl))
-             == unsigned_type (TYPE_MAIN_VARIANT (ttr))))
+         || (c_common_unsigned_type (TYPE_MAIN_VARIANT (ttl))
+             == c_common_unsigned_type (TYPE_MAIN_VARIANT (ttr))))
        {
          if (pedantic
              && ((VOID_TYPE_P (ttl) && TREE_CODE (ttr) == FUNCTION_TYPE)
index 25aae57..970b05c 100644 (file)
@@ -316,10 +316,12 @@ convert_to_integer (type, expr)
                       unsigned then can safely do the work as unsigned.
                       And we may need to do it as unsigned
                       if we truncate to the original size.  */
-                   typex = ((TREE_UNSIGNED (TREE_TYPE (expr))
-                             || (TREE_UNSIGNED (TREE_TYPE (arg0))
-                                 && TREE_UNSIGNED (TREE_TYPE (arg1))))
-                            ? unsigned_type (typex) : signed_type (typex));
+                   if (TREE_UNSIGNED (TREE_TYPE (expr))
+                       || (TREE_UNSIGNED (TREE_TYPE (arg0))
+                           && TREE_UNSIGNED (TREE_TYPE (arg1))))
+                     typex = (*lang_hooks.types.unsigned_type) (typex);
+                   else
+                     typex = (*lang_hooks.types.signed_type) (typex);
                    return convert (type,
                                    fold (build (ex_form, typex,
                                                 convert (typex, arg0),
@@ -350,8 +352,10 @@ convert_to_integer (type, expr)
              {
                /* Don't do unsigned arithmetic where signed was wanted,
                   or vice versa.  */
-               typex = (TREE_UNSIGNED (TREE_TYPE (expr))
-                        ? unsigned_type (typex) : signed_type (typex));
+               if (TREE_UNSIGNED (TREE_TYPE (expr)))
+                 typex = (*lang_hooks.types.unsigned_type) (typex);
+               else
+                 typex = (*lang_hooks.types.signed_type) (typex);
                return convert (type,
                                fold (build1 (ex_form, typex,
                                              convert (typex,
index 3f81db3..024176e 100644 (file)
@@ -1,3 +1,11 @@
+2002-04-01  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       * cp-lang.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE,
+       LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New.
+       * decl.c (grokdeclarator): Update.
+       * mangle.c (write_integer_cst): Update.
+       * typeck.c (build_binary_op): Update.
+
 2002-03-31  Neil Booth  <neil@daikokuya.demon.co.uk>
 
        * cp-lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Redefine.
index 28d3add..b330fd1 100644 (file)
@@ -119,6 +119,12 @@ static bool ok_to_generate_alias_set_for_type PARAMS ((tree));
 #define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode
 #undef LANG_HOOKS_TYPE_FOR_SIZE
 #define LANG_HOOKS_TYPE_FOR_SIZE c_common_type_for_size
+#undef LANG_HOOKS_SIGNED_TYPE
+#define LANG_HOOKS_SIGNED_TYPE c_common_signed_type
+#undef LANG_HOOKS_UNSIGNED_TYPE
+#define LANG_HOOKS_UNSIGNED_TYPE c_common_unsigned_type
+#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
+#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE c_common_signed_or_unsigned_type
 
 /* Each front end provides its own hooks, for toplev.c.  */
 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
index 8ba011e..e708a6d 100644 (file)
@@ -10325,7 +10325,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
       else if (type == char_type_node)
        type = unsigned_char_type_node;
       else if (typedef_decl)
-       type = unsigned_type (type);
+       type = c_common_unsigned_type (type);
       else
        type = unsigned_type_node;
     }
index 1a1c995..88461e2 100644 (file)
@@ -1111,7 +1111,7 @@ write_integer_cst (cst)
          chunk *= chunk;
        }
       
-      type = signed_or_unsigned_type (1, TREE_TYPE (cst));
+      type = c_common_signed_or_unsigned_type (1, TREE_TYPE (cst));
       base = build_int_2 (chunk, 0);
       n = build_int_2 (TREE_INT_CST_LOW (cst), TREE_INT_CST_HIGH (cst));
       TREE_TYPE (n) = TREE_TYPE (base) = type;
index 1a575f2..a68f4a2 100644 (file)
@@ -3782,24 +3782,22 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
                  == TYPE_PRECISION (TREE_TYPE (arg0)))
              && unsigned0 == unsigned1
              && (unsigned0 || !uns))
-           result_type
-             = signed_or_unsigned_type (unsigned0,
-                                        common_type (TREE_TYPE (arg0),
-                                                     TREE_TYPE (arg1)));
+           result_type = c_common_signed_or_unsigned_type
+             (unsigned0, common_type (TREE_TYPE (arg0), TREE_TYPE (arg1)));
          else if (TREE_CODE (arg0) == INTEGER_CST
                   && (unsigned1 || !uns)
                   && (TYPE_PRECISION (TREE_TYPE (arg1))
                       < TYPE_PRECISION (result_type))
-                  && (type = signed_or_unsigned_type (unsigned1,
-                                                      TREE_TYPE (arg1)),
+                  && (type = c_common_signed_or_unsigned_type
+                      (unsigned1, TREE_TYPE (arg1)),
                       int_fits_type_p (arg0, type)))
            result_type = type;
          else if (TREE_CODE (arg1) == INTEGER_CST
                   && (unsigned0 || !uns)
                   && (TYPE_PRECISION (TREE_TYPE (arg0))
                       < TYPE_PRECISION (result_type))
-                  && (type = signed_or_unsigned_type (unsigned0,
-                                                      TREE_TYPE (arg0)),
+                  && (type = c_common_signed_or_unsigned_type
+                      (unsigned0, TREE_TYPE (arg0)),
                       int_fits_type_p (arg1, type)))
            result_type = type;
        }
@@ -3834,8 +3832,8 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
            {
              /* Do an unsigned shift if the operand was zero-extended.  */
              result_type
-               = signed_or_unsigned_type (unsigned_arg,
-                                          TREE_TYPE (arg0));
+               = c_common_signed_or_unsigned_type (unsigned_arg,
+                                                   TREE_TYPE (arg0));
              /* Convert value-to-be-shifted to that type.  */
              if (TREE_TYPE (op0) != result_type)
                op0 = cp_convert (result_type, op0);
@@ -3908,11 +3906,11 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
             not use the most significant bit of result_type.  */
          else if ((resultcode == EQ_EXPR || resultcode == NE_EXPR)
                   && ((op0_signed && TREE_CODE (orig_op1) == INTEGER_CST
-                       && int_fits_type_p (orig_op1,
-                                           signed_type (result_type)))
+                       && int_fits_type_p (orig_op1, c_common_signed_type
+                                           (result_type)))
                        || (op1_signed && TREE_CODE (orig_op0) == INTEGER_CST
-                           && int_fits_type_p (orig_op0,
-                                               signed_type (result_type)))))
+                           && int_fits_type_p (orig_op0, c_common_signed_type
+                                               (result_type)))))
            /* OK */;
          else
            warning ("comparison between signed and unsigned integer expressions");
index cdc403f..76b90fa 100644 (file)
@@ -4108,21 +4108,22 @@ make_tree (type, x)
                          make_tree (type, XEXP (x, 1))));
 
     case LSHIFTRT:
+      t = (*lang_hooks.types.unsigned_type) (type);
       return fold (convert (type,
-                           build (RSHIFT_EXPR, unsigned_type (type),
-                                  make_tree (unsigned_type (type),
-                                             XEXP (x, 0)),
+                           build (RSHIFT_EXPR, t,
+                                  make_tree (t, XEXP (x, 0)),
                                   make_tree (type, XEXP (x, 1)))));
 
     case ASHIFTRT:
+      t = (*lang_hooks.types.signed_type) (type);
       return fold (convert (type,
-                           build (RSHIFT_EXPR, signed_type (type),
-                                  make_tree (signed_type (type), XEXP (x, 0)),
+                           build (RSHIFT_EXPR, t,
+                                  make_tree (t, XEXP (x, 0)),
                                   make_tree (type, XEXP (x, 1)))));
 
     case DIV:
       if (TREE_CODE (type) != REAL_TYPE)
-       t = signed_type (type);
+       t = (*lang_hooks.types.signed_type) (type);
       else
        t = type;
 
@@ -4131,7 +4132,7 @@ make_tree (type, x)
                                   make_tree (t, XEXP (x, 0)),
                                   make_tree (t, XEXP (x, 1)))));
     case UDIV:
-      t = unsigned_type (type);
+      t = (*lang_hooks.types.unsigned_type) (type);
       return fold (convert (type,
                            build (TRUNC_DIV_EXPR, t,
                                   make_tree (t, XEXP (x, 0)),
index ea78b2c..cbbcff1 100644 (file)
@@ -4021,11 +4021,9 @@ store_expr (exp, target, want_value)
        {
          if (TREE_UNSIGNED (TREE_TYPE (exp))
              != SUBREG_PROMOTED_UNSIGNED_P (target))
-           exp
-             = convert
-               (signed_or_unsigned_type (SUBREG_PROMOTED_UNSIGNED_P (target),
-                                         TREE_TYPE (exp)),
-                exp);
+           exp = convert
+             ((*lang_hooks.types.signed_or_unsigned_type)
+              (SUBREG_PROMOTED_UNSIGNED_P (target), TREE_TYPE (exp)), exp);
 
          exp = convert ((*lang_hooks.types.type_for_mode)
                         (GET_MODE (SUBREG_REG (target)),
index 9719baa..2f0318c 100644 (file)
@@ -1,3 +1,9 @@
+Mon Apr  1 09:59:53 2002  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       * com.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE,
+       LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New.
+       (unsigned_type, signed_type, signed_or_unsigned_type): Rename.
+
 Sun Mar 31 23:50:22 2002  Neil Booth  <neil@daikokuya.demon.co.uk>
 
        * com.c (lang_print_error_function): Rename.
index d51fad3..fed208c 100644 (file)
@@ -263,6 +263,9 @@ struct _ffecom_concat_list_
 
 static tree ffe_type_for_mode PARAMS ((enum machine_mode, int));
 static tree ffe_type_for_size PARAMS ((unsigned int, int));
+static tree ffe_unsigned_type PARAMS ((tree));
+static tree ffe_signed_type PARAMS ((tree));
+static tree ffe_signed_or_unsigned_type PARAMS ((int, tree));
 static void ffecom_init_decl_processing PARAMS ((void));
 static tree ffecom_arglist_expr_ (const char *argstring, ffebld args);
 static tree ffecom_widest_expr_type_ (ffebld list);
@@ -14230,10 +14233,17 @@ static void ffe_mark_tree (tree);
 #define LANG_HOOKS_DECL_PRINTABLE_NAME ffe_printable_name
 #undef  LANG_HOOKS_PRINT_ERROR_FUNCTION
 #define LANG_HOOKS_PRINT_ERROR_FUNCTION ffe_print_error_function
+
 #undef  LANG_HOOKS_TYPE_FOR_MODE
 #define LANG_HOOKS_TYPE_FOR_MODE       ffe_type_for_mode
 #undef  LANG_HOOKS_TYPE_FOR_SIZE
 #define LANG_HOOKS_TYPE_FOR_SIZE       ffe_type_for_size
+#undef  LANG_HOOKS_SIGNED_TYPE
+#define LANG_HOOKS_SIGNED_TYPE         ffe_signed_type
+#undef  LANG_HOOKS_UNSIGNED_TYPE
+#define LANG_HOOKS_UNSIGNED_TYPE       ffe_unsigned_type
+#undef  LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
+#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE ffe_signed_or_unsigned_type
 
 /* We do not wish to use alias-set based aliasing at all.  Used in the
    extreme (every object with its own set, with equivalences recorded) it
@@ -14745,8 +14755,8 @@ set_block (block)
                                           BLOCK_SUBBLOCKS (block));
 }
 
-tree
-signed_or_unsigned_type (unsignedp, type)
+static tree
+ffe_signed_or_unsigned_type (unsignedp, type)
      int unsignedp;
      tree type;
 {
@@ -14773,8 +14783,8 @@ signed_or_unsigned_type (unsignedp, type)
   return type2;
 }
 
-tree
-signed_type (type)
+static tree
+ffe_signed_type (type)
      tree type;
 {
   tree type1 = TYPE_MAIN_VARIANT (type);
@@ -15093,8 +15103,8 @@ ffe_type_for_size (bits, unsignedp)
   return 0;
 }
 
-tree
-unsigned_type (type)
+static tree
+ffe_unsigned_type (type)
      tree type;
 {
   tree type1 = TYPE_MAIN_VARIANT (type);
index 875ade3..26bdd66 100644 (file)
@@ -1937,9 +1937,8 @@ operand_equal_for_comparison_p (arg0, arg1, other)
 
       /* Make sure shorter operand is extended the right way
         to match the longer operand.  */
-      primarg1 = convert (signed_or_unsigned_type (unsignedp1,
-                                                  TREE_TYPE (primarg1)),
-                         primarg1);
+      primarg1 = convert ((*lang_hooks.types.signed_or_unsigned_type)
+                         (unsignedp1, TREE_TYPE (primarg1)), primarg1);
 
       if (operand_equal_p (arg0, convert (type, primarg1), 0))
        return 1;
@@ -2622,7 +2621,7 @@ all_ones_mask_p (mask, size)
   tree tmask;
 
   tmask = build_int_2 (~0, ~0);
-  TREE_TYPE (tmask) = signed_type (type);
+  TREE_TYPE (tmask) = (*lang_hooks.types.signed_type) (type);
   force_fit_type (tmask, 0);
   return
     tree_int_cst_equal (mask,
@@ -3063,7 +3062,7 @@ build_range_check (type, exp, in_p, low, high)
 
   else if (integer_zerop (low))
     {
-      utype = unsigned_type (etype);
+      utype = (*lang_hooks.types.unsigned_type) (etype);
       return build_range_check (type, convert (utype, exp), 1, 0,
                                convert (utype, high));
     }
@@ -3316,7 +3315,7 @@ unextend (c, p, unsignedp, mask)
      zero or one, and the conversion to a signed type can never overflow.
      We could get an overflow if this conversion is done anywhere else.  */
   if (TREE_UNSIGNED (type))
-    temp = convert (signed_type (type), temp);
+    temp = convert ((*lang_hooks.types.signed_type) (type), temp);
 
   temp = const_binop (LSHIFT_EXPR, temp, size_int (modesize - 1), 0);
   temp = const_binop (RSHIFT_EXPR, temp, size_int (modesize - p - 1), 0);
@@ -5939,7 +5938,7 @@ fold (expr)
              || TREE_CODE (arg0) == ROUND_MOD_EXPR)
          && integer_pow2p (TREE_OPERAND (arg0, 1)))
        {
-         tree newtype = unsigned_type (TREE_TYPE (arg0));
+         tree newtype = (*lang_hooks.types.unsigned_type) (TREE_TYPE (arg0));
          tree newmod = build (TREE_CODE (arg0), newtype,
                               convert (newtype, TREE_OPERAND (arg0, 0)),
                               convert (newtype, TREE_OPERAND (arg0, 1)));
@@ -6114,25 +6113,18 @@ fold (expr)
                     && TREE_UNSIGNED (TREE_TYPE (arg1))
                     /* signed_type does not work on pointer types.  */
                     && INTEGRAL_TYPE_P (TREE_TYPE (arg1)))
-             switch (TREE_CODE (t))
-               {
-               case LE_EXPR:
-                 return fold (build (GE_EXPR, type,
-                                     convert (signed_type (TREE_TYPE (arg0)),
-                                              arg0),
-                                     convert (signed_type (TREE_TYPE (arg1)),
-                                              integer_zero_node)));
-               case GT_EXPR:
-                 return fold (build (LT_EXPR, type,
-                                     convert (signed_type (TREE_TYPE (arg0)),
-                                              arg0),
-                                     convert (signed_type (TREE_TYPE (arg1)),
-                                              integer_zero_node)));
-
-               default:
-                 break;
-               }
-
+             {
+               if (TREE_CODE (t) == LE_EXPR || TREE_CODE (t) == GT_EXPR)
+                 {
+                   tree st0, st1;
+                   st0 = (*lang_hooks.types.signed_type) (TREE_TYPE (arg0));
+                   st1 = (*lang_hooks.types.signed_type) (TREE_TYPE (arg1));
+                   return fold
+                     (build (TREE_CODE (t) == LE_EXPR ? GE_EXPR: LT_EXPR,
+                             type, convert (st0, arg0),
+                             convert (st1, integer_zero_node)));
+                 }
+             }
             else if (TREE_INT_CST_HIGH (arg1) == 0
                     && (TREE_INT_CST_LOW (arg1)
                         == ((unsigned HOST_WIDE_INT) 2 << (width - 1)) - 1)
@@ -6506,14 +6498,16 @@ fold (expr)
              case GE_EXPR:
              case GT_EXPR:
                if (TREE_UNSIGNED (TREE_TYPE (arg1)))
-                 arg1 = convert (signed_type (TREE_TYPE (arg1)), arg1);
+                 arg1 = convert ((*lang_hooks.types.signed_type)
+                                 (TREE_TYPE (arg1)), arg1);
                return pedantic_non_lvalue
                  (convert (type, fold (build1 (ABS_EXPR,
                                                TREE_TYPE (arg1), arg1))));
              case LE_EXPR:
              case LT_EXPR:
                if (TREE_UNSIGNED (TREE_TYPE (arg1)))
-                 arg1 = convert (signed_type (TREE_TYPE (arg1)), arg1);
+                 arg1 = convert ((lang_hooks.types.signed_type)
+                                 (TREE_TYPE (arg1)), arg1);
                return pedantic_non_lvalue
                  (negate_expr (convert (type,
                                         fold (build1 (ABS_EXPR,
index a7776f1..269bdc2 100644 (file)
@@ -1,3 +1,14 @@
+2002-04-01  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       * expr.c (build_java_binop): Update.
+       * java-tree.h (java_signed_type, java_unsigned_type,
+       java_signed_or_unsigned_type): Update.
+       * lang.c (LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE,
+       LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): New.
+       * parse.y (patch_binop): Update.
+       * typeck.c (signed_or_unsigned_type, unsigned_type,
+       signed_type): Update.
+
 2002-03-31  Neil Booth  <neil@daikokuya.demon.co.uk>
 
        * lang.c (LANG_HOOKS_PRINT_ERROR_FUNCTION): Redefine.
index 895c322..a4ecfb0 100644 (file)
@@ -1395,7 +1395,7 @@ build_java_binop (op, type, arg1, arg2)
     {
     case URSHIFT_EXPR:
       {
-       tree u_type = unsigned_type (type);
+       tree u_type = java_unsigned_type (type);
        arg1 = convert (u_type, arg1);
        arg1 = build_java_binop (RSHIFT_EXPR, u_type, arg1, arg2);
        return convert (type, arg1);
index 3f47430..4a55281 100644 (file)
@@ -1041,6 +1041,9 @@ extern void java_parse_file PARAMS ((void));
 extern void java_mark_tree PARAMS ((tree));
 extern tree java_type_for_mode PARAMS ((enum machine_mode, int));
 extern tree java_type_for_size PARAMS ((unsigned int, int));
+extern tree java_unsigned_type PARAMS ((tree));
+extern tree java_signed_type PARAMS ((tree));
+extern tree java_signed_or_unsigned_type PARAMS ((int, tree));
 extern void add_assume_compiled PARAMS ((const char *, int));
 extern tree lookup_class PARAMS ((tree));
 extern tree lookup_java_constructor PARAMS ((tree, tree));
index b56eea4..05b5ced 100644 (file)
@@ -237,10 +237,17 @@ static int dependency_tracking = 0;
 #define LANG_HOOKS_DECL_PRINTABLE_NAME lang_printable_name
 #undef LANG_HOOKS_PRINT_ERROR_FUNCTION
 #define LANG_HOOKS_PRINT_ERROR_FUNCTION        java_print_error_function
+
 #undef LANG_HOOKS_TYPE_FOR_MODE
 #define LANG_HOOKS_TYPE_FOR_MODE java_type_for_mode
 #undef LANG_HOOKS_TYPE_FOR_SIZE
 #define LANG_HOOKS_TYPE_FOR_SIZE java_type_for_size
+#undef LANG_HOOKS_SIGNED_TYPE
+#define LANG_HOOKS_SIGNED_TYPE java_signed_type
+#undef LANG_HOOKS_UNSIGNED_TYPE
+#define LANG_HOOKS_UNSIGNED_TYPE java_unsigned_type
+#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
+#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE java_signed_or_unsigned_type
 
 /* Each front end provides its own.  */
 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
index ef18d5f..436cdf0 100644 (file)
@@ -13402,7 +13402,7 @@ patch_binop (node, wfl_op1, wfl_op2)
       if (code == URSHIFT_EXPR && ! flag_emit_class_files)
        {
          tree to_return;
-          tree utype = unsigned_type (prom_type);
+          tree utype = java_unsigned_type (prom_type);
           op1 = convert (utype, op1);
          TREE_SET_CODE (node, RSHIFT_EXPR);
           TREE_OPERAND (node, 0) = op1;
index 88f3fb9..5afa5a4 100644 (file)
@@ -226,7 +226,7 @@ java_type_for_size (bits, unsignedp)
    signed according to UNSIGNEDP.  */
 
 tree
-signed_or_unsigned_type (unsignedp, type)
+java_signed_or_unsigned_type (unsignedp, type)
      int unsignedp;
      tree type;
 {
@@ -246,20 +246,19 @@ signed_or_unsigned_type (unsignedp, type)
 /* Return a signed type the same as TYPE in other respects.  */
 
 tree
-signed_type (type)
+java_signed_type (type)
      tree type;
 {
-  return signed_or_unsigned_type (0, type);
+  return java_signed_or_unsigned_type (0, type);
 }
 
 /* Return an unsigned type the same as TYPE in other respects.  */
 
 tree
-unsigned_type (type)
+java_unsigned_type (type)
      tree type;
 {
-  return signed_or_unsigned_type (1, type);
-
+  return java_signed_or_unsigned_type (1, type);
 }
 
 /* Mark EXP saying that we need to be able to take the
index 49f80c0..8e3ac96 100644 (file)
@@ -160,7 +160,10 @@ int lhd_tree_dump_type_quals                       PARAMS ((tree));
 #define LANG_HOOKS_FOR_TYPES_INITIALIZER { \
   LANG_HOOKS_MAKE_TYPE, \
   LANG_HOOKS_TYPE_FOR_MODE, \
-  LANG_HOOKS_TYPE_FOR_SIZE \
+  LANG_HOOKS_TYPE_FOR_SIZE, \
+  LANG_HOOKS_UNSIGNED_TYPE, \
+  LANG_HOOKS_SIGNED_TYPE, \
+  LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE \
 }
 
 /* Declaration hooks.  */
index 8a0f4b5..c3e5a39 100644 (file)
@@ -84,6 +84,18 @@ struct lang_hooks_for_types
   /* Given PRECISION and UNSIGNEDP, return a suitable type-tree for an
      integer type with at least that precision.  */
   tree (*type_for_size) PARAMS ((unsigned, int));
+
+  /* Given an integer type T, return a type like T but unsigned.
+     If T is unsigned, the value is T.  */
+  tree (*unsigned_type) PARAMS ((tree));
+
+  /* Given an integer type T, return a type like T but signed.
+     If T is signed, the value is T.  */
+  tree (*signed_type) PARAMS ((tree));
+
+  /* Return a type the same as TYPE except unsigned or signed
+     according to UNSIGNEDP.  */
+  tree (*signed_or_unsigned_type) PARAMS ((int, tree));
 };
 
 /* Language hooks related to decls and the symbol table.  */
index b493cfc..322a66e 100644 (file)
@@ -84,6 +84,12 @@ static void objc_post_options                   PARAMS ((void));
 #define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode
 #undef LANG_HOOKS_TYPE_FOR_SIZE
 #define LANG_HOOKS_TYPE_FOR_SIZE c_common_type_for_size
+#undef LANG_HOOKS_SIGNED_TYPE
+#define LANG_HOOKS_SIGNED_TYPE c_common_signed_type
+#undef LANG_HOOKS_UNSIGNED_TYPE
+#define LANG_HOOKS_UNSIGNED_TYPE c_common_unsigned_type
+#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
+#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE c_common_signed_or_unsigned_type
 
 /* Each front end provides its own hooks, for toplev.c.  */
 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
index e6f0377..8abda68 100644 (file)
@@ -2125,7 +2125,6 @@ extern tree make_signed_type              PARAMS ((int));
 extern tree make_unsigned_type         PARAMS ((int));
 extern void initialize_sizetypes       PARAMS ((void));
 extern void set_sizetype               PARAMS ((tree));
-extern tree signed_or_unsigned_type    PARAMS ((int, tree));
 extern void fixup_unsigned_type                PARAMS ((tree));
 extern tree build_pointer_type         PARAMS ((tree));
 extern tree build_reference_type       PARAMS ((tree));
@@ -2607,20 +2606,6 @@ extern tree get_unwidened                PARAMS ((tree, tree));
 
 extern tree get_narrower               PARAMS ((tree, int *));
 
-/* Given an integer type T, return a type like T but unsigned.
-   If T is unsigned, the value is T.
-   The definition of this resides in language-specific code
-   as the repertoire of available types may vary.  */
-
-extern tree unsigned_type              PARAMS ((tree));
-
-/* Given an integer type T, return a type like T but signed.
-   If T is signed, the value is T.
-   The definition of this resides in language-specific code
-   as the repertoire of available types may vary.  */
-
-extern tree signed_type                        PARAMS ((tree));
-
 /* Given an expression EXP that may be a COMPONENT_REF or an ARRAY_REF,
    look for nested component-refs or array-refs at constant positions
    and find the ultimate containing object, which is returned.  */