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]

clean up some hook routines


I noticed while doing some other bits that not all of the
functions in hooks.c use the same convention.  Moreover,
there are some functions in tree.c that don't do anything
and therefore should use hooks.c instead.


r~


        * hooks.c (hook_bool_void_false, hook_void_tree_int,
        hook_void_FILEptr_constcharptr): Rename so that the return
        type is first.
        (hook_int_tree_tree_1, hook_void_tree, hook_void_tree_treeptr,
        hook_bool_tree_false): New.
        * hooks.h: Update.
        * langhooks-def.h: Update for renames.
        * target-def.h: Likewise.
        * tree.c (default_comp_type_attributes,
        default_set_default_type_attributes, default_insert_attributes, 
        default_function_attribute_inlinable_p,
        default_ms_bitfield_layout_p): Remove.
        * tree.h: Update.

Index: hooks.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/hooks.c,v
retrieving revision 1.6
diff -c -p -d -r1.6 hooks.c
*** hooks.c	22 Oct 2002 23:05:12 -0000	1.6
--- hooks.c	27 Nov 2002 02:33:07 -0000
*************** hook_void_void ()
*** 34,55 ****
  
  /* Generic hook that takes no arguments and returns false.  */
  bool
! hook_void_bool_false ()
! {
!   return false;
! }
! 
! /* Generic hook that takes (tree) and returns false.  */
! bool
! hook_tree_bool_false (a)
!      tree a ATTRIBUTE_UNUSED;
  {
    return false;
  }
  
  /* Generic hook that takes (tree, int) and does nothing.  */
  void
