]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
GCC doesn't deal with multiple pragmas in the same line correctly
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 25 Jan 2021 23:36:15 +0000 (23:36 +0000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 25 Jan 2021 23:36:15 +0000 (23:36 +0000)
src/include/build.h
src/lib/curl/base.h
src/lib/curl/io.c
src/lib/json/base.h
src/lib/json/json_missing.h
src/lib/util/event.c
src/modules/rlm_mruby/rlm_mruby.c
src/modules/rlm_mruby/rlm_mruby.h
src/modules/rlm_perl/rlm_perl.c
src/modules/rlm_unbound/io.h
src/modules/rlm_unbound/log.h

index b45f749f47bc18b9e0250f6e4930f4322cb2d5d4..3e7c7c86afdeb34cdb3305731133f1d863e0df98 100644 (file)
@@ -168,38 +168,22 @@ extern "C" {
  *     Macros for controlling warnings in GCC >= 4.2 and clang >= 2.8
  */
 #if defined(__clang__) && ((__clang_major__ * 100) + __clang_minor__ >= 208)
+#  define DIAG_UNKNOWN_PRAGMAS unknown-pragmas
 #  define DIAG_PRAGMA(_x) PRAGMA(clang 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(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_UNKNOWN_PRAGMAS pragmas
 #  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)
-#  define DIAG_OFF_OPTIONAL(_x)
-#  define DIAG_ON_OPTIONAL(_x)
 #  define DIAG_PUSH()
 #  define DIAG_POP()
 #endif
index 1b71c6fa8da0da18ac63d6d9ade0331b0d5dd020..3d406eaf05f314edf2d6db762c5745e76aa9991e 100644 (file)
@@ -36,7 +36,9 @@ extern "C" {
 #include <freeradius-devel/util/event.h>
 #include <freeradius-devel/server/module.h>
 
-DIAG_OFF_OPTIONAL(disabled-macro-expansion)
+DIAG_OFF(DIAG_UNKNOWN_PRAGMAS)
+DIAG_OFF(disabled-macro-expansion)
+DIAG_ON(DIAG_UNKNOWN_PRAGMAS)
 #define FR_CURL_SET_OPTION(_x, _y)\
 do {\
        int _ret;\
index 14ab4da80f33d5ff520ae4e3eac220f327eb0504..d91e357427bbec0de1468b6ff2c91b7d1dc2c7f6 100644 (file)
@@ -32,7 +32,9 @@
  *
  *  #define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)
  */
-DIAG_OFF_OPTIONAL(disabled-macro-expansion)
+DIAG_OFF(DIAG_UNKNOWN_PRAGMAS)
+DIAG_OFF(disabled-macro-expansion)
+DIAG_ON(DIAG_UNKNOWN_PRAGMAS)
 #define SET_MOPTION(_mandle, _opt, _val)\
 do {\
        if ((ret = curl_multi_setopt(mandle, _opt, _val)) != CURLM_OK) {\
index 75a5906820893e2c02855e9f920a8c7a8b2c5d50..729fae87fe147122d0f0ca5d8807c0f288463d7a 100644 (file)
@@ -34,9 +34,11 @@ RCSIDH(json_h, "$Id$")
 #ifdef HAVE_JSON
 #  if defined(HAVE_JSONMC_JSON_H)
 
-DIAG_OFF_OPTIONAL(documentation-deprecated-sync)
+DIAG_OFF(DIAG_UNKNOWN_PRAGMAS)
+DIAG_OFF(documentation-deprecated-sync)
 #    include <json-c/json.h>
-DIAG_ON_OPTIONAL(documentation-deprecated-sync)
+DIAG_ON(documentation-deprecated-sync)
+DIAG_ON(DIAG_UNKNOWN_PRAGMAS)
 
 #  elif defined(HAVE_JSON_JSON_H)
 #    include <json/json.h>
index ae614b0bbd76e1e4ac415a3b313eff3b31231b6e..bf72ffd53e23efb19d8d08ac289c043e5fa94f13 100644 (file)
@@ -29,9 +29,11 @@ RCSIDH(jsonc_missing_h, "$Id$")
 #ifdef HAVE_JSON
 #  if defined(HAVE_JSONMC_JSON_H)
 
-DIAG_OFF_OPTIONAL(documentation-deprecated-sync)
+DIAG_OFF(DIAG_UNKNOWN_PRAGMAS)
+DIAG_OFF(documentation-deprecated-sync)
 #    include <json-c/json.h>
-DIAG_ON_OPTIONAL(documentation-deprecated-sync)
+DIAG_ON(documentation-deprecated-sync)
+DIAG_ON(DIAG_UNKNOWN_PRAGMAS)
 
 #  elif defined(HAVE_JSON_JSON_H)
 #    include <json/json.h>
index 1a6535226a4e3ac86f0ae359327bb7fb5fa59a65..deb41bd7f704b9805b5a88272827ab6ab5b8e195 100644 (file)
@@ -50,7 +50,9 @@ RCSID("$Id$")
  *     Turn off documentation warnings as file/line
  *     args aren't used for non-debug builds.
  */
-DIAG_OFF_OPTIONAL(documentation)
+DIAG_OFF(DIAG_UNKNOWN_PRAGMAS)
+DIAG_OFF(documentation)
+DIAG_ON(DIAG_UNKNOWN_PRAGMAS)
 #endif
 
 #define FR_EV_BATCH_FDS (256)
index 991b3c68ae74ce78186340189a08c98575043917..c2a230532a3e64e3aa938792257bd5310bc50d2b 100644 (file)
@@ -413,9 +413,11 @@ static unlang_action_t CC_HINT(nonnull) do_mruby(rlm_rcode_t *p_result, request_
        mruby_set_vps(request, mrb, mruby_request, "@control", &request->control_pairs);
        mruby_set_vps(request, mrb, mruby_request, "@session_state", &request->session_state_pairs);
 
-DIAG_OFF_OPTIONAL(class-varargs)
+DIAG_OFF(DIAG_UNKNOWN_PRAGMAS)
+DIAG_OFF(class-varargs)
        mruby_result = mrb_funcall(mrb, mrb_obj_value(inst->mruby_module), function_name, 1, mruby_request);
-DIAG_ON_OPTIONAL(class-varargs)
+DIAG_ON(class-varargs)
+DIAG_ON(DIAG_UNKNOWN_PRAGMAS)
 
        /* Two options for the return value:
         * - a fixnum: convert to rlm_rcode_t, and return that
index 0c067dcf171e17a8b01c738330385913b619e1a1..ec168fbfcf99314c1b08ae4a5a38f8b18e51fbd8 100644 (file)
@@ -23,7 +23,8 @@
  * @copyright 2016 The FreeRADIUS server project
  */
 
-DIAG_OFF_OPTIONAL(documentation)
+DIAG_OFF(DIAG_UNKNOWN_PRAGMAS)
+DIAG_OFF(documentation)
 #include <mruby.h>
 #include <mruby/compile.h>
 #include <mruby/array.h>
@@ -31,6 +32,7 @@ DIAG_OFF_OPTIONAL(documentation)
 #include <mruby/numeric.h>
 #include <mruby/string.h>
 #include <mruby/variable.h>
-DIAG_ON_OPTIONAL(documentation)
+DIAG_ON(documentation)
+DIAG_ON(DIAG_UNKNOWN_PRAGMAS)
 
 struct RClass *mruby_request_class(mrb_state *mrb, struct RClass *parent);
index 8cabde4fbfa755fd586492fbea41361129b26e4d..10783e4b19bde5ce9e0f5ddef45c92ac418b786d 100644 (file)
@@ -197,7 +197,8 @@ static void rlm_perl_close_handles(void **handles)
        talloc_free(handles);
 }
 
-DIAG_OFF_OPTIONAL(shadow)
+DIAG_OFF(DIAG_UNKNOWN_PRAGMAS)
+DIAG_OFF(shadow)
 static void rlm_perl_destruct(PerlInterpreter *perl)
 {
        dTHXa(perl);
@@ -223,7 +224,8 @@ static void rlm_perl_destruct(PerlInterpreter *perl)
        perl_destruct(perl);
        perl_free(perl);
 }
-DIAG_ON_OPTIONAL(shadow)
+DIAG_ON(shadow)
+DIAG_ON(DIAG_UNKNOWN_PRAGMAS)
 
 static void rlm_destroy_perl(PerlInterpreter *perl)
 {
index bbfb49ac3b53f07e1fe596628b468cea3b9e5699..3756341a79a76af3a53339ca462ccead8daba565 100644 (file)
@@ -30,10 +30,12 @@ RCSIDH(rlm_unbound_io_h, "$Id$")
 extern "C" {
 #endif
 
-DIAG_OFF_OPTIONAL(documentation)
+DIAG_OFF(DIAG_UNKNOWN_PRAGMAS)
+DIAG_OFF(documentation)
 #include <unbound.h>
 #include <unbound-event.h>
-DIAG_ON_OPTIONAL(documentation)
+DIAG_ON(documentation)
+DIAG_ON(DIAG_UNKNOWN_PRAGMAS)
 
 /** Wrapper around our event loop specifying callbacks for creating new event handles
  *
index 0643d1fceaba3a31170f9e75c84b5d2ae3a6028b..2aed20f8305084395e316ccd319a841ca261ac9e 100644 (file)
@@ -32,9 +32,11 @@ extern "C" {
 
 #include <freeradius-devel/server/request.h>
 
-DIAG_OFF_OPTIONAL(documentation)
+DIAG_OFF(DIAG_UNKNOWN_PRAGMAS)
+DIAG_OFF(documentation)
 #include <unbound.h>
-DIAG_ON_OPTIONAL(documentation)
+DIAG_ON(documentation)
+DIAG_ON(DIAG_UNKNOWN_PRAGMAS)
 
 /** Logging state
  *