From d05caba0d07d0e35ca93b597dfdd35f9c596c7ee Mon Sep 17 00:00:00 2001 From: Matthew Newton Date: Sat, 20 Apr 2013 00:44:37 +0100 Subject: [PATCH] fixup DIAG_{ON,OFF} to get rid of compiler errors about not using #pragmas inside functions --- src/main/log.c | 4 ++-- src/main/radattr.c | 8 ++++---- src/main/valuepair.c | 4 ++-- src/modules/rlm_ldap/ldap.c | 8 ++++---- src/modules/rlm_perl/rlm_perl.c | 4 ++-- src/modules/rlm_sqlhpwippool/rlm_sqlhpwippool.c | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/log.c b/src/main/log.c index 0e6a499..2532dd9 100644 --- a/src/main/log.c +++ b/src/main/log.c @@ -78,6 +78,7 @@ int log_dates_utc = 0; * Log the message to the logfile. Include the severity and * a time stamp. */ +DIAG_OFF(format-nonliteral) int vradlog(int lvl, char const *fmt, va_list ap) { struct main_config_t *myconfig = &mainconfig; @@ -153,9 +154,7 @@ int vradlog(int lvl, char const *fmt, va_list ap) } if (len < sizeof(buffer)) { -DIAG_OFF(format-nonliteral) len += vsnprintf(buffer + len, sizeof(buffer) - len - 1, fmt, ap); -DIAG_ON(format-nonliteral) } /* @@ -223,6 +222,7 @@ DIAG_ON(format-nonliteral) return 0; } +DIAG_ON(format-nonliteral) int log_debug(char const *msg, ...) { diff --git a/src/main/radattr.c b/src/main/radattr.c index 4fae513..41abe20 100644 --- a/src/main/radattr.c +++ b/src/main/radattr.c @@ -59,31 +59,31 @@ int radius_get_vp(UNUSED REQUEST *request, UNUSED char const *name, UNUSED VALUE return 0; } +DIAG_OFF(format-nonliteral) void radlog_request(UNUSED int lvl, UNUSED int priority, UNUSED REQUEST *request, char const *msg, ...) { va_list ap; char buffer[256]; -DIAG_OFF(format-nonliteral) va_start(ap, msg); vsnprintf(buffer, sizeof(buffer), msg, ap); -DIAG_ON(format-nonliteral) va_end(ap); } +DIAG_ON(format-nonliteral) +DIAG_OFF(format-nonliteral) int radlog(UNUSED int lvl, char const *msg, ...) { va_list ap; char buffer[256]; va_start(ap, msg); -DIAG_OFF(format-nonliteral) vsnprintf(buffer, sizeof(buffer), msg, ap); -DIAG_ON(format-nonliteral) va_end(ap); return 0; } +DIAG_ON(format-nonliteral) static size_t xlat_test(UNUSED void *instance, UNUSED REQUEST *request, UNUSED char const *fmt, UNUSED char *out, UNUSED size_t outlen) diff --git a/src/main/valuepair.c b/src/main/valuepair.c index 3169452..ed6a443 100644 --- a/src/main/valuepair.c +++ b/src/main/valuepair.c @@ -1645,6 +1645,7 @@ int radius_get_vp(REQUEST *request, char const *name, VALUE_PAIR **vp_p) /** Add a module failure message VALUE_PAIR to the request */ +DIAG_OFF(format-nonliteral) void module_failure_msg(REQUEST *request, char const *fmt, ...) { size_t len; @@ -1660,8 +1661,7 @@ void module_failure_msg(REQUEST *request, char const *fmt, ...) len = snprintf(vp->vp_strvalue, sizeof(vp->vp_strvalue), "%s: ", request->module); -DIAG_OFF(format-nonliteral) vsnprintf(vp->vp_strvalue + len, sizeof(vp->vp_strvalue) - len, fmt, ap); -DIAG_ON(format-nonliteral) pairadd(&request->packet->vps, vp); } +DIAG_ON(format-nonliteral) diff --git a/src/modules/rlm_ldap/ldap.c b/src/modules/rlm_ldap/ldap.c index 376ba34..b38cf86 100644 --- a/src/modules/rlm_ldap/ldap.c +++ b/src/modules/rlm_ldap/ldap.c @@ -1012,6 +1012,8 @@ static int rlm_ldap_rebind(LDAP *handle, LDAP_CONST char *url, UNUSED ber_tag_t * @param instance rlm_ldap instance. * @return A new connection handle or NULL on error. */ +DIAG_OFF(implicit-function-declaration) +DIAG_OFF(nested-externs) void *mod_conn_create(void *instance) { ldap_rcode_t status; @@ -1116,11 +1118,7 @@ void *mod_conn_create(void *instance) maybe_ldap_option(LDAP_OPT_X_TLS_CACERTDIR, "cacertdir", inst->tls_cacertdir); # ifdef HAVE_LDAP_INT_TLS_CONFIG -DIAG_OFF(implicit-function-declaration) -DIAG_OFF(nested-externs) if (ldap_int_tls_config(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, inst->tls_require_cert) != LDAP_OPT_SUCCESS) { -DIAG_ON(nested-externs) -DIAG_ON(implicit-function-declaration) ldap_get_option(handle, LDAP_OPT_ERROR_NUMBER, &ldap_errno); LDAP_ERR("Could not set LDAP_OPT_X_TLS_REQUIRE_CERT option to %s: %s", inst->tls_require_cert, @@ -1175,6 +1173,8 @@ DIAG_ON(implicit-function-declaration) return NULL; } +DIAG_ON(nested-externs) +DIAG_ON(implicit-function-declaration) /** Close and delete a connection diff --git a/src/modules/rlm_perl/rlm_perl.c b/src/modules/rlm_perl/rlm_perl.c index d4a7054..e1598cf 100644 --- a/src/modules/rlm_perl/rlm_perl.c +++ b/src/modules/rlm_perl/rlm_perl.c @@ -187,9 +187,9 @@ static void rlm_perl_close_handles(void **handles) free(handles); } +DIAG_OFF(shadow) static void rlm_perl_destruct(PerlInterpreter *perl) { -DIAG_OFF(shadow) dTHXa(perl); PERL_SET_CONTEXT(perl); @@ -202,7 +202,6 @@ DIAG_OFF(shadow) { dTHXa(perl); } -DIAG_ON(shadow) /* * FIXME: This shouldn't happen * @@ -214,6 +213,7 @@ DIAG_ON(shadow) perl_destruct(perl); perl_free(perl); } +DIAG_ON(shadow) static void rlm_destroy_perl(PerlInterpreter *perl) { diff --git a/src/modules/rlm_sqlhpwippool/rlm_sqlhpwippool.c b/src/modules/rlm_sqlhpwippool/rlm_sqlhpwippool.c index 2859efe..5f13d23 100644 --- a/src/modules/rlm_sqlhpwippool/rlm_sqlhpwippool.c +++ b/src/modules/rlm_sqlhpwippool/rlm_sqlhpwippool.c @@ -102,13 +102,12 @@ static int nvp_log(unsigned int line, rlm_sqlhpwippool_t *data, int lvl, return r; } /* handy SQL query tool */ +DIAG_OFF(format-nonliteral) static int nvp_vquery(unsigned int line, rlm_sqlhpwippool_t *data, rlm_sql_handle_t *sqlsock, char const *fmt, va_list ap) { char query[MAX_QUERY_LEN]; -DIAG_OFF(format-nonliteral) vsnprintf(query, MAX_QUERY_LEN, fmt, ap); -DIAG_ON(format-nonliteral) if (rlm_sql_query(&sqlsock, data->sqlinst, query)) { nvp_log(__LINE__, data, L_ERR, "nvp_vquery(): query from line %u: %s", line, (char const *)(data->db->sql_error)(sqlsock, data->sqlinst->config)); @@ -117,6 +116,7 @@ DIAG_ON(format-nonliteral) return 1; } +DIAG_ON(format-nonliteral) /* wrapper around nvp_vquery */ static int nvp_query(unsigned int line, rlm_sqlhpwippool_t *data, -- 2.1.4