[ofa-general] dtest.c: complaints about "too many arguments for format"
Harold Iuzzolino
iuzzolin at nmia.com
Thu Aug 28 22:48:40 PDT 2008
Dear Openfabrics, general at lists.openfabrics.org
Bug #2 in dtest.c: complaints about "too many arguments for format".
I believe the problem is caused by 'PRIx64', either its definition or use,
namely a missing '%' before PRIx64.
gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I ./../../dat/include -O2 -g
-pipe
-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic -MT dtest.o -MD -MP -MF
".deps/dtest.Tpo" -c -o dtest.o dtest.c
dtest.c:583: warning: too many arguments for format
dtest.c:868: warning: too many arguments for format
dtest.c:1087: warning: too many arguments for format
dtest.c:1197: warning: too many arguments for format
dtest.c:1279: warning: too many arguments for format
dtest.c:1431: warning: too many arguments for format
Line 583 has 3 arguments but 2 formats %d, %d
fprintf(stderr, "%d: ERROR: DTO len %d or cookie " PRIx64 "\n",
getpid(),
event.event_data.dto_completion_event_data.transfered_length,
event.event_data.dto_completion_event_data.user_cookie.as_64 );
Line 868 has 4 arguments but 3 formats %d, %d, %d
fprintf(stderr,"ERR recv event: len=%d cookie=" PRIx64 " expected
%d/%d\n",
(int)event.event_data.dto_completion_event_data.transfered_length,
(int)event.event_data.dto_completion_event_data.user_cookie.as_64,
sizeof(DAT_RMR_TRIPLET), recv_msg_index );
Line 1087 has 4 arguments but 3 formats %d, %d, %d
fprintf(stderr,"unexpected event data for receive: len=%d
cookie="
PRIx64 " exp %d/%d\n",
(int)event.event_data.dto_completion_event_data.transfered_length,
(int)event.event_data.dto_completion_event_data.user_cookie.as_64,
sizeof(DAT_RMR_TRIPLET), recv_msg_index );
Line 1197 has 3 arguments but 2 formats %d, %d
fprintf(stderr, "%d: ERROR: DTO len %d or cookie " PRIx64
"\n",
getpid(),
event.event_data.dto_completion_event_data.transfered_length,
event.event_data.dto_completion_event_data.user_cookie.as_64 );
Lines 1279 and 1431 have the same format and I think, the same problem
with the definition or use of PRIx64.
I am in the top level directory of the BUILD of compat-dapl-1.2.8
[root at treebeard BUILD]# pwd
/var/tmp/OFED_topdir/BUILD
[root at treebeard BUILD]# grep -r PRIx64 *
PRIx64 is USED only in dtest.c. It is not defined in any .h file in the
compat-dapl-1.2.8 package
[root at treebeard BUILD]# grep -r PRIx64 /usr/include/*
/usr/include/inttypes.h:# define PRIx64 __PRI64_PREFIX "x"
In the inttypes.h file you find
# define PRIx64 __PRI64_PREFIX "x"
# if __WORDSIZE == 64
# define __PRI64_PREFIX "l"
# define __PRIPTR_PREFIX "l"
# else
# define __PRI64_PREFIX "ll"
# define __PRIPTR_PREFIX
# endif
Since I'm using a 64 bit machine, the 'PRIx64' in the format would look
like
'lx'.
But a format string needs to be %lx.
So, for example, in line 583 I think you need to change
fprintf(stderr, "%d: ERROR: DTO len %d or cookie " PRIx64 "\n",
to
fprintf(stderr, "%d: ERROR: DTO len %d or cookie %" PRIx64
"\n",
or maybe
fprintf(stderr, "%d: ERROR: DTO len %d or cookie " "%" PRIx64
"\n",
or maybe
#define PRI64_FMT "%" PRIx64
fprintf(stderr, "%d: ERROR: DTO len %d or cookie " PRI64_FMT
"\n",
The format needs a '%' in front of PRIx64.
Carlyn Iuzzolino
iuzzolin at nmia.com
More information about the general
mailing list