This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: patch for libf2c's use of gcc's internal headers. (part 2 of 3)
On Tue, May 09, 2000 at 10:53:11AM -0700, Chris G. Demetriou wrote:
> Have you already taken care of it, or would you like me to submit a
> new patch. ("should have" makes me think it's all been taken care
> of... BTW, i've still not heard back about my assignment forms...)
Wahooo. Assignments cleared today.
Yes, I've already taken care of the rearrangement.
> (1) some tree nodes declared in tree.h are:
>
> + initialized in tree.c:build_common_tree_nodes()
>
> + build_decl'd/push_decl'd in c-decl.c:init_decl_processing(),
> after the call to build_common_tree_nodes().
Except all of the nodes built in tree.h are used in all languages.
Well, not va_list, but it could be.
> Your suggestion that they go in c-common.[ch] (presumably,
> declarations in c-common.h, the initializations/build_decl/push_decl
> in c-common.c) seems inconsistent with existing practice.
I don't see that these are any different from the builtin
function declarations that are C specific. It's just that
previously we didn't have any C specific types.
Here's the patch I committed.
r~
* c-common.h (enum c_tree_index): Add g77 type entries.
(g77_integer_type_node, g77_uinteger_type_node): New.
(g77_longint_type_node, g77_ulongint_type_node): New.
* c-decl.c (init_decl_processing): Initialize them.
Index: c-common.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-common.h,v
retrieving revision 1.11
diff -c -p -d -r1.11 c-common.h
*** c-common.h 2000/03/08 11:21:26 1.11
--- c-common.h 2000/05/18 17:48:37
*************** enum c_tree_index
*** 45,51 ****
CTI_VOID_FTYPE_PTR,
CTI_INT_FTYPE_INT,
CTI_PTR_FTYPE_SIZETYPE,
!
CTI_MAX
};
--- 45,56 ----
CTI_VOID_FTYPE_PTR,
CTI_INT_FTYPE_INT,
CTI_PTR_FTYPE_SIZETYPE,
!
! CTI_G77_INTEGER_TYPE,
! CTI_G77_UINTEGER_TYPE,
! CTI_G77_LONGINT_TYPE,
! CTI_G77_ULONGINT_TYPE,
!
CTI_MAX
};
*************** extern tree c_global_trees[CTI_MAX];
*** 73,78 ****
--- 78,89 ----
#define void_ftype_ptr c_global_trees[CTI_VOID_FTYPE_PTR]
#define int_ftype_int c_global_trees[CTI_INT_FTYPE_INT]
#define ptr_ftype_sizetype c_global_trees[CTI_PTR_FTYPE_SIZETYPE]
+
+ /* g77 integer types, which which must be kept in sync with f/com.h */
+ #define g77_integer_type_node c_global_trees[CTI_G77_INTEGER_TYPE]
+ #define g77_uinteger_type_node c_global_trees[CTI_G77_UINTEGER_TYPE]
+ #define g77_longint_type_node c_global_trees[CTI_G77_LONGINT_TYPE]
+ #define g77_ulongint_type_node c_global_trees[CTI_G77_ULONGINT_TYPE]
/* Pointer to function to generate the VAR_DECL for __FUNCTION__ etc.
ID is the identifier to use, NAME is the string.
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-decl.c,v
retrieving revision 1.110
diff -c -p -d -r1.110 c-decl.c
*** c-decl.c 2000/05/17 08:15:25 1.110
--- c-decl.c 2000/05/18 17:48:37
*************** init_decl_processing ()
*** 3034,3039 ****
--- 3034,3088 ----
= build_function_type (ptr_type_node,
tree_cons (NULL_TREE, ptr_type_node, endlink));
+ /* Types which are common to the fortran compiler and libf2c. When
+ changing these, you also need to be concerned with f/com.h. */
+
+ if (TYPE_PRECISION (float_type_node)
+ == TYPE_PRECISION (long_integer_type_node))
+ {
+ g77_integer_type_node = long_integer_type_node;
+ g77_uinteger_type_node = long_unsigned_type_node;
+ }
+ else if (TYPE_PRECISION (float_type_node)
+ == TYPE_PRECISION (integer_type_node))
+ {
+ g77_integer_type_node = integer_type_node;
+ g77_uinteger_type_node = unsigned_type_node;
+ }
+ else
+ g77_integer_type_node = g77_uinteger_type_node = NULL_TREE;
+
+ if (g77_integer_type_node != NULL_TREE)
+ {
+ pushdecl (build_decl (TYPE_DECL, get_identifier ("__g77_integer"),
+ g77_integer_type_node));
+ pushdecl (build_decl (TYPE_DECL, get_identifier ("__g77_uinteger"),
+ g77_uinteger_type_node));
+ }
+
+ if (TYPE_PRECISION (float_type_node) * 2
+ == TYPE_PRECISION (long_integer_type_node))
+ {
+ g77_longint_type_node = long_integer_type_node;
+ g77_ulongint_type_node = long_unsigned_type_node;
+ }
+ else if (TYPE_PRECISION (float_type_node) * 2
+ == TYPE_PRECISION (long_long_integer_type_node))
+ {
+ g77_longint_type_node = long_long_integer_type_node;
+ g77_ulongint_type_node = long_long_unsigned_type_node;
+ }
+ else
+ g77_longint_type_node = g77_ulongint_type_node = NULL_TREE;
+
+ if (g77_longint_type_node != NULL_TREE)
+ {
+ pushdecl (build_decl (TYPE_DECL, get_identifier ("__g77_longint"),
+ g77_longint_type_node));
+ pushdecl (build_decl (TYPE_DECL, get_identifier ("__g77_ulongint"),
+ g77_ulongint_type_node));
+ }
+
builtin_function ("__builtin_aggregate_incoming_address",
build_function_type (ptr_type_node, NULL_TREE),
BUILT_IN_AGGREGATE_INCOMING_ADDRESS,