This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch for "statement with no effect" warnings with --disable-checking
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 20 May 2002 23:23:38 -0400 (EDT)
- Subject: Patch for "statement with no effect" warnings with --disable-checking
If you configure with --disable-checking, then RTL_FLAG_CHECK1 called
in SUBREG_PROMOTED_UNSIGNED_SET becomes just (RTX) and yields the
following warnings. If you look at the code in the patch its clear
that they arise because the RTL_FLAG_CHECK1 expr is never used.
> calls.c:1542: warning: statement with no effect
> calls.c:3280: warning: statement with no effect
> expr.c:4164: warning: statement with no effect
> expr.c:6451: warning: statement with no effect
> expr.c:6583: warning: statement with no effect
> expr.c:6605: warning: statement with no effect
> function.c:4819: warning: statement with no effect
Fixed with the following patch. It also ensures RTX isn't evaluated
more than once. I suppose I could do the same for the VAL parameter,
but it didn't seem worthwhile. (Shrug.)
Tested via bootstrap with and without --disable-checking on
sparc-sun-solaris2.7. Ok to install on the trunk?
Thanks,
--Kaveh
2002-05-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* rtl.h (SUBREG_PROMOTED_UNSIGNED_SET): Avoid warnings when
disabling checking, and avoid multiple evaluation of RTX.
diff -rcp orig/egcc-CVS20020520/gcc/rtl.h egcc-CVS20020520/gcc/rtl.h
*** orig/egcc-CVS20020520/gcc/rtl.h Mon May 13 07:00:49 2002
--- egcc-CVS20020520/gcc/rtl.h Mon May 20 22:13:10 2002
*************** extern unsigned int subreg_regno PARAMS
*** 982,993 ****
#define SUBREG_PROMOTED_UNSIGNED_SET(RTX, VAL) \
do { \
! RTL_FLAG_CHECK1("SUBREG_PROMOTED_UNSIGNED_SET", (RTX), SUBREG); \
if ((VAL) < 0) \
! (RTX)->volatil = 1; \
else { \
! (RTX)->volatil = 0; \
! (RTX)->unchanging = (VAL); \
} \
} while (0)
#define SUBREG_PROMOTED_UNSIGNED_P(RTX) \
--- 982,993 ----
#define SUBREG_PROMOTED_UNSIGNED_SET(RTX, VAL) \
do { \
! rtx const _rtx = RTL_FLAG_CHECK1("SUBREG_PROMOTED_UNSIGNED_SET", (RTX), SUBREG); \
if ((VAL) < 0) \
! _rtx->volatil = 1; \
else { \
! _rtx->volatil = 0; \
! _rtx->unchanging = (VAL); \
} \
} while (0)
#define SUBREG_PROMOTED_UNSIGNED_P(RTX) \