On 06/09/2010 10:00 PM, Stefan Fritsch wrote: > On Wed, 9 Jun 2010, Ruediger Pluem wrote:
>> >> +#if __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, >> ...) \ >> + do { if ((level) <= APLOG_MAX_LOGLEVEL >> ) \ >> + ap_do_log_perror(file, line, mi, level, status, >> p, \ >> + __VA_ARGS__); } while(0) >> +#else >> +#define ap_log_perror ap_log_perror_ >> +#endif >> +AP_DECLARE(void) ap_log_perror_(const char *file, int line, int >> module_index, >> + int level, apr_status_t status, >> apr_pool_t *p, >> + const char *fmt, ...) >> + __attribute__((format(printf,7,8))); >> >> >> I am still confused then. >> Why having AP_DECLARE(void) ap_log_perror_ then? >> Why define ap_log_perror to ap_log_perror_ on non C99 compilers then? >> ap_do_log_perror only shows up in the definition of ap_log_perror__ >> nowhere else. >> What does it do? > > It allows (with C99 compilers) to remove debug/trace logging at compile > time by defining APLOG_MAX_LOGLEVEL. The other ap_log_*error functions > allow the same. > > Sorry for be a PITN, but if APLOG_MAX_LOGLEVEL is defined on a C99 environment this results is the following: config.c: In function 'ap_process_config_tree': config.c:1871: warning: implicit declaration of function 'ap_do_log_perror' log.c: In function 'ap_log_pid': log.c:892: warning: implicit declaration of function 'ap_do_log_perror' util.c: In function 'ap_get_local_host': util.c:2009: warning: implicit declaration of function 'ap_do_log_perror' listen.c: In function 'make_sock': listen.c:57: warning: implicit declaration of function 'ap_do_log_perror' core.c: In function 'set_document_root': core.c:1215: warning: implicit declaration of function 'ap_do_log_perror' mod_so.c: In function 'load_module': mod_so.c:186: warning: implicit declaration of function 'ap_do_log_perror' http_protocol.c: In function 'ap_method_register': http_protocol.c:500: warning: implicit declaration of function 'ap_do_log_perror' server/.libs/libmain.a(log.o): In function `ap_log_pid': /usr/src/apache/httpd-trunk/server/log.c:892: undefined reference to `ap_do_log_perror' server/.libs/libmain.a(listen.o): In function `alloc_listener': /usr/src/apache/httpd-trunk/server/listen.c:284: undefined reference to `ap_do_log_perror' /usr/src/apache/httpd-trunk/server/listen.c:322: undefined reference to `ap_do_log_perror' server/.libs/libmain.a(listen.o): In function `ap_apply_accept_filter': /usr/src/apache/httpd-trunk/server/listen.c:225: undefined reference to `ap_do_log_perror' server/.libs/libmain.a(listen.o): In function `make_sock': /usr/src/apache/httpd-trunk/server/listen.c:57: undefined reference to `ap_do_log_perror' server/.libs/libmain.a(listen.o):/usr/src/apache/httpd-trunk/server/listen.c:67: more undefined references to `ap_do_log_perror' follow collect2: ld returned 1 exit status make[1]: *** [httpd] Fehler 1 make: *** [all-recursive] Fehler 1 Regards RĂ¼diger