This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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]

[PATCH]: Fix compile time warning building ARM port of GAS


Hi Guys,

  I am applying the patch below to fix a compile time warning message
  which was preventing the ARM port of GAS being built.  The warning
  message was:

    .../gas/config/tc-arm.c:8445: warning:
      the address of `do_t_it', will always evaluate as `true'

  (There were lots of duplicates of this message for different lines
  in the tc-arm.c source file).  This was from a 3.4 based version of
  GCC.

  The problem was because of macros like this:

    #define TUE(mnem, op, top, nops, ops, ae, te)			\
    { #mnem, OPS##nops ops, OT_unconditional, 0x##op, 0x##top, ARM_VARIANT, \
      do_##te ? THUMB_VARIANT : 0, do_##ae, do_##te }

  where the "do_##te ? THUMB_VARIANT : 0" always evaluates to
  THUMB_VARIANT since do_##te must always exist - it is used to
  initialise the last field in the structure being set up by the
  macro.  Hence the patch just removes the redundant tests.

Cheers
  Nick

gas/ChangeLog
2005-06-01  Nick Clifton  <nickc@redhat.com>

	* config/tc-arm.c (TxCE, TxC3, TxCM, TUE, TUF): Remove redundant
	test for the presence of thumb version of the parsing functions
	since they must always exist and the test generates a compile time
	warning message.


Index: gas/config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.205
diff -c -3 -p -r1.205 tc-arm.c
*** gas/config/tc-arm.c	27 May 2005 07:11:43 -0000	1.205
--- gas/config/tc-arm.c	1 Jun 2005 08:08:30 -0000
*************** static const struct asm_cond conds[] =
*** 7963,7969 ****
  /* The normal sort of mnemonic; has a Thumb variant; takes a conditional suffix.  */
  #define TxCE(mnem, op, top, nops, ops, ae, te) \
    { #mnem, OPS##nops ops, OT_csuffix, 0x##op, top, ARM_VARIANT, \
!     do_##te ? THUMB_VARIANT : 0, do_##ae, do_##te }
  
  /* Two variants of the above - TCE for a numeric Thumb opcode, tCE for
     a T_MNEM_xyz enumerator.  */
--- 7963,7969 ----
  /* The normal sort of mnemonic; has a Thumb variant; takes a conditional suffix.  */
  #define TxCE(mnem, op, top, nops, ops, ae, te) \
    { #mnem, OPS##nops ops, OT_csuffix, 0x##op, top, ARM_VARIANT, \
!     THUMB_VARIANT, do_##ae, do_##te }
  
  /* Two variants of the above - TCE for a numeric Thumb opcode, tCE for
     a T_MNEM_xyz enumerator.  */
*************** static const struct asm_cond conds[] =
*** 7976,7982 ****
     infix after the third character.  */
  #define TxC3(mnem, op, top, nops, ops, ae, te) \
    { #mnem, OPS##nops ops, OT_cinfix3, 0x##op, top, ARM_VARIANT, \
!     do_##te ? THUMB_VARIANT : 0, do_##ae, do_##te }
  #define TC3(mnem, aop, top, nops, ops, ae, te) \
         TxC3(mnem, aop, 0x##top, nops, ops, ae, te)
  #define tC3(mnem, aop, top, nops, ops, ae, te) \
--- 7976,7982 ----
     infix after the third character.  */
  #define TxC3(mnem, op, top, nops, ops, ae, te) \
    { #mnem, OPS##nops ops, OT_cinfix3, 0x##op, top, ARM_VARIANT, \
!     THUMB_VARIANT, do_##ae, do_##te }
  #define TC3(mnem, aop, top, nops, ops, ae, te) \
         TxC3(mnem, aop, 0x##top, nops, ops, ae, te)
  #define tC3(mnem, aop, top, nops, ops, ae, te) \
*************** static const struct asm_cond conds[] =
*** 7986,7992 ****
     appear in the condition table.  */
  #define TxCM_(m1, m2, m3, op, top, nops, ops, ae, te)	\
    { #m1 #m2 #m3, OPS##nops ops, sizeof(#m2) == 1 ? OT_odd_infix_unc : OT_odd_infix_0 + sizeof(#m1) - 1, \
!     0x##op, top, ARM_VARIANT, do_##te ? THUMB_VARIANT : 0, do_##ae, do_##te }
  
  #define TxCM(m1, m2, op, top, nops, ops, ae, te)	\
    TxCM_(m1,   , m2, op, top, nops, ops, ae, te),	\
--- 7986,7992 ----
     appear in the condition table.  */
  #define TxCM_(m1, m2, m3, op, top, nops, ops, ae, te)	\
    { #m1 #m2 #m3, OPS##nops ops, sizeof(#m2) == 1 ? OT_odd_infix_unc : OT_odd_infix_0 + sizeof(#m1) - 1, \
!     0x##op, top, ARM_VARIANT, THUMB_VARIANT, do_##ae, do_##te }
  
  #define TxCM(m1, m2, op, top, nops, ops, ae, te)	\
    TxCM_(m1,   , m2, op, top, nops, ops, ae, te),	\
*************** static const struct asm_cond conds[] =
*** 8018,8030 ****
     field is still 0xE.  */
  #define TUE(mnem, op, top, nops, ops, ae, te)				\
    { #mnem, OPS##nops ops, OT_unconditional, 0x##op, 0x##top, ARM_VARIANT, \
!     do_##te ? THUMB_VARIANT : 0, do_##ae, do_##te }
  
  /* Mnemonic that cannot be conditionalized, and bears 0xF in its ARM
     condition code field.  */
  #define TUF(mnem, op, top, nops, ops, ae, te)				\
    { #mnem, OPS##nops ops, OT_unconditionalF, 0x##op, 0x##top, ARM_VARIANT, \
!     do_##te ? THUMB_VARIANT : 0, do_##ae, do_##te }
  
  /* ARM-only variants of all the above.  */
  #define CE(mnem,  op, nops, ops, ae) TCE(mnem,  op, 0, nops, ops, ae, 0)
--- 8018,8030 ----
     field is still 0xE.  */
  #define TUE(mnem, op, top, nops, ops, ae, te)				\
    { #mnem, OPS##nops ops, OT_unconditional, 0x##op, 0x##top, ARM_VARIANT, \
!     THUMB_VARIANT, do_##ae, do_##te }
  
  /* Mnemonic that cannot be conditionalized, and bears 0xF in its ARM
     condition code field.  */
  #define TUF(mnem, op, top, nops, ops, ae, te)				\
    { #mnem, OPS##nops ops, OT_unconditionalF, 0x##op, 0x##top, ARM_VARIANT, \
!     THUMB_VARIANT, do_##ae, do_##te }
  
  /* ARM-only variants of all the above.  */
  #define CE(mnem,  op, nops, ops, ae) TCE(mnem,  op, 0, nops, ops, ae, 0)
  


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