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]

Fix m32r compile time warnings


Hi Guys,

  Whilst working on tracking down a bug in the m32r toolchain I
  decided that it was time to eliminate the compile time warnings that
  are generated when gcc/config/m32r/m32r.c is built, and I am
  applying the patch below to do this.

  The toolchain still fails to build entirely.  There is an internal
  error in simplify-rtx when building libstdc++-v3 but I will leave
  investigating that for another day.

Cheers
        Nick

2001-06-11  Nick Clifton  <nickc@cambridge.redhat.com>

	* config/m32r/m32r.md (movstrsi_internal): Do not expect a
	return string from m32r_output_block_move.
        * config/m32r/m32r-protos.h: Make m32r_output_block_move a
	void function.
        * config/m32r/m32r.h (INT32_P): Rename to UNIT32_P and remove
	integer overflow.
        (ROUND_ADVANCE): Remove signed/unsigned conflict.
        * config/m32r/m32r.c: Declare prototypes for static functions.
        (move_src_operand): Replace INT32_P with UINT32_P.
        (function_arg_partial_nregs): Fixed signed/unsigned conflict
	in initialisation of 'size'.
        (m32r_sched_reord): Remove redundant declarations of 'code'.
        (m32r_output_block_move): Change to a void function.
        (m32r_encode_section_info): Cast return of
	TREE_STRING_POINTER to avoid compile time warning.

Index: config/m32r/m32r.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r.md,v
retrieving revision 1.18
diff -p -r1.18 m32r.md
*** m32r.md	1999/11/09 15:07:07	1.18
--- m32r.md	2001/06/11 16:46:54
***************
*** 1,5 ****
  ;; Machine description of the Mitsubishi M32R cpu for GNU C compiler
! ;; Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
  
  ;; This file is part of GNU CC.
  
--- 1,5 ----
  ;; Machine description of the Mitsubishi M32R cpu for GNU C compiler
! ;; Copyright (C) 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
  
  ;; This file is part of GNU CC.
  
***************
*** 2498,2503 ****
     (clobber (match_scratch:SI 3 "=&r"))				;; temp 1
     (clobber (match_scratch:SI 4 "=&r"))]			;; temp 2
    ""
!   "* return m32r_output_block_move (insn, operands);"
    [(set_attr "type"	"store8")
     (set_attr "length"	"72")]) ;; Maximum
--- 2498,2503 ----
     (clobber (match_scratch:SI 3 "=&r"))				;; temp 1
     (clobber (match_scratch:SI 4 "=&r"))]			;; temp 2
    ""
!   "* m32r_output_block_move (insn, operands); return \"\"; "
    [(set_attr "type"	"store8")
     (set_attr "length"	"72")]) ;; Maximum

