From b7d05e5dc4f672d731da363ea62da70f5b09740f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 6 May 2024 10:32:16 +0200 Subject: [PATCH] include: add _NL_NO_WARN_DEPRECATED_HEADER for suppressing warning about deprecated headers Header files are part of a stable API. Warning about using deprecated API is cumbersome, albeit often useful to force the user to migrate away from the API. But it also requires that the unit test disables "-Wcpp". That is problematic on its own, because we don't want to disable any warnings. As we only have 4 such header files, instead guard the warnings with a #ifndef _NL_NO_WARN_DEPRECATED_HEADER --- Makefile.am | 2 +- include/netlink/cache-api.h | 2 ++ include/netlink/route/link/api.h | 2 ++ include/netlink/route/link/info-api.h | 2 ++ include/netlink/route/tc-api.h | 2 ++ 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 969af27e5..c560f8078 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1142,9 +1142,9 @@ EXTRA_DIST += \ $(COMPILE) \ -Wall \ -Werror \ - -Wno-error=cpp \ -I$(srcdir)/include \ -I$(builddir)/include \ + -D_NL_NO_WARN_DEPRECATED_HEADER \ -c \ -o $@ $< diff --git a/include/netlink/cache-api.h b/include/netlink/cache-api.h index 851eca0b9..e8a417066 100644 --- a/include/netlink/cache-api.h +++ b/include/netlink/cache-api.h @@ -9,6 +9,8 @@ #include #include +#ifndef _NL_NO_WARN_DEPRECATED_HEADER #warning "You are including a deprecated header file, include ." +#endif #endif diff --git a/include/netlink/route/link/api.h b/include/netlink/route/link/api.h index abdd8b297..ef11d2f53 100644 --- a/include/netlink/route/link/api.h +++ b/include/netlink/route/link/api.h @@ -9,6 +9,8 @@ #include #include +#ifndef _NL_NO_WARN_DEPRECATED_HEADER #warning "You are including a deprecated header file, include ." +#endif #endif diff --git a/include/netlink/route/link/info-api.h b/include/netlink/route/link/info-api.h index 11cffcfaa..88461bbef 100644 --- a/include/netlink/route/link/info-api.h +++ b/include/netlink/route/link/info-api.h @@ -9,6 +9,8 @@ #include #include +#ifndef _NL_NO_WARN_DEPRECATED_HEADER #warning "You are including a deprecated header file, include ." +#endif #endif diff --git a/include/netlink/route/tc-api.h b/include/netlink/route/tc-api.h index 3f400baa4..36b1b0fc6 100644 --- a/include/netlink/route/tc-api.h +++ b/include/netlink/route/tc-api.h @@ -10,6 +10,8 @@ #include #include +#ifndef _NL_NO_WARN_DEPRECATED_HEADER #warning "You are including a deprecated header file, include ." +#endif #endif