[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
OBSD-particular #define misbehavior...
- To: misc_(_at_)_openbsd_(_dot_)_org
- Subject: OBSD-particular #define misbehavior...
- From: David Snyder <dasnyderx_(_at_)_yahoo_(_dot_)_com>
- Date: Mon, 23 Aug 2004 03:18:11 -0400
To all and sundry,
I have recently been trying to port the smartmontools program (see
http://smartmontools.sf.net) to the OBSD platform and have had some
success. However, one issue has come up which may be due to my
ignorance of some particular detail of C programming or something else
which I am overlooking.
The problem has to do with the following example #define stmt in the
file, int64.h (line 64):
#define PRId64 "lld"
The following example is from the original code using this #define in
file, smartd.c (line 453):
PrintOut(LOG_INFO, "Memory still allocated for devices at exit is
%"PRId64" bytes.\n", bytes);
As you can see, the value 'lld' is supposed to be inserted into the
'PRId64' placeholder. However, whenever the file is compile with the
following command (from the Makefile):
source='smartd.c' object='smartd.o' libtool=no
depfile='.deps/smartd.Po' tmpdepfile='.deps/smartd.TPo' depmode=gcc
/bin/sh ./depcomp gcc -DHAVE_CONFIG_H -I. -I. -I.
-DSMARTMONTOOLS_SYSCONFDIR=\"/usr/local/etc\" -g -O2 -Wall -W -c
`test -f 'smartd.c' || echo './'`smartd.c
the following error comes up:
smartd.c:453: syntax error before `PRId64'
Now, in order to overcome this error (and numerous other instances of
the same error), I have had to go through and change all the 'PRId64'
instances to 'lld'. So, my questions are: 1) is this some sort of a
GNU-ism?; 2) is something about the code or compile method which I need
to change to use the original code? or 3) should the string used at line
453 in smartd.c have been constructed beforehand with a strncpy (or
strlcpy, strncat, etc.) and _then_ used in the line?
BTW, I titled this message as 'OBSD-particular #define misbehavior'
because smartmontools has already been ported to Free- and NetBSD and,
according to the documentation, they compile fine on those platforms. I
don't have either of those two platforms to test it out on, but I'd
assume there's no problem compiling the smartd.c line 453 (and others
like it) on those platforms. Any thoughts on that?
Visit your host, monkey.org