From 108a823db374a2a9184995bcc76ab46ece45dc25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Fri, 23 Nov 2018 11:49:02 +0100 Subject: [PATCH] Replace ISC_DEPRECATED with ISC_ATTR_DEPRECATED --- config.h.in | 3 ++ configure | 59 +++++++++++++++++++++++++ configure.ac | 1 + lib/dns/include/dns/db.h | 9 ++-- lib/dns/include/dns/rpz.h | 10 ++--- lib/isc/include/isc/deprecated.h | 22 --------- lib/isc/include/isc/platform.h.in | 5 +++ lib/isc/include/isc/util.h | 5 --- lib/isc/win32/include/isc/platform.h.in | 1 + util/copyrights | 1 - 10 files changed, 77 insertions(+), 39 deletions(-) delete mode 100644 lib/isc/include/isc/deprecated.h diff --git a/config.h.in b/config.h.in index 4977cef008..a31e62c9ef 100644 --- a/config.h.in +++ b/config.h.in @@ -171,6 +171,9 @@ /* Define to 1 if you have the `FIPS_mode' function. */ #undef HAVE_FIPS_MODE +/* Define to 1 if the system has the `deprecated' function attribute */ +#undef HAVE_FUNCTION_ATTRIBUTE_DEPRECATED + /* Define to 1 if the system has the `noreturn' function attribute */ #undef HAVE_FUNCTION_ATTRIBUTE_NORETURN diff --git a/configure b/configure index 83e1048d2c..3feb047381 100755 --- a/configure +++ b/configure @@ -13799,6 +13799,65 @@ fi + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((deprecated))" >&5 +$as_echo_n "checking for __attribute__((deprecated))... " >&6; } +if ${ax_cv_have_func_attribute_deprecated+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + int foo( void ) __attribute__((deprecated(""))); + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + if test -s conftest.err; then : + ax_cv_have_func_attribute_deprecated=no +else + ax_cv_have_func_attribute_deprecated=yes +fi +else + ax_cv_have_func_attribute_deprecated=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_have_func_attribute_deprecated" >&5 +$as_echo "$ax_cv_have_func_attribute_deprecated" >&6; } + + if test yes = $ax_cv_have_func_attribute_deprecated; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_FUNCTION_ATTRIBUTE_DEPRECATED 1 +_ACEOF + +fi + + + + # # check for uname library routine # diff --git a/configure.ac b/configure.ac index 9ffe30226e..fc1a0c40be 100644 --- a/configure.ac +++ b/configure.ac @@ -440,6 +440,7 @@ AC_HEADER_TIME # AX_C_FUNCTION_ATTRIBUTE([noreturn]) +AX_C_FUNCTION_ATTRIBUTE([deprecated]) # # check for uname library routine diff --git a/lib/dns/include/dns/db.h b/lib/dns/include/dns/db.h index 4f77471e79..606bf443e2 100644 --- a/lib/dns/include/dns/db.h +++ b/lib/dns/include/dns/db.h @@ -49,7 +49,6 @@ #include #include -#include #include #include #include @@ -1618,17 +1617,17 @@ dns_db_setcachestats(dns_db_t *db, isc_stats_t *stats); * dns_rdatasetstats_create(); otherwise NULL. */ +ISC_ATTR_DEPRECATED void -dns_db_rpz_attach(dns_db_t *db, void *rpzs, uint8_t rpz_num) - ISC_DEPRECATED; +dns_db_rpz_attach(dns_db_t *db, void *rpzs, uint8_t rpz_num); /*%< * Attach the response policy information for a view to a database for a * zone for the view. */ +ISC_ATTR_DEPRECATED isc_result_t -dns_db_rpz_ready(dns_db_t *db) - ISC_DEPRECATED; +dns_db_rpz_ready(dns_db_t *db); /*%< * Finish loading a response policy zone. */ diff --git a/lib/dns/include/dns/rpz.h b/lib/dns/include/dns/rpz.h index 0c12da6e9d..9d7c16ebdc 100644 --- a/lib/dns/include/dns/rpz.h +++ b/lib/dns/include/dns/rpz.h @@ -16,7 +16,6 @@ #include #include -#include #include #include #include @@ -394,15 +393,15 @@ dns_rpz_attach_rpzs(dns_rpz_zones_t *source, dns_rpz_zones_t **target); void dns_rpz_detach_rpzs(dns_rpz_zones_t **rpzsp); +ISC_ATTR_DEPRECATED isc_result_t dns_rpz_beginload(dns_rpz_zones_t **load_rpzsp, - dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num) - ISC_DEPRECATED; + dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num); +ISC_ATTR_DEPRECATED isc_result_t dns_rpz_ready(dns_rpz_zones_t *rpzs, - dns_rpz_zones_t **load_rpzsp, dns_rpz_num_t rpz_num) - ISC_DEPRECATED; + dns_rpz_zones_t **load_rpzsp, dns_rpz_num_t rpz_num); isc_result_t dns_rpz_add(dns_rpz_zones_t *rpzs, dns_rpz_num_t rpz_num, @@ -424,4 +423,3 @@ dns_rpz_find_name(dns_rpz_zones_t *rpzs, dns_rpz_type_t rpz_type, ISC_LANG_ENDDECLS #endif /* DNS_RPZ_H */ - diff --git a/lib/isc/include/isc/deprecated.h b/lib/isc/include/isc/deprecated.h deleted file mode 100644 index d485e20caf..0000000000 --- a/lib/isc/include/isc/deprecated.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -#ifndef ISC_DEPRECATED_H -#define ISC_DEPRECATED_H - -#if (__GNUC__ + 0) > 3 -#define ISC_DEPRECATED __attribute__((deprecated)) -#else -#define ISC_DEPRECATED /* none */ -#endif /* __GNUC__ > 3*/ - -#endif diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 5e966caf79..86b02d2bcf 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -28,6 +28,11 @@ #define ISC_ATTR_NORETURN #endif +#if HAVE_FUNCTION_ATTRIBUTE_DEPRECATED +#define ISC_ATTR_DEPRECATED __attribute__((__deprecated__)) +#else +#define ISC_ATTR_DEPRECATED +#endif /*** *** Thread-Local Storage diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h index ae40079b08..c3685c0cd8 100644 --- a/lib/isc/include/isc/util.h +++ b/lib/isc/include/isc/util.h @@ -280,9 +280,4 @@ extern void mock_assert(const int result, const char* const expression, */ #define ISC_ALIGN(x, a) (((x) + (a) - 1) & ~((typeof(x))(a)-1)) -/*% - * Misc - */ -#include - #endif /* ISC_UTIL_H */ diff --git a/lib/isc/win32/include/isc/platform.h.in b/lib/isc/win32/include/isc/platform.h.in index 2eb4a78d41..a213cfcde2 100644 --- a/lib/isc/win32/include/isc/platform.h.in +++ b/lib/isc/win32/include/isc/platform.h.in @@ -53,6 +53,7 @@ typedef uint32_t socklen_t; ***/ #define ISC_ATTR_NORETURN __declspec(noreturn) +#define ISC_ATTR_DEPRECATED /*** *** Network. diff --git a/util/copyrights b/util/copyrights index 58bea01cc6..6ccfff6a0c 100644 --- a/util/copyrights +++ b/util/copyrights @@ -2180,7 +2180,6 @@ ./lib/isc/include/isc/commandline.h C 1999,2000,2001,2004,2005,2006,2007,2015,2016,2018 ./lib/isc/include/isc/counter.h C 2014,2016,2018 ./lib/isc/include/isc/crc64.h C 2013,2016,2018 -./lib/isc/include/isc/deprecated.h C 2017,2018 ./lib/isc/include/isc/errno.h C 2016,2018 ./lib/isc/include/isc/error.h C 1998,1999,2000,2001,2004,2005,2006,2007,2009,2016,2017,2018 ./lib/isc/include/isc/event.h C 1998,1999,2000,2001,2002,2004,2005,2006,2007,2014,2016,2017,2018