]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
utils/ovs/ovs.c: __FUNCTION__ -> __func__ (C99)
authorEero Tamminen <eero.t.tamminen@intel.com>
Fri, 19 Jan 2024 10:42:42 +0000 (12:42 +0200)
committerEero Tamminen <eero.t.tamminen@intel.com>
Tue, 30 Jan 2024 10:32:52 +0000 (12:32 +0200)
Fixes -Wpedantic warnings.

Collectd requires C99 support, and __func__ is supported since GCC 2.95 / C99.

Btw. For C++ code, the issue would be murkier. C++11 added __func__
support, but one cannot check just C++ version because MSVC reported
older spec until recently:
- https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/

More info on latter:
- https://stackoverflow.com/questions/7008485/func-or-function-or-manual-const-char-id
- https://learn.microsoft.com/en-us/cpp/cpp/func?view=msvc-170 +

Signed-off-by: Eero Tamminen <eero.t.tamminen@intel.com>
src/utils/ovs/ovs.c

index e991a43528dae4a01d9ef273ffe2397ad6793504..4dd3232b30913f6c3ad501ef803705d525f42fea 100644 (file)
@@ -97,8 +97,7 @@
   } while (0)
 #define OVS_DEBUG(fmt, ...)                                                    \
   do {                                                                         \
-    DEBUG("%s:%d:%s(): " fmt, __FILE__, __LINE__, __FUNCTION__,                \
-          ##__VA_ARGS__);                                                      \
+    DEBUG("%s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, ##__VA_ARGS__);    \
   } while (0)
 
 #define OVS_DB_POLL_TIMEOUT 1           /* poll receive timeout (sec) */
@@ -368,14 +367,14 @@ static yajl_gen_status ovs_yajl_gen_val(yajl_gen jgen, yajl_val jval) {
     }
     OVS_YAJL_CALL(yajl_gen_map_close, jgen);
   } else {
-    OVS_ERROR("%s() unsupported value type %d (skip)", __FUNCTION__,
+    OVS_ERROR("%s() unsupported value type %d (skip)", __func__,
               (int)(jval)->type);
     goto yajl_gen_failure;
   }
   return yajl_gen_status_ok;
 
 yajl_gen_failure:
-  OVS_ERROR("%s() error to generate value", __FUNCTION__);
+  OVS_ERROR("%s() error to generate value", __func__);
   return yajl_gen_ret;
 }
 
@@ -1144,7 +1143,7 @@ int ovs_db_send_request(ovs_db_t *pdb, const char *method, const char *params,
       clock_gettime(CLOCK_REALTIME, &ts);
       ts.tv_sec += OVS_DB_SEND_REQ_TIMEOUT;
       if (sem_timedwait(&new_cb->result.sync, &ts) < 0) {
-        OVS_ERROR("%s() no replay received within %d sec", __FUNCTION__,
+        OVS_ERROR("%s() no replay received within %d sec", __func__,
                   OVS_DB_SEND_REQ_TIMEOUT);
         ret = (-1);
       }