Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/httpd Don't check for __attribute__ being defined, i...



details:   https://anonhg.NetBSD.org/src/rev/670ab2e6d004
branches:  trunk
changeset: 768782:670ab2e6d004
user:      joerg <joerg%NetBSD.org@localhost>
date:      Sat Aug 27 15:33:59 2011 +0000

description:
Don't check for __attribute__ being defined, it won't. Check for GCC 3.x
or compatible and define BOZO_PRINTFLIKE / BOZO_DEAD. Fix fallout.

diffstat:

 libexec/httpd/bozohttpd.c   |  13 +++++--------
 libexec/httpd/bozohttpd.h   |  13 +++++++++----
 libexec/httpd/daemon-bozo.c |   4 ++--
 libexec/httpd/main.c        |   8 ++------
 libexec/httpd/ssl-bozo.c    |   4 ++--
 5 files changed, 20 insertions(+), 22 deletions(-)

diffs (136 lines):

diff -r a9ebba7abcd5 -r 670ab2e6d004 libexec/httpd/bozohttpd.c
--- a/libexec/httpd/bozohttpd.c Sat Aug 27 15:32:28 2011 +0000
+++ b/libexec/httpd/bozohttpd.c Sat Aug 27 15:33:59 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bozohttpd.c,v 1.27 2011/03/29 07:22:31 jmmv Exp $      */
+/*     $NetBSD: bozohttpd.c,v 1.28 2011/08/27 15:33:59 joerg Exp $     */
 
 /*     $eterna: bozohttpd.c,v 1.176 2010/09/20 22:26:28 mrg Exp $      */
 
@@ -154,10 +154,6 @@
 #include <time.h>
 #include <unistd.h>
 
-#ifndef __attribute__
-#define __attribute__(x)
-#endif /* __attribute__ */
-
 #include "bozohttpd.h"
 
 #ifndef MAX_WAIT_TIME
@@ -1412,9 +1408,10 @@
                request->hr_first_byte_pos = 0;
                request->hr_last_byte_pos = sb.st_size - 1;
        }
-       debug((httpd, DEBUG_FAT, "have_range %d first_pos %qd last_pos %qd",
+       debug((httpd, DEBUG_FAT, "have_range %d first_pos %lld last_pos %lld",
            request->hr_have_range,
-           request->hr_first_byte_pos, request->hr_last_byte_pos));
+           (long long)request->hr_first_byte_pos,
+           (long long)request->hr_last_byte_pos));
        if (request->hr_have_range)
                bozo_printf(httpd, "%s 206 Partial Content\r\n",
                                request->hr_proto);
@@ -1848,7 +1845,7 @@
 
        }
        httpd->getln_buffer[len] = '\0';
