A number of compiler warnings eliminated.
bk: 4ea1c38aDXOvWvJklhxgK4o6I5G1Pg
+* [Bug 2036] gcc 2.95.3 preprocessor can't nest #ifdef in macro args.
+* A number of compiler warnings eliminated.
(4.2.7p226) 2011/10/21 Released by Harlan Stenn <stenn@ntp.org>
* [Bug 2035] ntpq -c mrulist sleeps 1 sec between queries, not 5 msec.
* Documentation updates from Dave Mills.
ISC_LANG_BEGINDECLS
isc_result_t
-isc_file_settime(const char *file, isc_time_t *time);
+isc_file_settime(const char *file, isc_time_t *itime);
isc_result_t
-isc_file_getmodtime(const char *file, isc_time_t *time);
+isc_file_getmodtime(const char *file, isc_time_t *itime);
/*!<
* \brief Get the time of last modification of a file.
*
* Use this in translation units that would otherwise be empty, to
* suppress compiler warnings.
*/
-#define EMPTY_TRANSLATION_UNIT static void isc__empty(void) { isc__empty(); }
+#define EMPTY_TRANSLATION_UNIT static char nonempty_translation_unit;
/*%
* We use macros instead of calling the routines directly because
static const char *inet_ntop6(const unsigned char *src, char *dst,
size_t size);
#endif
+const char *isc_net_ntop(int af, const void *src, char *dst, size_t size);
/*! char *
* isc_net_ntop(af, src, dst, size)
int len;
len = snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]);
- if (len < 0 || len >= size)
+ if (len < 0 || (size_t)len >= size)
{
errno = ENOSPC;
return (NULL);
static int inet_pton4(const char *src, unsigned char *dst);
static int inet_pton6(const char *src, unsigned char *dst);
+int isc_net_pton(int af, const char *src, void *dst);
/*%
* convert from presentation format (which usually means ASCII printable)
static isc_mutex_t lock;
static isc_result_t
-register_table(unsigned int base, unsigned int nresults, const char **text,
+register_table(unsigned int base, unsigned int nresults, const char **txt,
isc_msgcat_t *msgcat, int set)
{
resulttable *table;
REQUIRE(base % ISC_RESULTCLASS_SIZE == 0);
REQUIRE(nresults <= ISC_RESULTCLASS_SIZE);
- REQUIRE(text != NULL);
+ REQUIRE(txt != NULL);
/*
* We use malloc() here because we we want to be able to use
return (ISC_R_NOMEMORY);
table->base = base;
table->last = base + nresults - 1;
- table->text = text;
+ table->text = txt;
table->msgcat = msgcat;
table->set = set;
ISC_LINK_INIT(table, link);
const char *
isc_result_totext(isc_result_t result) {
resulttable *table;
- const char *text, *default_text;
+ const char *txt, *default_text;
int index;
initialize();
LOCK(&lock);
- text = NULL;
+ txt = NULL;
for (table = ISC_LIST_HEAD(tables);
table != NULL;
table = ISC_LIST_NEXT(table, link)) {
* instead of index because isc_msgcat_get() requires
* the message number to be > 0.
*/
- text = isc_msgcat_get(table->msgcat, table->set,
- index + 1, default_text);
+ txt = isc_msgcat_get(table->msgcat, table->set,
+ index + 1, default_text);
break;
}
}
- if (text == NULL)
- text = isc_msgcat_get(isc_msgcat, ISC_RESULT_UNAVAILABLESET,
- 1, "(result code text not available)");
+ if (txt == NULL)
+ txt = isc_msgcat_get(isc_msgcat, ISC_RESULT_UNAVAILABLESET,
+ 1, "(result code text not available)");
UNLOCK(&lock);
- return (text);
+ return (txt);
}
isc_result_t
isc_result_register(unsigned int base, unsigned int nresults,
- const char **text, isc_msgcat_t *msgcat, int set)
+ const char **txt, isc_msgcat_t *msgcat, int set)
{
initialize();
- return (register_table(base, nresults, text, msgcat, set));
+ return (register_table(base, nresults, txt, msgcat, set));
}
}
isc_result_t
-isc_file_getmodtime(const char *file, isc_time_t *time) {
+isc_file_getmodtime(const char *file, isc_time_t *itime) {
isc_result_t result;
struct stat stats;
REQUIRE(file != NULL);
- REQUIRE(time != NULL);
+ REQUIRE(itime != NULL);
result = file_stats(file, &stats);
* XXXDCL some operating systems provide nanoseconds, too,
* such as BSD/OS via st_mtimespec.
*/
- isc_time_set(time, stats.st_mtime, 0);
+ isc_time_set(itime, stats.st_mtime, 0);
return (result);
}
isc_result_t
-isc_file_settime(const char *file, isc_time_t *time) {
+isc_file_settime(const char *file, isc_time_t *itime) {
struct timeval times[2];
- REQUIRE(file != NULL && time != NULL);
+ REQUIRE(file != NULL && itime != NULL);
/*
* tv_sec is at least a 32 bit quantity on all platforms we're
* * isc_time_seconds is changed to be > 32 bits but long is 32 bits
* and isc_time_seconds has at least 33 significant bits.
*/
- times[0].tv_sec = times[1].tv_sec = (long)isc_time_seconds(time);
+ times[0].tv_sec = times[1].tv_sec = (long)isc_time_seconds(itime);
/*
* Here is the real check for the high bit being set.
* we can at least cast to signed so the IRIX compiler shuts up.
*/
times[0].tv_usec = times[1].tv_usec =
- (isc_int32_t)(isc_time_nanoseconds(time) / 1000);
+ (isc_int32_t)(isc_time_nanoseconds(itime) / 1000);
if (utimes(file, times) < 0)
return (isc__errno2result(errno));
# ifdef STRERROR_R_CHAR_P
/*
* For older GNU strerror_r, the return value either points to
- * buf, or to static storage. We want the result always in buf
+ * buf, or to static storage. We want the result always in buf.
+ * On Debian Linux 6.03 with gcc 4.4, strerror_r() returns an
+ * int despite configure detecting STRERROR_R_CHAR_P. We are
+ * careful with the result, but need to cast to (char *) to
+ * silence gcc on Debian 6.03.
*/
- pstatic = strerror_r(err, buf, bufsiz);
+ pstatic = (char *)strerror_r(err, buf, bufsiz);
# else
pstatic = strerror(err);
# endif
static UINTMAX_T myround(LDOUBLE);
static LDOUBLE mypow10(int);
-extern int errno;
-
int
rpl_vsnprintf(char *str, size_t size, const char *format, va_list args);
*/
#if !defined(HAVE_IO_COMPLETION_PORT)
static inline int read_network_packet (SOCKET, struct interface *, l_fp);
-static inline int read_refclock_packet (SOCKET, struct refclockio *, l_fp);
void ntpd_addremove_io_fd (int, int, int);
+#ifdef REFCLOCK
+static inline int read_refclock_packet (SOCKET, struct refclockio *, l_fp);
+#endif
#endif
return buffer;
}
+
+#ifdef REFCLOCK
/*
* Routine to read the refclock packets for a specific interface
* Return the number of bytes read. That way we know if we should
return buflen;
}
+#endif /* REFCLOCK */
#ifdef HAVE_TIMESTAMP
)
{
struct refclockproc * const pp = peer->procptr;
+#ifdef HAVE_PPSAPI
nmea_unit * const up = (nmea_unit *)pp->unitptr;
+#endif
/*
* Process median filter samples. If none received, declare a
#ifndef O_NOCTTY
#define O_NOCTTY 0
#endif
-
- fd232 = tty_open(parsedev, O_RDWR | O_NOCTTY
-#ifdef O_NONBLOCK
- | O_NONBLOCK
+#ifndef O_NONBLOCK
+#define O_NONBLOCK 0
#endif
- , 0777);
+
+ fd232 = tty_open(parsedev, O_RDWR | O_NOCTTY | O_NONBLOCK, 0777);
if (fd232 == -1)
{
* if the PARSEPPSDEVICE can be opened that will be used
* for PPS else PARSEDEVICE will be used
*/
- parse->ppsfd = tty_open(parseppsdev, O_RDWR | O_NOCTTY
-#ifdef O_NONBLOCK
- | O_NONBLOCK
-#endif
- , 0777);
+ parse->ppsfd = tty_open(parseppsdev, O_RDWR | O_NOCTTY | O_NONBLOCK, 0777);
if (parse->ppsfd == -1)
{
if (parse->parse_type->cl_event)
parse->parse_type->cl_event(parse, event);
-
+
if (event == CEVNT_NOMINAL)
{
NLOG(NLOG_CLOCKSTATUS)
l_fp off, rectime, reftime;
double fudge;
+ /* silence warning: 'off.Ul_i.Xl_i' may be used uninitialized in this function */
+ ZERO(off);
+
/*
* check for changes in conversion status
* (only one for each new status !)
register struct wwvbunit *up;
struct refclockproc *pp;
char pollchar; /* character sent to clock */
+#ifdef DEBUG
l_fp now;
+#endif
/*
* Time to poll the clock. The Spectracom clock responds to a