Index: config/m32r/m32r-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r-protos.h,v
retrieving revision 1.2
diff -p -r1.2 m32r-protos.h
*** m32r-protos.h	2000/01/18 23:44:36	1.2
--- m32r-protos.h	2001/06/11 16:46:52
***************
*** 1,5 ****
  /* Prototypes for m32r.c functions used in the md file & elsewhere.
!    Copyright (C) 1999, 2000 Free Software Foundation, Inc.
  
  This file is part of GNU CC.
  
--- 1,5 ----
  /* Prototypes for m32r.c functions used in the md file & elsewhere.
!    Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
  
  This file is part of GNU CC.
  
*************** extern int    m32r_address_code			PARAMS
*** 60,66 ****
  extern void   m32r_initialize_trampoline	PARAMS ((rtx, rtx, rtx));
  extern int    zero_and_one			PARAMS ((rtx, rtx));
  extern char * emit_cond_move			PARAMS ((rtx *, rtx));
! extern char * m32r_output_block_move 		PARAMS ((rtx, rtx *));
  extern void   m32r_expand_block_move 		PARAMS ((rtx *));
  extern void   m32r_print_operand		PARAMS ((FILE *, rtx, int));
  extern void   m32r_print_operand_address	PARAMS ((FILE *, rtx));
--- 60,66 ----
  extern void   m32r_initialize_trampoline	PARAMS ((rtx, rtx, rtx));
  extern int    zero_and_one			PARAMS ((rtx, rtx));
  extern char * emit_cond_move			PARAMS ((rtx *, rtx));
! extern void   m32r_output_block_move 		PARAMS ((rtx, rtx *));
  extern void   m32r_expand_block_move 		PARAMS ((rtx *));
  extern void   m32r_print_operand		PARAMS ((FILE *, rtx, int));
  extern void   m32r_print_operand_address	PARAMS ((FILE *, rtx));

Index: config/m32r/m32r.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r.h,v
retrieving revision 1.37
diff -p -r1.37 m32r.h
*** m32r.h	2001/01/24 12:47:45	1.37
--- m32r.h	2001/06/11 16:46:58
*************** extern enum reg_class m32r_regno_reg_cla
*** 753,767 ****
  #define INT8_P(X) ((X) >= -0x80 && (X) <= 0x7f)
  #define INT16_P(X) ((X) >= -0x8000 && (X) <= 0x7fff)
  #define CMP_INT16_P(X) ((X) >= -0x7fff && (X) <= 0x8000)
- #define UINT16_P(X) (((unsigned HOST_WIDE_INT)(X)) <= 0xffff)
  #define UPPER16_P(X) (((X) & 0xffff) == 0				\
  		      && ((X) >> 16) >= -0x8000				\
  		      && ((X) >> 16) <= 0x7fff)
! #define UINT24_P(X) (((unsigned HOST_WIDE_INT) (X)) < 0x1000000)
! #define INT32_P(X) (((X) >= -(HOST_WIDE_INT) 0x80000000			\
! 		     && (X) <= (HOST_WIDE_INT) 0x7fffffff)		\
! 		    || (unsigned HOST_WIDE_INT) (X) <= 0xffffffff)
! #define UINT5_P(X) ((X) >= 0 && (X) < 32)
  #define INVERTED_SIGNED_8BIT(VAL) ((VAL) >= -127 && (VAL) <= 128)
  
  #define CONST_OK_FOR_LETTER_P(VALUE, C)					\
--- 753,765 ----
  #define INT8_P(X) ((X) >= -0x80 && (X) <= 0x7f)
  #define INT16_P(X) ((X) >= -0x8000 && (X) <= 0x7fff)
  #define CMP_INT16_P(X) ((X) >= -0x7fff && (X) <= 0x8000)
  #define UPPER16_P(X) (((X) & 0xffff) == 0				\
  		      && ((X) >> 16) >= -0x8000				\
  		      && ((X) >> 16) <= 0x7fff)
! #define UINT16_P(X) (((unsigned HOST_WIDE_INT) (X)) <= 0x0000ffff)
! #define UINT24_P(X) (((unsigned HOST_WIDE_INT) (X)) <= 0x00ffffff)
! #define UINT32_P(X) (((unsigned HOST_WIDE_INT) (X)) <= 0xffffffff)
! #define UINT5_P(X)  ((X) >= 0 && (X) < 32)
  #define INVERTED_SIGNED_8BIT(VAL) ((VAL) >= -127 && (VAL) <= 128)
  
  #define CONST_OK_FOR_LETTER_P(VALUE, C)					\
*************** M32R_STACK_ALIGN (current_function_outgo
*** 1046,1064 ****
  /* Round arg MODE/TYPE up to the next word boundary.  */
  #define ROUND_ADVANCE_ARG(MODE, TYPE) \
    ((MODE) == BLKmode				\
!    ? ROUND_ADVANCE (int_size_in_bytes (TYPE))	\
     : ROUND_ADVANCE (GET_MODE_SIZE (MODE)))
  
  /* Round CUM up to the necessary point for argument MODE/TYPE.  */
- #if 0
- #define ROUND_ADVANCE_CUM(CUM, MODE, TYPE) \
- ((((MODE) == BLKmode ? TYPE_ALIGN (TYPE) : GET_MODE_BITSIZE (MODE)) \
-   > BITS_PER_WORD)	\
-  ? ((CUM) + 1 & ~1)	\
-  : (CUM))
- #else
  #define ROUND_ADVANCE_CUM(CUM, MODE, TYPE) (CUM)
- #endif
  
  /* Return boolean indicating arg of type TYPE and mode MODE will be passed in
     a reg.  This includes arguments that have to be passed by reference as the
--- 1044,1054 ----
  /* Round arg MODE/TYPE up to the next word boundary.  */
  #define ROUND_ADVANCE_ARG(MODE, TYPE) \
    ((MODE) == BLKmode				\
!    ? ROUND_ADVANCE ((unsigned int) int_size_in_bytes (TYPE))	\
     : ROUND_ADVANCE (GET_MODE_SIZE (MODE)))
  
  /* Round CUM up to the necessary point for argument MODE/TYPE.  */
  #define ROUND_ADVANCE_CUM(CUM, MODE, TYPE) (CUM)
  
  /* Return boolean indicating arg of type TYPE and mode MODE will be passed in
     a reg.  This includes arguments that have to be passed by reference as the

Index: config/m32r/m32r.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r.c,v
retrieving revision 1.25
diff -p -r1.25 m32r.c
*** m32r.c	2001/03/22 18:48:46	1.25
--- m32r.c	2001/06/11 16:47:01
***************
*** 1,5 ****
  /* Subroutines used for code generation on the Mitsubishi M32R cpu.
!    Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
  
  This file is part of GNU CC.
  
--- 1,5 ----
  /* Subroutines used for code generation on the Mitsubishi M32R cpu.
!    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
  
  This file is part of GNU CC.
  
*************** Boston, MA 02111-1307, USA.  */
*** 34,39 ****
--- 34,40 ----
  #include "function.h"
  #include "recog.h"
  #include "toplev.h"
