httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Shahaf <danie...@elego.de>
Subject [PATCH] Eliminate warnings with C89 compilers
Date Tue, 21 Feb 2012 10:00:27 GMT
Subversion uses C89 by default, which doesn't defined __STDC_VERSION__.
(ap_config.h accomodates that explicitly.)  This causes a fair amount of
warnings, which the following patch should suppress.

(I'm working on the assumption that API consumers are allowed to write
their code in C89.)

[[[
Check that __STDC_VERSION__ is defined before using it, to accomodate
pre-C99 compilers.
]]]

[[[
Index: include/http_log.h
===================================================================
--- include/http_log.h	(revision 1291669)
+++ include/http_log.h	(working copy)
@@ -358,7 +358,7 @@
                               int level, apr_status_t status,
                               const server_rec *s, const char *fmt, ...);
 #else
-#if __STDC_VERSION__ >= 199901L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 /* need additional step to expand APLOG_MARK first */
 #define ap_log_error(...) ap_log_error__(__VA_ARGS__)
 /* need server_rec *sr = ... for the case if s is verbatim NULL */
@@ -401,7 +401,8 @@
                                int level, apr_status_t status, apr_pool_t *p,
                                const char *fmt, ...);
 #else
-#if __STDC_VERSION__ >= 199901L && defined(APLOG_MAX_LOGLEVEL)
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L \
+    && defined(APLOG_MAX_LOGLEVEL)
 /* need additional step to expand APLOG_MARK first */
 #define ap_log_perror(...) ap_log_perror__(__VA_ARGS__)
 #define ap_log_perror__(file, line, mi, level, status, p, ...)            \
@@ -443,7 +444,7 @@
                                int level, apr_status_t status,
                                const request_rec *r, const char *fmt, ...);
 #else
-#if __STDC_VERSION__ >= 199901L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 /* need additional step to expand APLOG_MARK first */
 #define ap_log_rerror(...) ap_log_rerror__(__VA_ARGS__)
 #define ap_log_rerror__(file, line, mi, level, status, r, ...)              \
@@ -487,7 +488,7 @@
                                int level, apr_status_t status,
                                const conn_rec *c, const char *fmt, ...);
 #else
-#if __STDC_VERSION__ >= 199901L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 /* need additional step to expand APLOG_MARK first */
 #define ap_log_cerror(...) ap_log_cerror__(__VA_ARGS__)
 #define ap_log_cerror__(file, line, mi, level, status, c, ...)              \
@@ -534,7 +535,7 @@
                                 const conn_rec *c, const server_rec *s,
                                 const char *fmt, ...);
 #else
-#if __STDC_VERSION__ >= 199901L
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 /* need additional step to expand APLOG_MARK first */
 #define ap_log_cserror(...) ap_log_cserror__(__VA_ARGS__)
 #define ap_log_cserror__(file, line, mi, level, status, c, s, ...)  \
]]]


Mime
View raw message