Commit 16ac66dfbf for frr
commit 16ac66dfbf054df2cb3508e340155f1147f0ac0e
Author: Jafar Al-Gharaibeh <jafar@atcorp.com>
Date: Tue Nov 10 13:27:37 2026 -0600
lib, mgmtd, pathd: avoid _DEPRECATED clash with libyang 6
libyang's ly_config.h defines a no-argument _DEPRECATED, and
compiler.h already defines _DEPRECATED(x). clang -Wmacro-redefined
fires on every file that includes libyang:
ly_config.h:56:10: warning: '_DEPRECATED' macro redefined [-Wmacro-redefined]
Hide ours across the libyang includes and restore it afterwards.
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
diff --git a/lib/yang.h b/lib/yang.h
index 652df9a64e..5293c8ce30 100644
--- a/lib/yang.h
+++ b/lib/yang.h
@@ -9,8 +9,11 @@
#include "memory.h"
+#pragma push_macro("_DEPRECATED")
+#undef _DEPRECATED
#include <libyang/libyang.h>
#include <libyang/version.h>
+#pragma pop_macro("_DEPRECATED")
#ifdef HAVE_SYSREPO
#include <sysrepo.h>
#endif
diff --git a/lib/yang_wrappers.h b/lib/yang_wrappers.h
index c32aa86768..84f347b311 100644
--- a/lib/yang_wrappers.h
+++ b/lib/yang_wrappers.h
@@ -7,7 +7,10 @@
#ifndef _FRR_NORTHBOUND_WRAPPERS_H_
#define _FRR_NORTHBOUND_WRAPPERS_H_
+#pragma push_macro("_DEPRECATED")
+#undef _DEPRECATED
#include <libyang/libyang.h>
+#pragma pop_macro("_DEPRECATED")
#include "prefix.h"
#ifdef __cplusplus
diff --git a/mgmtd/mgmt_ds.c b/mgmtd/mgmt_ds.c
index 901f952e92..c5d4e83746 100644
--- a/mgmtd/mgmt_ds.c
+++ b/mgmtd/mgmt_ds.c
@@ -13,7 +13,6 @@
#include "mgmtd/mgmt_ds.h"
#include "mgmtd/mgmt_history.h"
#include "mgmtd/mgmt_txn.h"
-#include "libyang/libyang.h"
#define _dbg(fmt, ...) DEBUGD(&mgmt_debug_ds, "DS: %s: " fmt, __func__, ##__VA_ARGS__)
#define _log_warn(fmt, ...) zlog_warn("%s: ERROR: " fmt, __func__, ##__VA_ARGS__)
diff --git a/mgmtd/mgmt_vty_frontend.c b/mgmtd/mgmt_vty_frontend.c
index dffb3b4726..c1e787ea58 100644
--- a/mgmtd/mgmt_vty_frontend.c
+++ b/mgmtd/mgmt_vty_frontend.c
@@ -7,8 +7,6 @@
*/
#include <zebra.h>
-#include <libyang/libyang.h>
-#include <libyang/version.h>
#include "lib/debug.h"
#include "lib/command.h"
#include "lib/lib_vty.h"
diff --git a/pathd/path_debug.c b/pathd/path_debug.c
index cae212d9ca..e501174c0a 100644
--- a/pathd/path_debug.c
+++ b/pathd/path_debug.c
@@ -8,7 +8,6 @@
#include <string.h>
#include <stdbool.h>
#include <time.h>
-#include <libyang/libyang.h>
#include "printfrr.h"
#include "ipaddr.h"
diff --git a/pathd/path_pcep_debug.c b/pathd/path_pcep_debug.c
index 6b53ce3645..afe7d4788f 100644
--- a/pathd/path_pcep_debug.c
+++ b/pathd/path_pcep_debug.c
@@ -8,7 +8,6 @@
#include <string.h>
#include <stdbool.h>
#include <time.h>
-#include <libyang/libyang.h>
#include "printfrr.h"
#include "ipaddr.h"