+ #include "ggc.h"
  #include "m32r-protos.h"
  
  /* Save the operands last given to a compare for use when we
*************** enum m32r_sdata m32r_sdata;
*** 55,61 ****
  int m32r_sched_odd_word_p;
  
  /* Forward declaration.  */
! static void init_reg_tables			PARAMS ((void));
  
  /* Called by OVERRIDE_OPTIONS to initialize various things.  */
  
--- 56,64 ----
  int m32r_sched_odd_word_p;
  
  /* Forward declaration.  */
! static void  init_reg_tables			PARAMS ((void));
! static void  block_move_call			PARAMS ((rtx, rtx, rtx));
! static int   m32r_is_insn			PARAMS ((rtx));
  
  /* Called by OVERRIDE_OPTIONS to initialize various things.  */
  
*************** m32r_encode_section_info (decl)
*** 372,378 ****
        if (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd'
  	  && DECL_SECTION_NAME (decl) != NULL_TREE)
  	{
! 	  char *name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
  	  if (! strcmp (name, ".sdata") || ! strcmp (name, ".sbss"))
  	    {
  #if 0 /* ??? There's no reason to disallow this, is there?  */
--- 375,381 ----
        if (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd'
  	  && DECL_SECTION_NAME (decl) != NULL_TREE)
  	{
! 	  char *name = (char *) TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
  	  if (! strcmp (name, ".sdata") || ! strcmp (name, ".sbss"))
  	    {
  #if 0 /* ??? There's no reason to disallow this, is there?  */
*************** m32r_encode_section_info (decl)
*** 436,441 ****
--- 439,445 ----
        const char *str = XSTR (XEXP (rtl, 0), 0);
        int len = strlen (str);
        char *newstr = ggc_alloc (len + 2);
+ 
        strcpy (newstr + 1, str);
        *newstr = prefix;
        XSTR (XEXP (rtl, 0), 0) = newstr;
*************** move_src_operand (op, mode)
*** 744,750 ****
  	 loadable with one insn, and split the rest into two.  The instances
  	 where this would help should be rare and the current way is
  	 simpler.  */
!       return INT32_P (INTVAL (op));
      case LABEL_REF :
        return TARGET_ADDR24;
      case CONST_DOUBLE :
--- 748,754 ----
  	 loadable with one insn, and split the rest into two.  The instances
  	 where this would help should be rare and the current way is
  	 simpler.  */
!       return UINT32_P (INTVAL (op));
      case LABEL_REF :
        return TARGET_ADDR24;
      case CONST_DOUBLE :
*************** function_arg_partial_nregs (cum, mode, t
*** 1345,1353 ****
       int named ATTRIBUTE_UNUSED;
  {
    int ret;
!   int size = (((mode == BLKmode && type)
! 	       ? int_size_in_bytes (type)
! 	       : GET_MODE_SIZE (mode)) + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
  
    if (*cum >= M32R_MAX_PARM_REGS)
      ret = 0;
--- 1349,1359 ----
       int named ATTRIBUTE_UNUSED;
  {
    int ret;
!   unsigned int size =
!     (((mode == BLKmode && type)
!       ? (unsigned int) int_size_in_bytes (type)
!       : GET_MODE_SIZE (mode)) + UNITS_PER_WORD - 1)
!     / UNITS_PER_WORD;
  
    if (*cum >= M32R_MAX_PARM_REGS)
      ret = 0;
*************** m32r_sched_reorder (stream, verbose, rea
*** 1559,1565 ****
        for (i = n_ready-1; i >= 0; i--)
  	{
  	  rtx insn = ready[i];
- 	  enum rtx_code code;
  
  	  if (! m32r_is_insn (insn))
  	    {
--- 1565,1570 ----
*************** m32r_sched_reorder (stream, verbose, rea
*** 1615,1621 ****
  	  for (i = 0; i < n_ready; i++)
  	    {
  	      rtx insn = ready[i];
- 	      enum rtx_code code;
  
  	      fprintf (stream, " %d", INSN_UID (ready[i]));
  
--- 1620,1625 ----
*************** m32r_expand_block_move (operands)
*** 2777,2783 ****
     operands[3] is a temp register.
     operands[4] is a temp register.  */
  
! char *
  m32r_output_block_move (insn, operands)
       rtx insn ATTRIBUTE_UNUSED;
       rtx operands[];
--- 2781,2787 ----
     operands[3] is a temp register.
     operands[4] is a temp register.  */
  
! void
  m32r_output_block_move (insn, operands)
       rtx insn ATTRIBUTE_UNUSED;
       rtx operands[];
*************** m32r_output_block_move (insn, operands)
*** 2891,2898 ****
  
        first_time = 0;
      }
- 
-   return "";
  }
  
  /* Return true if op is an integer constant, less than or equal to
--- 2895,2900 ----


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