mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-03 02:22:48 +00:00
lib: vty: warn when using compatibility macros
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
817302b875
commit
8867927f0e
36
lib/vty.h
36
lib/vty.h
@ -183,13 +183,35 @@ struct vty_arg
|
||||
#define VTYNL ((vty->type == VTY_TERM) ? "\r\n" : "\n")
|
||||
|
||||
/* for compatibility */
|
||||
#define VTY_NEWLINE VTYNL
|
||||
#define VTY_GET_INTEGER(desc,v,str) {(v)=strtoul ((str), NULL, 10);}
|
||||
#define VTY_GET_INTEGER_RANGE(desc,v,str,min,max) {(v)=strtoul ((str), NULL, 10);}
|
||||
#define VTY_GET_ULONG(desc,v,str) {(v)=strtoul ((str), NULL, 10);}
|
||||
#define VTY_GET_ULL(desc,v,str) {(v)=strtoull ((str), NULL, 10);}
|
||||
#define VTY_GET_IPV4_ADDRESS(desc,v,str) inet_aton ((str), &(v))
|
||||
#define VTY_GET_IPV4_PREFIX(desc,v,str) str2prefix_ipv4 ((str), &(v))
|
||||
#if defined(__ICC)
|
||||
#define CPP_WARN_STR(X) #X
|
||||
#define CPP_WARN(text) _Pragma(CPP_WARN_STR(message __FILE__ ": " text))
|
||||
|
||||
#elif (defined(__GNUC__) && \
|
||||
(__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) || \
|
||||
(defined(__clang__) && \
|
||||
(__clang_major__ >= 4 || (__clang_major__ == 3 && __clang_minor__ >= 5)))
|
||||
#define CPP_WARN_STR(X) #X
|
||||
#define CPP_WARN(text) _Pragma(CPP_WARN_STR(GCC warning text))
|
||||
|
||||
#else
|
||||
#define CPP_WARN(text)
|
||||
#endif
|
||||
|
||||
#define VTY_NEWLINE VTYNL \
|
||||
CPP_WARN("VTY_NEWLINE has been replaced with VTYNL and/or vty_outln().")
|
||||
#define VTY_GET_INTEGER(desc,v,str) {(v)=strtoul ((str), NULL, 10);} \
|
||||
CPP_WARN("VTY_GET_INTEGER is no longer useful, use strtoul() or DEFPY.")
|
||||
#define VTY_GET_INTEGER_RANGE(desc,v,str,min,max) {(v)=strtoul ((str), NULL, 10);} \
|
||||
CPP_WARN("VTY_GET_INTEGER_RANGE is no longer useful, use strtoul() or DEFPY.")
|
||||
#define VTY_GET_ULONG(desc,v,str) {(v)=strtoul ((str), NULL, 10);} \
|
||||
CPP_WARN("VTY_GET_ULONG is no longer useful, use strtoul() or DEFPY.")
|
||||
#define VTY_GET_ULL(desc,v,str) {(v)=strtoull ((str), NULL, 10);} \
|
||||
CPP_WARN("VTY_GET_ULL is no longer useful, use strtoull() or DEFPY.")
|
||||
#define VTY_GET_IPV4_ADDRESS(desc,v,str) inet_aton ((str), &(v)) \
|
||||
CPP_WARN("VTY_GET_IPV4_ADDRESS is no longer useful, use inet_aton() or DEFPY.")
|
||||
#define VTY_GET_IPV4_PREFIX(desc,v,str) str2prefix_ipv4 ((str), &(v)) \
|
||||
CPP_WARN("VTY_GET_IPV4_PREFIX is no longer useful, use str2prefix_ipv4() or DEFPY.")
|
||||
|
||||
/* Default time out value */
|
||||
#define VTY_TIMEOUT_DEFAULT 600
|
||||
|
Loading…
Reference in New Issue
Block a user