! hook_tree_int_void (a, b)
       tree a ATTRIBUTE_UNUSED;
       int b ATTRIBUTE_UNUSED;
  {
--- 34,47 ----
  
  /* Generic hook that takes no arguments and returns false.  */
  bool
! hook_bool_void_false ()
  {
    return false;
  }
  
  /* Generic hook that takes (tree, int) and does nothing.  */
  void
! hook_void_tree_int (a, b)
       tree a ATTRIBUTE_UNUSED;
       int b ATTRIBUTE_UNUSED;
  {
*************** hook_tree_int_void (a, b)
*** 57,63 ****
  
  /* Generic hook that takes (FILE *, const char *) and does nothing.  */
  void
! hook_FILEptr_constcharptr_void (a, b)
       FILE *a ATTRIBUTE_UNUSED;
       const char *b ATTRIBUTE_UNUSED;
  {
--- 49,55 ----
  
  /* Generic hook that takes (FILE *, const char *) and does nothing.  */
  void
! hook_void_FILEptr_constcharptr (a, b)
       FILE *a ATTRIBUTE_UNUSED;
       const char *b ATTRIBUTE_UNUSED;
  {
*************** default_can_output_mi_thunk_no_vcall (a,
*** 92,95 ****
--- 84,116 ----
       tree d ATTRIBUTE_UNUSED;
  {
    return c == 0;
+ }
+ 
+ /* ??? Used for comp_type_attributes, which ought to return bool.  */
+ int
+ hook_int_tree_tree_1 (a, b)
+      tree a ATTRIBUTE_UNUSED;
+      tree b ATTRIBUTE_UNUSED;
+ {
+   return 1;
+ }
+ 
+ void
+ hook_void_tree (a)
+      tree a ATTRIBUTE_UNUSED;
+ {
+ }
+ 
+ void
+ hook_void_tree_treeptr (a, b)
+      tree a ATTRIBUTE_UNUSED;
+      tree *b ATTRIBUTE_UNUSED;
+ {
+ }
+ 
+ bool
+ hook_bool_tree_false (a)
+      tree a ATTRIBUTE_UNUSED;
+ {
+   return false;
  }
Index: hooks.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/hooks.h,v
retrieving revision 1.6
diff -c -p -d -r1.6 hooks.h
*** hooks.h	22 Oct 2002 23:05:12 -0000	1.6
--- hooks.h	27 Nov 2002 02:33:07 -0000
*************** Foundation, 59 Temple Place - Suite 330,
*** 22,36 ****
  #ifndef GCC_HOOKS_H
  #define GCC_HOOKS_H
  
! bool hook_void_bool_false PARAMS ((void));
! bool hook_tree_bool_false PARAMS ((tree));
! void hook_tree_int_void PARAMS ((tree, int));
! void hook_void_void PARAMS ((void));
! void hook_FILEptr_constcharptr_void PARAMS ((FILE *, const char *));
  bool hook_bool_tree_hwi_hwi_tree_false
    PARAMS ((tree, HOST_WIDE_INT, HOST_WIDE_INT, tree));
  bool hook_bool_tree_hwi_hwi_tree_true
    PARAMS ((tree, HOST_WIDE_INT, HOST_WIDE_INT, tree));
  
  bool default_can_output_mi_thunk_no_vcall
    PARAMS ((tree, HOST_WIDE_INT, HOST_WIDE_INT, tree));
--- 22,41 ----
  #ifndef GCC_HOOKS_H
  #define GCC_HOOKS_H
  
! bool hook_bool_void_false PARAMS ((void));
! bool hook_bool_tree_false PARAMS ((tree));
  bool hook_bool_tree_hwi_hwi_tree_false
    PARAMS ((tree, HOST_WIDE_INT, HOST_WIDE_INT, tree));
  bool hook_bool_tree_hwi_hwi_tree_true
    PARAMS ((tree, HOST_WIDE_INT, HOST_WIDE_INT, tree));
+ 
+ void hook_void_tree_int PARAMS ((tree, int));
+ void hook_void_void PARAMS ((void));
+ void hook_void_FILEptr_constcharptr PARAMS ((FILE *, const char *));
+ void hook_void_tree PARAMS ((tree));
+ void hook_void_tree_treeptr PARAMS ((tree, tree *));
+ 
+ int hook_int_tree_tree_1 PARAMS ((tree, tree));
  
  bool default_can_output_mi_thunk_no_vcall
    PARAMS ((tree, HOST_WIDE_INT, HOST_WIDE_INT, tree));
Index: langhooks-def.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/langhooks-def.h,v
retrieving revision 1.38
diff -c -p -d -r1.38 langhooks-def.h
*** langhooks-def.h	23 Oct 2002 17:13:14 -0000	1.38
--- langhooks-def.h	27 Nov 2002 02:33:07 -0000
*************** tree lhd_tree_inlining_convert_parm_for_
*** 90,96 ****
  #define LANG_HOOKS_CLEAR_BINDING_STACK	lhd_clear_binding_stack
  #define LANG_HOOKS_INIT_OPTIONS		lhd_do_nothing
  #define LANG_HOOKS_DECODE_OPTION	lhd_decode_option
! #define LANG_HOOKS_POST_OPTIONS		hook_void_bool_false
  #define LANG_HOOKS_GET_ALIAS_SET	lhd_get_alias_set
  #define LANG_HOOKS_EXPAND_CONSTANT	lhd_return_tree
  #define LANG_HOOKS_EXPAND_EXPR		lhd_expand_expr
--- 90,96 ----
  #define LANG_HOOKS_CLEAR_BINDING_STACK	lhd_clear_binding_stack
  #define LANG_HOOKS_INIT_OPTIONS		lhd_do_nothing
  #define LANG_HOOKS_DECODE_OPTION	lhd_decode_option
! #define LANG_HOOKS_POST_OPTIONS		hook_bool_void_false
  #define LANG_HOOKS_GET_ALIAS_SET	lhd_get_alias_set
  #define LANG_HOOKS_EXPAND_CONSTANT	lhd_return_tree
  #define LANG_HOOKS_EXPAND_EXPR		lhd_expand_expr
*************** tree lhd_tree_inlining_convert_parm_for_
*** 141,147 ****
  #define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P \
    lhd_tree_inlining_anon_aggr_type_p
  #define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P \
!   hook_tree_bool_false
  #define LANG_HOOKS_TREE_INLINING_START_INLINING \
    lhd_tree_inlining_start_inlining
  #define LANG_HOOKS_TREE_INLINING_END_INLINING \
--- 141,147 ----
  #define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P \
    lhd_tree_inlining_anon_aggr_type_p
  #define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P \
!   hook_bool_tree_false
  #define LANG_HOOKS_TREE_INLINING_START_INLINING \
    lhd_tree_inlining_start_inlining
  #define LANG_HOOKS_TREE_INLINING_END_INLINING \
Index: target-def.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/target-def.h,v
retrieving revision 1.36
diff -c -p -d -r1.36 target-def.h
*** target-def.h	22 Oct 2002 23:05:12 -0000	1.36
--- target-def.h	27 Nov 2002 02:33:07 -0000
*************** Foundation, 59 Temple Place - Suite 330,
*** 221,231 ****
  #define TARGET_MERGE_DECL_ATTRIBUTES merge_decl_attributes
  #define TARGET_MERGE_TYPE_ATTRIBUTES merge_type_attributes
  #define TARGET_ATTRIBUTE_TABLE NULL
- #define TARGET_COMP_TYPE_ATTRIBUTES default_comp_type_attributes
- #define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES default_set_default_type_attributes
- #define TARGET_INSERT_ATTRIBUTES default_insert_attributes
- #define TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P default_function_attribute_inlinable_p
- #define TARGET_MS_BITFIELD_LAYOUT_P default_ms_bitfield_layout_p
  
  /* In builtins.c.  */
  #define TARGET_INIT_BUILTINS default_init_builtins
--- 221,226 ----
*************** Foundation, 59 Temple Place - Suite 330,
*** 245,258 ****
  #endif
  
  /* In hook.c.  */
! #define TARGET_CANNOT_MODIFY_JUMPS_P hook_void_bool_false
  
  #ifndef TARGET_IN_SMALL_DATA_P
! #define TARGET_IN_SMALL_DATA_P hook_tree_bool_false
  #endif
  
  #ifndef TARGET_ENCODE_SECTION_INFO
! #define TARGET_ENCODE_SECTION_INFO hook_tree_int_void
  #endif
  
  /* The whole shebang.  */
--- 240,258 ----
  #endif
  
  /* In hook.c.  */
! #define TARGET_CANNOT_MODIFY_JUMPS_P hook_bool_void_false
! #define TARGET_COMP_TYPE_ATTRIBUTES hook_int_tree_tree_1
! #define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES hook_void_tree
! #define TARGET_INSERT_ATTRIBUTES hook_void_tree_treeptr
! #define TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P hook_bool_tree_false
! #define TARGET_MS_BITFIELD_LAYOUT_P hook_bool_tree_false
  
  #ifndef TARGET_IN_SMALL_DATA_P
! #define TARGET_IN_SMALL_DATA_P hook_bool_tree_false
  #endif
  
  #ifndef TARGET_ENCODE_SECTION_INFO
! #define TARGET_ENCODE_SECTION_INFO hook_void_tree_int
  #endif
  
  /* The whole shebang.  */
Index: tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.279
diff -c -p -d -r1.279 tree.c
*** tree.c	14 Nov 2002 21:58:35 -0000	1.279
--- tree.c	27 Nov 2002 02:33:07 -0000
*************** build_type_attribute_variant (ttype, att
*** 2552,2604 ****
    return ttype;
  }
  
- /* Default value of targetm.comp_type_attributes that always returns 1.  */
- 
- int
- default_comp_type_attributes (type1, type2)
-      tree type1 ATTRIBUTE_UNUSED;
-      tree type2 ATTRIBUTE_UNUSED;
- {
-   return 1;
- }
- 
- /* Default version of targetm.set_default_type_attributes that always does
-    nothing.  */
- 
- void
- default_set_default_type_attributes (type)
-      tree type ATTRIBUTE_UNUSED;
- {
- }
- 
- /* Default version of targetm.insert_attributes that always does nothing.  */
- void
- default_insert_attributes (decl, attr_ptr)
-      tree decl ATTRIBUTE_UNUSED;
-      tree *attr_ptr ATTRIBUTE_UNUSED;
- {
- }
- 
- /* Default value of targetm.function_attribute_inlinable_p that always
-    returns false.  */
- bool
- default_function_attribute_inlinable_p (fndecl)
-      tree fndecl ATTRIBUTE_UNUSED;
- {
-   /* By default, functions with machine attributes cannot be inlined.  */
-   return false;
- }
- 
- /* Default value of targetm.ms_bitfield_layout_p that always returns
-    false.  */
- bool
- default_ms_bitfield_layout_p (record)
-      tree record ATTRIBUTE_UNUSED;
- {
-   /* By default, GCC does not use the MS VC++ bitfield layout rules.  */
-   return false;
- }
- 
  /* Return nonzero if IDENT is a valid name for attribute ATTR,
     or zero if not.
  
--- 2552,2557 ----


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