From: Harlan Stenn Date: Thu, 1 Aug 2013 05:34:34 +0000 (-0400) Subject: [Bug 2446] Quiet warnings from Oracle's Studio compiler X-Git-Tag: NTP_4_2_7P378~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de4ae10a52e6f4f7095e7dab4d58f5ea4a7ae962;p=thirdparty%2Fntp.git [Bug 2446] Quiet warnings from Oracle's Studio compiler bk: 51f9f36aTnGgA2A4Yd7G8FVUJEvLnA --- diff --git a/ChangeLog b/ChangeLog index 47f8f1757..6cc7e1929 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ * [Bug 2425] move part of input handler code from ntpd.c to ntp_io.c and fix select()-only platforms calling input_handler directly. +* [Bug 2446] Quiet warnings from Oracle's Studio compiler. * Upgrade to AutoGen-5.18.1pre3 * Upgrade to libopts-40.1.15. (4.2.7p377) 2013/07/28 Released by Harlan Stenn diff --git a/include/ntp_stdlib.h b/include/ntp_stdlib.h index 140247285..c0e9aad7b 100644 --- a/include/ntp_stdlib.h +++ b/include/ntp_stdlib.h @@ -17,19 +17,20 @@ #include "ntp_string.h" #include "ntp_syslog.h" +#ifdef __GNUC__ +#define NTP_PRINTF(fmt, args) __attribute__((__format__(__printf__, fmt, args))) +#else +#define NTP_PRINTF(fmt, args) +#endif -extern int mprintf(const char *, ...) - __attribute__((__format__(__printf__, 1, 2))); -extern int mfprintf(FILE *, const char *, ...) - __attribute__((__format__(__printf__, 2, 3))); -extern int mvfprintf(FILE *, const char *, va_list) - __attribute__((__format__(__printf__, 2, 0))); +extern int mprintf(const char *, ...) NTP_PRINTF(1, 2); +extern int mfprintf(FILE *, const char *, ...) NTP_PRINTF(2, 3); +extern int mvfprintf(FILE *, const char *, va_list) NTP_PRINTF(2, 0); extern int mvsnprintf(char *, size_t, const char *, va_list) - __attribute__((__format__(__printf__, 3, 0))); + NTP_PRINTF(3, 0); extern int msnprintf(char *, size_t, const char *, ...) - __attribute__((__format__(__printf__, 3, 4))); -extern void msyslog(int, const char *, ...) - __attribute__((__format__(__printf__, 2, 3))); + NTP_PRINTF(3, 4); +extern void msyslog(int, const char *, ...) NTP_PRINTF(2, 3); extern void init_logging (const char *, u_int32, int); extern int change_logfile (const char *, int); extern void setup_logfile (const char *); diff --git a/include/ntp_worker.h b/include/ntp_worker.h index beca44f62..f7e8d5be7 100644 --- a/include/ntp_worker.h +++ b/include/ntp_worker.h @@ -25,8 +25,8 @@ typedef enum blocking_work_req_tag { typedef void (*blocking_work_callback)(blocking_work_req, void *, size_t, void *); typedef enum blocking_magic_sig_e { - BLOCKING_REQ_MAGIC = 0xb10c7ecf, - BLOCKING_RESP_MAGIC = 0xb10c7e54, + BLOCKING_REQ_MAGIC = 0x510c7ecf, + BLOCKING_RESP_MAGIC = 0x510c7e54, } blocking_magic_sig; /* diff --git a/include/ntpd.h b/include/ntpd.h index 90e4a7b44..1d3cf85e6 100644 --- a/include/ntpd.h +++ b/include/ntpd.h @@ -68,7 +68,7 @@ extern void init_control (void); extern void process_control (struct recvbuf *, int); extern void report_event (int, struct peer *, const char *); extern int mprintf_event (int, struct peer *, const char *, ...) - __attribute__((__format__(__printf__, 3, 4))); + NTP_PRINTF(3, 4); /* ntp_control.c */ /* @@ -285,7 +285,7 @@ extern void record_proto_stats (char *); extern void record_loop_stats (double, double, double, double, int); extern void record_clock_stats (sockaddr_u *, const char *); extern int mprintf_clock_stats(sockaddr_u *, const char *, ...) - __attribute__((__format__(__printf__, 2, 3))); + NTP_PRINTF(2, 3); extern void record_raw_stats (sockaddr_u *srcadr, sockaddr_u *dstadr, l_fp *t1, l_fp *t2, l_fp *t3, l_fp *t4, int leap, int version, int mode, int stratum, int poll, int precision, double root_delay, double root_dispersion, u_int32 refid); extern void check_leap_file (void); extern u_long leap_month(u_long); diff --git a/libntp/ntp_random.c b/libntp/ntp_random.c index 4d133b6d0..9765679a8 100644 --- a/libntp/ntp_random.c +++ b/libntp/ntp_random.c @@ -156,7 +156,7 @@ static char sccsid[] = "@(#)random.c 8.2 (Berkeley) 5/19/95"; * MAX_TYPES * (rptr - state) + TYPE_3 == TYPE_3. */ -static long randtbl[DEG_3 + 1] = { +static unsigned long randtbl[DEG_3 + 1] = { TYPE_3, #ifdef USE_WEAK_SEEDING /* Historic implementation compatibility */ @@ -191,8 +191,8 @@ static long randtbl[DEG_3 + 1] = { * in the initialization of randtbl) because the state table pointer is set * to point to randtbl[1] (as explained below). */ -static long *fptr = &randtbl[SEP_3 + 1]; -static long *rptr = &randtbl[1]; +static long *fptr = (long *)&randtbl[SEP_3 + 1]; +static long *rptr = (long *)&randtbl[1]; /* * The following things are the pointer to the state information table, the @@ -204,11 +204,11 @@ static long *rptr = &randtbl[1]; * this is more efficient than indexing every time to find the address of * the last element to see if the front and rear pointers have wrapped. */ -static long *state = &randtbl[1]; +static long *state = (long *)&randtbl[1]; static long rand_type = TYPE_3; static long rand_deg = DEG_3; static long rand_sep = SEP_3; -static long *end_ptr = &randtbl[DEG_3 + 1]; +static long *end_ptr = (long *)&randtbl[DEG_3 + 1]; static inline long good_rand (long); diff --git a/ntpd/refclock_oncore.c b/ntpd/refclock_oncore.c index 91839c7d1..7faf7d74a 100644 --- a/ntpd/refclock_oncore.c +++ b/ntpd/refclock_oncore.c @@ -378,7 +378,7 @@ static void oncore_compute_dH (struct instance *); static void oncore_load_almanac (struct instance *); static void oncore_log (struct instance *, int, const char *); static int oncore_log_f (struct instance *, int, const char *, ...) - __attribute__((__format__(__printf__, 3, 4))); + NTP_PRINTF(3, 4); static void oncore_print_Cb (struct instance *, u_char *); /* static void oncore_print_array (u_char *, int); */ static void oncore_print_posn (struct instance *); diff --git a/sntp/libevent/minheap-internal.h b/sntp/libevent/minheap-internal.h index 24f19633f..f35c1ee1c 100644 --- a/sntp/libevent/minheap-internal.h +++ b/sntp/libevent/minheap-internal.h @@ -126,9 +126,8 @@ int min_heap_adjust_(min_heap_t *s, struct event *e) min_heap_shift_up_unconditional_(s, e->ev_timeout_pos.min_heap_idx, e); else min_heap_shift_down_(s, e->ev_timeout_pos.min_heap_idx, e); - return 0; } - return -1; + return 0; } int min_heap_reserve_(min_heap_t* s, unsigned n)