This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
warning: value computed is not used
- To: gcc at gcc dot gnu dot org
- Subject: warning: value computed is not used
- From: Byron Stanoszek <gandalf at winds dot org>
- Date: Thu, 28 Sep 2000 22:13:01 -0400 (EDT)
While using the latest snapshot (20000928), I came across this error in much of
my code. It results from a #define ({ result; }) macro where the result is
[optionally], but not always, used. Line 19, below.
---
warning.c:
#include <stdlib.h>
#include <string.h>
/* like strncpy but doesn't pad with zeroes. n=buffer size instead of siz-1 */
#define strmaxcpy(d, s, n) ({ char *_d=d; int _n=n; \
if(_n > 0 && !memccpy(_d, s, 0, _n)) \
_d[_n-1]='\0'; _d; })
int main(int argc, char *argv[])
{
char buf[256], buf2[256];
char *dest;
/* produces no warning */
dest = strmaxcpy(buf, argv[0], 256);
/* produces warning */
strmaxcpy(buf2, argv[0], 256); /* line 19 */
exit(0);
}
root:~> gcc -Wall -O3 warning.c -c
warning.c: In function `main':
warning.c:19: warning: value computed is not used
warning.c:22: warning: control reaches end of non-void function
---
Also, the warning on line 22 hasn't come up before. Has exit() been dropped
from the list of built-in functions?
--
Byron Stanoszek Ph: (330) 644-3059
Systems Programmer Fax: (330) 644-8110
Commercial Timesharing Inc. Email: bstanoszek@comtime.com