* [PATCH]: Fix compile time warning building ARM port of GAS
@ 2005-06-01 8:18 Nick Clifton
2005-06-01 9:42 ` Zack Weinberg
0 siblings, 1 reply; 6+ messages in thread
From: Nick Clifton @ 2005-06-01 8:18 UTC (permalink / raw)
To: binutils
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)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH]: Fix compile time warning building ARM port of GAS
2005-06-01 8:18 [PATCH]: Fix compile time warning building ARM port of GAS Nick Clifton
@ 2005-06-01 9:42 ` Zack Weinberg
2005-06-01 13:28 ` Daniel Jacobowitz
0 siblings, 1 reply; 6+ messages in thread
From: Zack Weinberg @ 2005-06-01 9:42 UTC (permalink / raw)
To: Nick Clifton; +Cc: binutils
Nick Clifton <nickc@redhat.com> writes:
> 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.
Sorry, that's not a redundant test. Look farther down the file, each
of the Txx macros has a corresponding non-T macro, that invokes the T
macro with 0 for the 'te' argument. Since md_assemble uses the
tvariant field to decide whether it's got an encoding function to
call, this patch will cause the assembler to crash on, e.g.
.text
.syntax unified
.thumb
rsc r0, r0, r0
I can work with you to find another solution, but I'm not seeing these
warnings. What compiler are you using?
zw
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH]: Fix compile time warning building ARM port of GAS
2005-06-01 9:42 ` Zack Weinberg
@ 2005-06-01 13:28 ` Daniel Jacobowitz
2005-06-03 11:06 ` Nick Clifton
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2005-06-01 13:28 UTC (permalink / raw)
To: Zack Weinberg; +Cc: Nick Clifton, binutils
On Wed, Jun 01, 2005 at 02:42:19AM -0700, Zack Weinberg wrote:
> > 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.
>
> Sorry, that's not a redundant test. Look farther down the file, each
> of the Txx macros has a corresponding non-T macro, that invokes the T
> macro with 0 for the 'te' argument. Since md_assemble uses the
> tvariant field to decide whether it's got an encoding function to
> call, this patch will cause the assembler to crash on, e.g.
>
> .text
> .syntax unified
> .thumb
> rsc r0, r0, r0
>
> I can work with you to find another solution, but I'm not seeing these
> warnings. What compiler are you using?
Since I read Zack's message and didn't quite get it, here's a missing
clue:
#define do_0 0
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH]: Fix compile time warning building ARM port of GAS
2005-06-01 13:28 ` Daniel Jacobowitz
@ 2005-06-03 11:06 ` Nick Clifton
2005-06-03 17:00 ` Zack Weinberg
0 siblings, 1 reply; 6+ messages in thread
From: Nick Clifton @ 2005-06-03 11:06 UTC (permalink / raw)
To: Zack Weinberg; +Cc: Daniel Jacobowitz, binutils
[-- Attachment #1: Type: text/plain, Size: 705 bytes --]
Hi Zack,
> Daniel Jacobowitz wrote:
> Since I read Zack's message and didn't quite get it, here's a missing
> clue:
> #define do_0 0
Ah! Thanks Daniel, I had missed that.
>>Sorry, that's not a redundant test. Look farther down the file, each
>>of the Txx macros has a corresponding non-T macro, that invokes the T
>>macro with 0 for the 'te' argument.
OK, in which case we need to fix this non-T macros. What do you think
of the attached patch ?
>>I can work with you to find another solution, but I'm not seeing these
>>warnings. What compiler are you using?
I am using a 3.4 based version distributed by RedHat to some of our
customers:
gcc (GCC) 3.4-gnupro-04r2-2
Cheers
Nick
[-- Attachment #2: tc-arm.c.patch --]
[-- Type: text/plain, Size: 2811 bytes --]
Index: gas/config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.206
diff -c -3 -p -r1.206 tc-arm.c
*** gas/config/tc-arm.c 1 Jun 2005 08:18:42 -0000 1.206
--- gas/config/tc-arm.c 3 Jun 2005 11:05:44 -0000
*************** static const struct asm_cond conds[] =
*** 8027,8038 ****
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)
! #define C3(mnem, op, nops, ops, ae) TC3(mnem, op, 0, nops, ops, ae, 0)
! #define CM(m1,m2, op, nops, ops, ae) TCM(m1,m2, op, 0, nops, ops, ae, 0)
! #define UE(mnem, op, nops, ops, ae) TUE(mnem, op, 0, nops, ops, ae, 0)
! #define UF(mnem, op, nops, ops, ae) TUF(mnem, op, 0, nops, ops, ae, 0)
! #define do_0 0
/* Thumb-only, unconditional. */
#define UT(mnem, op, nops, ops, te) TUE(mnem, 0, op, nops, ops, 0, te)
--- 8027,8071 ----
THUMB_VARIANT, do_##ae, do_##te }
/* ARM-only variants of all the above. */
! #define CE(mnem, op, nops, ops, ae) \
! { #mnem, OPS##nops ops, OT_csuffix, 0x##op, 0x0, ARM_VARIANT, 0, do_##ae, NULL }
!
! #define C3(mnem, op, nops, ops, ae) \
! { #mnem, OPS##nops ops, OT_cinfix3, 0x##op, 0x0, ARM_VARIANT, 0, do_##ae, NULL }
!
! #define xCM_(m1, m2, m3, op, nops, ops, ae) \
! { #m1 #m2 #m3, OPS##nops ops, \
! sizeof(#m2) == 1 ? OT_odd_infix_unc : OT_odd_infix_0 + sizeof(#m1) - 1, \
! 0x##op, 0x0, ARM_VARIANT, 0, do_##ae, NULL }
!
! #define CM(m1, m2, op, nops, ops, ae) \
! xCM_(m1, , m2, op, nops, ops, ae), \
! xCM_(m1, eq, m2, op, nops, ops, ae), \
! xCM_(m1, ne, m2, op, nops, ops, ae), \
! xCM_(m1, cs, m2, op, nops, ops, ae), \
! xCM_(m1, hs, m2, op, nops, ops, ae), \
! xCM_(m1, cc, m2, op, nops, ops, ae), \
! xCM_(m1, ul, m2, op, nops, ops, ae), \
! xCM_(m1, lo, m2, op, nops, ops, ae), \
! xCM_(m1, mi, m2, op, nops, ops, ae), \
! xCM_(m1, pl, m2, op, nops, ops, ae), \
! xCM_(m1, vs, m2, op, nops, ops, ae), \
! xCM_(m1, vc, m2, op, nops, ops, ae), \
! xCM_(m1, hi, m2, op, nops, ops, ae), \
! xCM_(m1, ls, m2, op, nops, ops, ae), \
! xCM_(m1, ge, m2, op, nops, ops, ae), \
! xCM_(m1, lt, m2, op, nops, ops, ae), \
! xCM_(m1, gt, m2, op, nops, ops, ae), \
! xCM_(m1, le, m2, op, nops, ops, ae), \
! xCM_(m1, al, m2, op, nops, ops, ae)
!
! #define UE(mnem, op, nops, ops, ae) \
! { #mnem, OPS##nops ops, OT_unconditional, 0x##op, 0, ARM_VARIANT, 0, do_##ae, NULL }
!
! #define UF(mnem, op, nops, ops, ae) \
! { #mnem, OPS##nops ops, OT_unconditionalF, 0x##op, 0, ARM_VARIANT, 0, do_##ae, NULL }
!
! #define do_0 NULL
/* Thumb-only, unconditional. */
#define UT(mnem, op, nops, ops, te) TUE(mnem, 0, op, nops, ops, 0, te)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH]: Fix compile time warning building ARM port of GAS
2005-06-03 11:06 ` Nick Clifton
@ 2005-06-03 17:00 ` Zack Weinberg
2005-06-04 14:05 ` Nick Clifton
0 siblings, 1 reply; 6+ messages in thread
From: Zack Weinberg @ 2005-06-03 17:00 UTC (permalink / raw)
To: Nick Clifton; +Cc: Daniel Jacobowitz, binutils
Nick Clifton <nickc@redhat.com> writes:
>>>Sorry, that's not a redundant test. Look farther down the file, each
>>>of the Txx macros has a corresponding non-T macro, that invokes the T
>>> macro with 0 for the 'te' argument.
>
> OK, in which case we need to fix this non-T macros. What do you think
> of the attached patch ?
Looks good to me, except I would prefer the use of 0 rather than NULL,
for consistency with the rest of the file.
>>>I can work with you to find another solution, but I'm not seeing these
>>>warnings. What compiler are you using?
>
> I am using a 3.4 based version distributed by RedHat to some of our
> customers:
Ah. I'm using 3.3 (Debian's default). Now I think about it, this
warning was only added in 3.4.
zw
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH]: Fix compile time warning building ARM port of GAS
2005-06-03 17:00 ` Zack Weinberg
@ 2005-06-04 14:05 ` Nick Clifton
0 siblings, 0 replies; 6+ messages in thread
From: Nick Clifton @ 2005-06-04 14:05 UTC (permalink / raw)
To: Zack Weinberg; +Cc: Daniel Jacobowitz, binutils
Hi Zack,
>>OK, in which case we need to fix this non-T macros. What do you think
>>of the attached patch ?
> Looks good to me, except I would prefer the use of 0 rather than NULL,
> for consistency with the rest of the file.
OK - I have checked the patch in with the ChangeLog entry below. I
reverted the definition of do_0 to 0 as requested although personally I
think that this is wrong - it is being used to initialise a pointer
field not an integer field - but I am not so anal as to insist on it.
(Although I did once work with a compiler where 0 was a valid address
and NULL was defined to a non-zero value. That was fun!)
> Ah. I'm using 3.3 (Debian's default). Now I think about it, this
> warning was only added in 3.4.
We probably ought to be building and checking with a 4.0 compiler on a
regular basis as well... Oh well, another thing to add to the list of
jobs to do.
Cheers
Nick
gas/ChangeLog
2005-06-04 Nick Clifton <nickc@redhat.com>
* config/tc-arm.c (CE, C3, CM, UE, UF): Redefine without reference
to their Thumb-enabled equivalents.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-06-04 14:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-01 8:18 [PATCH]: Fix compile time warning building ARM port of GAS Nick Clifton
2005-06-01 9:42 ` Zack Weinberg
2005-06-01 13:28 ` Daniel Jacobowitz
2005-06-03 11:06 ` Nick Clifton
2005-06-03 17:00 ` Zack Weinberg
2005-06-04 14:05 ` Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).