/*
* Macros for controlling warnings in GCC >= 4.2 and clang >= 2.8
*/
-#if defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402
-# define DIAG_PRAGMA(_x) PRAGMA(GCC diagnostic _x)
-# if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
-# define DIAG_OFF(_x) DIAG_PRAGMA(push) DIAG_PRAGMA(ignored JOINSTR(-W,_x))
-# define DIAG_ON(_x) DIAG_PRAGMA(pop)
-# else
-# define DIAG_OFF(_x) DIAG_PRAGMA(ignored JOINSTR(-W,_x))
-# define DIAG_ON(_x) DIAG_PRAGMA(warning JOINSTR(-W,_x))
-# endif
-#elif defined(__clang__) && ((__clang_major__ * 100) + __clang_minor__ >= 208)
+#if defined(__clang__) && ((__clang_major__ * 100) + __clang_minor__ >= 208)
# define DIAG_PRAGMA(_x) PRAGMA(clang diagnostic _x)
-# define DIAG_OFF(_x) DIAG_PRAGMA(push) DIAG_PRAGMA(ignored JOINSTR(-W,_x))
-# define DIAG_ON(_x) DIAG_PRAGMA(pop)
+# define DIAG_OFF(_x) DIAG_PRAGMA(ignored JOINSTR(-W,_x))
+# define DIAG_ON(_x) DIAG_PRAGMA(warning JOINSTR(-W,_x))
+# define DIAG_OFF_OPTIONAL(_x) \
+ DIAG_OFF(ignored unknown-pragmas) \
+ DIAG_OFF(_x) \
+ DIAG_ON(warning unknown-pragmas)
+# define DIAG_ON_OPTIONAL(_x) \
+ DIAG_OFF(unknown-pragmas) \
+ DIAG_ON(_x) \
+ DIAG_ON(unknown-pragmas)
+# define DIAG_PUSH() DIAG_PRAGMA(push)
+# define DIAG_POP() DIAG_PRAGMA(pop)
+#elif !defined(__clang__) && defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402
+# define DIAG_PRAGMA(_x) PRAGMA(GCC diagnostic _x)
+# define DIAG_OFF(_x) DIAG_PRAGMA(ignored JOINSTR(-W,_x))
+# define DIAG_ON(_x) DIAG_PRAGMA(warning JOINSTR(-W,_x))
+# define DIAG_OFF_OPTIONAL(_x) \
+ DIAG_OFF(pragmas) \
+ DIAG_OFF(_x) \
+ DIAG_ON(pragmas)
+# define DIAG_ON_OPTIONAL(_x) \
+ DIAG_OFF(pragmas)
+ DIAG_ON(_x) \
+ DIAG_ON(pragmas)
+# define DIAG_PUSH() DIAG_PRAGMA(push)
+# define DIAG_POP() DIAG_PRAGMA(pop)
#else
# define DIAG_OFF(_x)
# define DIAG_ON(_x)
-#endif
-
-/*
- * GCC and clang use different macros
- */
-#ifdef __clang__
-# define DIAG_OPTIONAL DIAG_OFF(unknown-pragmas)
-#else
-# define DIAG_OPTIONAL DIAG_OFF(pragmas)
+# define DIAG_OFF_OPTIONAL(_x)
+# define DIAG_ON_OPTIONAL(_x)
+# define DIAG_PUSH()
+# define DIAG_POP()
#endif
/*
#include <freeradius-devel/util/event.h>
#include <freeradius-devel/server/module.h>
-DIAG_OPTIONAL
-DIAG_OFF(disabled-macro-expansion)
+DIAG_OFF_OPTIONAL(disabled-macro-expansion)
#define FR_CURL_SET_OPTION(_x, _y)\
do {\
int _ret;\
} while (0)
/*
- *␉·····We have to use this as curl uses lots of enums
+ * We have to use this as curl uses lots of enums
*/
#ifndef CURL_AT_LEAST_VERSION
# define CURL_VERSION_BITS(x, y, z) ((x) << 16 | (y) << 8 | (z))
*
* #define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)
*/
-DIAG_OPTIONAL
-DIAG_OFF(disabled-macro-expansion)
+DIAG_OFF_OPTIONAL(disabled-macro-expansion)
#define SET_MOPTION(_mandle, _opt, _val)\
do {\
if ((ret = curl_multi_setopt(mandle, _opt, _val)) != CURLM_OK) {\
#ifdef HAVE_JSON
# if defined(HAVE_JSONMC_JSON_H)
-#ifdef __clang__
-DIAG_OFF(documentation-deprecated-sync)
-#endif
+DIAG_OFF_OPTIONAL(documentation-deprecated-sync)
# include <json-c/json.h>
-
-#ifdef __clang__
-DIAG_ON(documentation-deprecated-sync)
-#endif
+DIAG_ON_OPTIONAL(documentation-deprecated-sync)
# elif defined(HAVE_JSON_JSON_H)
# include <json/json.h>
#ifdef HAVE_JSON
# if defined(HAVE_JSONMC_JSON_H)
-#ifdef __clang__
-DIAG_OFF(documentation-deprecated-sync)
-#endif
+DIAG_OFF_OPTIONAL(documentation-deprecated-sync)
# include <json-c/json.h>
-#ifdef __clang__
-DIAG_ON(documentation-deprecated-sync)
-#endif
+DIAG_ON_OPTIONAL(documentation-deprecated-sync)
# elif defined(HAVE_JSON_JSON_H)
# include <json/json.h>
* the floats are equal on a *bit* level, not on a *semantic*
* level.
*/
-DIAG_OFF(float-equal)
-
#define TEST_CHECK_LEN(_got, _exp) \
do { \
size_t _our_got = (_got); \
* Turn off documentation warnings as file/line
* args aren't used for non-debug builds.
*/
-DIAG_OPTIONAL
-DIAG_OFF(documentation)
+DIAG_OFF_OPTIONAL(documentation)
#endif
#define FR_EV_BATCH_FDS (256)
mruby_set_vps(request, mrb, mruby_request, "@control", &request->control_pairs);
mruby_set_vps(request, mrb, mruby_request, "@session_state", &request->session_state_pairs);
-#ifdef __clang__
-DIAG_OFF(class-varargs)
-#endif
+DIAG_OFF_OPTIONAL(class-varargs)
mruby_result = mrb_funcall(mrb, mrb_obj_value(inst->mruby_module), function_name, 1, mruby_request);
-#ifdef __clang__
-DIAG_ON(class-varargs)
-#endif
+DIAG_ON_OPTIONAL(class-varargs)
/* Two options for the return value:
* - a fixnum: convert to rlm_rcode_t, and return that
* @copyright 2016 The FreeRADIUS server project
*/
-#ifdef HAVE_WDOCUMENTATION
-DIAG_OFF(documentation)
-#endif
+DIAG_OFF_OPTIONAL(documentation)
#include <mruby.h>
#include <mruby/compile.h>
#include <mruby/array.h>
#include <mruby/numeric.h>
#include <mruby/string.h>
#include <mruby/variable.h>
-#ifdef HAVE_WDOCUMENTATION
-DIAG_ON(documentation)
-#endif
+DIAG_ON_OPTIONAL(documentation)
struct RClass *mruby_request_class(mrb_state *mrb, struct RClass *parent);
talloc_free(handles);
}
-DIAG_OFF(shadow)
+DIAG_OFF_OPTIONAL(shadow)
static void rlm_perl_destruct(PerlInterpreter *perl)
{
dTHXa(perl);
perl_destruct(perl);
perl_free(perl);
}
-DIAG_ON(shadow)
+DIAG_ON_OPTIONAL(shadow)
static void rlm_destroy_perl(PerlInterpreter *perl)
{
*
* #define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)
*/
-DIAG_OPTIONAL
-DIAG_OFF(disabled-macro-expansion)
-
const unsigned long http_curl_auth[REST_HTTP_AUTH_NUM_ENTRIES] = {
[REST_HTTP_AUTH_UNKNOWN] = 0,
[REST_HTTP_AUTH_NONE] = 0,
extern "C" {
#endif
-#ifdef HAVE_WDOCUMENTATION
-DIAG_OFF(documentation)
-#endif
+DIAG_OFF_OPTIONAL(documentation)
#include <unbound.h>
#include <unbound-event.h>
-#ifdef HAVE_WDOCUMENTATION
-DIAG_ON(documentation)
-#endif
+DIAG_ON_OPTIONAL(documentation)
/** Wrapper around our event loop specifying callbacks for creating new event handles
*
#include <freeradius-devel/server/request.h>
-#ifdef HAVE_WDOCUMENTATION
-DIAG_OFF(documentation)
-#endif
+DIAG_OFF_OPTIONAL(documentation)
#include <unbound.h>
-#ifdef HAVE_WDOCUMENTATION
-DIAG_ON(documentation)
-#endif
+DIAG_ON_OPTIONAL(documentation)
/** Logging state
*
*/
typedef struct {
- request_t *request; //!< Request we're logging to.
+ request_t *request; //!< Request we're logging to.
FILE *stream; //!< Stream we use to interface with the
///< FreeRADIUS logging functions.
} unbound_log_t;