-       debug((httpd, DEBUG_OBESE, "bozodgetln returns: ``%s'' with len %d",
+       debug((httpd, DEBUG_OBESE, "bozodgetln returns: ``%s'' with len %zd",
               httpd->getln_buffer, len));
        *lenp = len;
        return httpd->getln_buffer;
diff -r a9ebba7abcd5 -r 670ab2e6d004 libexec/httpd/bozohttpd.h
--- a/libexec/httpd/bozohttpd.h Sat Aug 27 15:32:28 2011 +0000
+++ b/libexec/httpd/bozohttpd.h Sat Aug 27 15:33:59 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bozohttpd.h,v 1.18 2011/03/29 07:22:31 jmmv Exp $      */
+/*     $NetBSD: bozohttpd.h,v 1.19 2011/08/27 15:33:59 joerg Exp $     */
 
 /*     $eterna: bozohttpd.h,v 1.37 2010/09/20 22:26:28 mrg Exp $       */
 
@@ -172,11 +172,16 @@
 #define        debug(x)        
 #endif /* NO_DEBUG */
 
+#if defined(__GNUC__) && __GNUC__ >= 3
+#define BOZO_PRINTFLIKE(x,y) __attribute__((__format__(__printf__, x,y)))
+#define BOZO_DEAD __attribute__((__noreturn__))
+#endif
+
 void   bozo_warn(bozohttpd_t *, const char *, ...)
-               __attribute__((__format__(__printf__, 2, 3)));
+               BOZO_PRINTFLIKE(2, 3);
 void   bozo_err(bozohttpd_t *, int, const char *, ...)
-               __attribute__((__format__(__printf__, 3, 4)))
-               __attribute__((__noreturn__));
+               BOZO_PRINTFLIKE(3, 4)
+               BOZO_DEAD;
 int    bozo_http_error(bozohttpd_t *, int, bozo_httpreq_t *, const char *);
 
 int    bozo_check_special_files(bozo_httpreq_t *, const char *);
diff -r a9ebba7abcd5 -r 670ab2e6d004 libexec/httpd/daemon-bozo.c
--- a/libexec/httpd/daemon-bozo.c       Sat Aug 27 15:32:28 2011 +0000
+++ b/libexec/httpd/daemon-bozo.c       Sat Aug 27 15:33:59 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: daemon-bozo.c,v 1.13 2011/03/29 07:22:31 jmmv Exp $    */
+/*     $NetBSD: daemon-bozo.c,v 1.14 2011/08/27 15:33:59 joerg Exp $   */
 
 /*     $eterna: daemon-bozo.c,v 1.22 2010/06/21 06:45:45 mrg Exp $     */
 
@@ -77,7 +77,7 @@
 /* Signal handler to exit in a controlled manner.  This ensures that
  * any atexit(3) handlers are properly executed. */
 /* ARGSUSED */
-static void
+BOZO_DEAD static void
 controlled_exit(int signo)
 {
 
diff -r a9ebba7abcd5 -r 670ab2e6d004 libexec/httpd/main.c
--- a/libexec/httpd/main.c      Sat Aug 27 15:32:28 2011 +0000
+++ b/libexec/httpd/main.c      Sat Aug 27 15:33:59 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.2 2011/03/29 07:22:31 jmmv Exp $    */
+/*     $NetBSD: main.c,v 1.3 2011/08/27 15:33:59 joerg Exp $   */
 
 /*     $eterna: main.c,v 1.4 2010/07/11 00:34:28 mrg Exp $     */
 /* from: eterna: bozohttpd.c,v 1.159 2009/05/23 02:14:30 mrg Exp       */
@@ -47,10 +47,6 @@
 #include <time.h>
 #include <unistd.h>
 
-#ifndef __attribute__
-#define __attribute__(x)
-#endif /* __attribute__ */
-
 #include "bozohttpd.h"
 
 /* variables and functions */
@@ -59,7 +55,7 @@
 #endif
 
 /* print a usage message, and then exit */
-static void
+BOZO_DEAD static void
 usage(bozohttpd_t *httpd, char *progname)
 {
        bozo_warn(httpd, "usage: %s [options] slashdir [virtualhostname]",
diff -r a9ebba7abcd5 -r 670ab2e6d004 libexec/httpd/ssl-bozo.c
--- a/libexec/httpd/ssl-bozo.c  Sat Aug 27 15:32:28 2011 +0000
+++ b/libexec/httpd/ssl-bozo.c  Sat Aug 27 15:33:59 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ssl-bozo.c,v 1.11 2011/08/21 10:45:33 hannken Exp $    */
+/*     $NetBSD: ssl-bozo.c,v 1.12 2011/08/27 15:33:59 joerg Exp $      */
 
 /*     $eterna: ssl-bozo.c,v 1.13 2010/05/12 12:24:58 rtr Exp $        */
 
@@ -64,7 +64,7 @@
  * the error provided by the caller at the point of error it pops and
  * prints all errors from the SSL error queue.
  */
-static void
+BOZO_DEAD static void
 bozo_ssl_err(bozohttpd_t *httpd, int code, const char *fmt, ...)
 {
         va_list ap;



Home | Main Index | Thread Index | Old Index