]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 2446] Quiet warnings from Oracle's Studio compiler
authorHarlan Stenn <stenn@ntp.org>
Thu, 1 Aug 2013 05:34:34 +0000 (01:34 -0400)
committerHarlan Stenn <stenn@ntp.org>
Thu, 1 Aug 2013 05:34:34 +0000 (01:34 -0400)
bk: 51f9f36aTnGgA2A4Yd7G8FVUJEvLnA

ChangeLog
include/ntp_stdlib.h
include/ntp_worker.h
include/ntpd.h
libntp/ntp_random.c
ntpd/refclock_oncore.c
sntp/libevent/minheap-internal.h

index 47f8f1757d6d81c0bbe94d954c68fb4be8dd0c1c..6cc7e19297bd89fdd542365b9263a17ae1866935 100644 (file)
--- 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 <stenn@ntp.org>
index 14024728511c4ac2e300dcf0a8221a978d19edcd..c0e9aad7bd44038ceb61065c30b0900aacb524be 100644 (file)
 #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 *);
index beca44f62022fa628da098958f616028177fd740..f7e8d5be70865d6451af9c2f60b4f06dad204a3c 100644 (file)
@@ -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;
 
 /*
index 90e4a7b449c08af16eb454ac5bab4aa0d5fa63a5..1d3cf85e67a2432eff1211c9eaab11b30d861fa4 100644 (file)
@@ -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);
index 4d133b6d0ff1062fbfe6e7a4b1115b02bd9a5e45..9765679a8a767ea8d2aca8cea9e560de4af6128d 100644 (file)
@@ -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);
 
index 91839c7d1e99339d5f923220195ad02d47a96d24..7faf7d74aaa0ece66e012bcda41293448ccdff65 100644 (file)
@@ -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 *);
index 24f19633f9612e2286227135a5047fbe6a6ea1d9..f35c1ee1ceed041773e18bb9ee6c1d7cf000680d 100644 (file)
@@ -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)