Klaus Demo nginx / 802bc23
try to use C99 variadic macros first: AIX 5.3's XL C has problems with GCC style variadic macros Igor Sysoev 12 years ago
2 changed file(s) with 30 addition(s) and 30 deletion(s). Raw diff Collapse all Expand all
142142 . auto/feature
143143
144144
145 ngx_feature="gcc variadic macros"
146 ngx_feature_name="NGX_HAVE_GCC_VARIADIC_MACROS"
147 ngx_feature_run=yes
148 ngx_feature_incs="#include <stdio.h>
149 #define var(dummy, args...) sprintf(args)"
150 ngx_feature_path=
151 ngx_feature_libs=
152 ngx_feature_test="char buf[30]; buf[0] = '0';
153 var(0, buf, \"%d\", 1);
154 if (buf[0] != '1') return 1"
155 . auto/feature
156
157
158145 if [ "$NGX_CC_NAME" = "ccc" ]; then
159146 echo "checking for C99 variadic macros ... disabled"
160147 else
172159 fi
173160
174161
162 ngx_feature="gcc variadic macros"
163 ngx_feature_name="NGX_HAVE_GCC_VARIADIC_MACROS"
164 ngx_feature_run=yes
165 ngx_feature_incs="#include <stdio.h>
166 #define var(dummy, args...) sprintf(args)"
167 ngx_feature_path=
168 ngx_feature_libs=
169 ngx_feature_test="char buf[30]; buf[0] = '0';
170 var(0, buf, \"%d\", 1);
171 if (buf[0] != '1') return 1"
172 . auto/feature
173
174
175175 # ngx_feature="inline"
176176 # ngx_feature_name=
177177 # ngx_feature_run=no
6767
6868 /*********************************/
6969
70 #if (NGX_HAVE_GCC_VARIADIC_MACROS)
70 #if (NGX_HAVE_C99_VARIADIC_MACROS)
71
72 #define NGX_HAVE_VARIADIC_MACROS 1
73
74 #define ngx_log_error(level, log, ...) \
75 if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
76
77 void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
78 const char *fmt, ...);
79
80 #define ngx_log_debug(level, log, ...) \
81 if ((log)->log_level & level) \
82 ngx_log_error_core(NGX_LOG_DEBUG, log, __VA_ARGS__)
83
84 /*********************************/
85
86 #elif (NGX_HAVE_GCC_VARIADIC_MACROS)
7187
7288 #define NGX_HAVE_VARIADIC_MACROS 1
7389
8096 #define ngx_log_debug(level, log, args...) \
8197 if ((log)->log_level & level) \
8298 ngx_log_error_core(NGX_LOG_DEBUG, log, args)
83
84 /*********************************/
85
86 #elif (NGX_HAVE_C99_VARIADIC_MACROS)
87
88 #define NGX_HAVE_VARIADIC_MACROS 1
89
90 #define ngx_log_error(level, log, ...) \
91 if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
92
93 void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
94 const char *fmt, ...);
95
96 #define ngx_log_debug(level, log, ...) \
97 if ((log)->log_level & level) \
98 ngx_log_error_core(NGX_LOG_DEBUG, log, __VA_ARGS__)
9999
100100 /*********************************/
101101