diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cb7ab13..d8192326 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -96,6 +96,7 @@ Users may have to change how they access the system ### Minor features +* Removed ifdef __GNUC__ around printf-like prototypes since both clang and gcc have format/printf macros defined * Test changes * Use `YANG_STANDARD_DIR` from `./configure --with-yang-standard-dir=DIR` instead of `YANGMODELS` from site.sh * Remove dependency of IETF YANGs on most tests diff --git a/apps/restconf/restconf_api.h b/apps/restconf/restconf_api.h index a44cb440..947847aa 100644 --- a/apps/restconf/restconf_api.h +++ b/apps/restconf/restconf_api.h @@ -41,11 +41,7 @@ /* * Prototypes */ -#if defined(__GNUC__) && __GNUC__ >= 3 int restconf_reply_header(void *req, const char *name, const char *vfmt, ...) __attribute__ ((format (printf, 3, 4))); -#else -int restconf_reply_header(void *req, const char *name, const char *vfmt, ...); -#endif /* note cb is consumed dont free */ int restconf_reply_send(void *req, int code, cbuf *cb, int head); diff --git a/lib/clixon/clixon_err.h b/lib/clixon/clixon_err.h index e21c8bfb..b108469c 100644 --- a/lib/clixon/clixon_err.h +++ b/lib/clixon/clixon_err.h @@ -105,11 +105,7 @@ extern char clicon_err_reason[ERR_STRLEN]; * Prototypes */ int clicon_err_reset(void); -#if defined(__GNUC__) && __GNUC__ >= 3 int clicon_err_fn(const char *fn, const int line, int category, int err, const char *format, ...) __attribute__ ((format (printf, 5, 6))); -#else -int clicon_err_fn(const char *fn, const int line, int category, int err, const char *format, ...); -#endif char *clicon_strerror(int err); void *clicon_err_save(void); int clicon_err_restore(void *handle); diff --git a/lib/clixon/clixon_log.h b/lib/clixon/clixon_log.h index f260648f..74b760b9 100644 --- a/lib/clixon/clixon_log.h +++ b/lib/clixon/clixon_log.h @@ -56,13 +56,8 @@ int clicon_log_exit(void); int clicon_log_opt(char c); int clicon_log_file(char *filename); int clicon_get_logflags(void); -#if defined(__GNUC__) && __GNUC__ >= 3 int clicon_log(int level, const char *format, ...) __attribute__ ((format (printf, 2, 3))); int clicon_debug(int dbglevel, const char *format, ...) __attribute__ ((format (printf, 2, 3))); -#else -int clicon_log(int level, const char *format, ...); -int clicon_debug(int dbglevel, const char *format, ...); -#endif int clicon_debug_init(int dbglevel, FILE *f); int clicon_debug_get(void); diff --git a/lib/clixon/clixon_path.h b/lib/clixon/clixon_path.h index 6baa2b6c..82d5e3ab 100644 --- a/lib/clixon/clixon_path.h +++ b/lib/clixon/clixon_path.h @@ -85,18 +85,11 @@ int api_path2xml(char *api_path, yang_stmt *yspec, cxobj *xtop, yang_class nodeclass, int strict, cxobj **xpathp, yang_stmt **ypathp, cxobj **xerr); int xml2api_path_1(cxobj *x, cbuf *cb); -#if defined(__GNUC__) && __GNUC__ >= 3 int clixon_xml_find_api_path(cxobj *xt, yang_stmt *yt, cxobj ***xvec, int *xlen, const char *format, ...) __attribute__ ((format (printf, 5, 6)));; int clixon_xml_find_instance_id(cxobj *xt, yang_stmt *yt, cxobj ***xvec, int *xlen, const char *format, ...) __attribute__ ((format (printf, 5, 6)));; int clixon_instance_id_bind(yang_stmt *yt, cvec *nsctx, const char *format, ...) __attribute__ ((format (printf, 3, 4))); int clixon_instance_id_parse(yang_stmt *yt, clixon_path **cplistp, cxobj **xerr, const char *format, ...) __attribute__ ((format (printf, 4, 5))); -#else -int clixon_xml_find_api_path(cxobj *xt, yang_stmt *yt, cxobj ***xvec, int *xlen, const char *format, ...); -int clixon_xml_find_instance_id(cxobj *xt, yang_stmt *yt, cxobj ***xvec, int *xlen, const char *format, ...); -int clixon_instance_id_bind(yang_stmt *yt, cvec *nsctx, const char *format, ...); -int clixon_instance_id_parse(yang_stmt *yt, clixon_path **cplistp, cxobj **xerr, const char *format, ...); -#endif #endif /* _CLIXON_PATH_H_ */ diff --git a/lib/clixon/clixon_proto.h b/lib/clixon/clixon_proto.h index ef0fc872..39357f64 100644 --- a/lib/clixon/clixon_proto.h +++ b/lib/clixon/clixon_proto.h @@ -64,11 +64,7 @@ struct clicon_msg { char *format_int2str(enum format_enum showas); enum format_enum format_str2int(char *str); -#if defined(__GNUC__) && __GNUC__ >= 3 struct clicon_msg *clicon_msg_encode(uint32_t id, const char *format, ...) __attribute__ ((format (printf, 2, 3))); -#else -struct clicon_msg *clicon_msg_encode(uint32_t id, const char *format, ...); -#endif int clicon_msg_decode(struct clicon_msg *msg, yang_stmt *yspec, uint32_t *id, cxobj **xml, cxobj **xerr); int clicon_connect_unix(clicon_handle h, char *sockpath); diff --git a/lib/clixon/clixon_stream.h b/lib/clixon/clixon_stream.h index c5be0f36..8dd26523 100644 --- a/lib/clixon/clixon_stream.h +++ b/lib/clixon/clixon_stream.h @@ -120,11 +120,7 @@ int stream_ss_delete_all(clicon_handle h, stream_fn_t fn, void *arg); int stream_ss_delete(clicon_handle h, char *name, stream_fn_t fn, void *arg); int stream_notify_xml(clicon_handle h, char *stream, cxobj *xml); -#if defined(__GNUC__) && __GNUC__ >= 3 int stream_notify(clicon_handle h, char *stream, const char *event, ...) __attribute__ ((format (printf, 3, 4))); -#else -int stream_notify(clicon_handle h, char *stream, const char *event, ...); -#endif /* Replay */ int stream_replay_add(event_stream_t *es, struct timeval *tv, cxobj *xv); diff --git a/lib/clixon/clixon_string.h b/lib/clixon/clixon_string.h index e1427863..bffa5a37 100644 --- a/lib/clixon/clixon_string.h +++ b/lib/clixon/clixon_string.h @@ -91,13 +91,8 @@ char **clicon_strsep(char *string, char *delim, int *nvec0); char *clicon_strjoin (int argc, char **argv, char *delim); int clixon_strsplit(char *nodeid, const int delim, char **prefix, char **id); int uri_str2cvec(char *string, char delim1, char delim2, int decode, cvec **cvp); -#if defined(__GNUC__) && __GNUC__ >= 3 int uri_percent_encode(char **encp, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); int xml_chardata_encode(char **escp, const char *fmt, ... ) __attribute__ ((format (printf, 2, 3))); -#else -int uri_percent_encode(char **encp, const char *str, ...); -int xml_chardata_encode(char **escp, const char *fmt, ...); -#endif int xml_chardata_cbuf_append(cbuf *cb, char *str); int uri_percent_decode(char *enc, char **str); diff --git a/lib/clixon/clixon_xml.h b/lib/clixon/clixon_xml.h index f77a5690..7c884c98 100644 --- a/lib/clixon/clixon_xml.h +++ b/lib/clixon/clixon_xml.h @@ -272,11 +272,7 @@ cxobj *xml_root(cxobj *xn); int xml_operation(char *opstr, enum operation_type *op); char *xml_operation2str(enum operation_type op); int xml_attr_insert2val(char *instr, enum insert_type *ins); -#if defined(__GNUC__) && __GNUC__ >= 3 int clicon_log_xml(int level, cxobj *x, const char *format, ...) __attribute__ ((format (printf, 3, 4))); -#else -int clicon_log_xml(int level, cxobj *x, const char *format, ...); -#endif #ifdef XML_EXPLICIT_INDEX int xml_search_index_p(cxobj *x); diff --git a/lib/clixon/clixon_xml_io.h b/lib/clixon/clixon_xml_io.h index 83ead228..33c92ac2 100644 --- a/lib/clixon/clixon_xml_io.h +++ b/lib/clixon/clixon_xml_io.h @@ -53,14 +53,8 @@ int xmltree2cbuf(cbuf *cb, cxobj *x, int level); int clixon_xml_parse_file(FILE *f, yang_bind yb, yang_stmt *yspec, cxobj **xt, cxobj **xerr); int clixon_xml_parse_string(const char *str, yang_bind yb, yang_stmt *yspec, cxobj **xt, cxobj **xerr); - -#if defined(__GNUC__) && __GNUC__ >= 3 int clixon_xml_parse_va(yang_bind yb, yang_stmt *yspec, cxobj **xt, cxobj **xerr, const char *format, ...) __attribute__ ((format (printf, 5, 6))); -#else -int clixon_xml_parse_va(yang_bind yb, yang_stmt *yspec, cxobj **xt, cxobj **xerr, - const char *format, ...); -#endif int clixon_xml_attr_copy(cxobj *xin, cxobj *xout, char *name); #endif /* _CLIXON_XML_IO_H_ */ diff --git a/lib/clixon/clixon_xpath.h b/lib/clixon/clixon_xpath.h index e7ee1414..cef1c0e7 100644 --- a/lib/clixon/clixon_xpath.h +++ b/lib/clixon/clixon_xpath.h @@ -134,31 +134,18 @@ int xpath_tree_free(xpath_tree *xs); int xpath_parse(const char *xpath, xpath_tree **xptree); int xpath_vec_ctx(cxobj *xcur, cvec *nsc, const char *xpath, int localonly, xp_ctx **xrp); -#if defined(__GNUC__) && __GNUC__ >= 3 int xpath_vec_bool(cxobj *xcur, cvec *nsc, const char *xpformat, ...) __attribute__ ((format (printf, 3, 4))); int xpath_vec_flag(cxobj *xcur, cvec *nsc, const char *xpformat, uint16_t flags, cxobj ***vec, int *veclen, ...) __attribute__ ((format (printf, 3, 7))); -#else -int xpath_vec_bool(cxobj *xcur, cvec *nsc, const char *xpformat, ...); -int xpath_vec_flag(cxobj *xcur, cvec *nsc, const char *xpformat, uint16_t flags, - cxobj ***vec, int *veclen, ...); -#endif - /* Functions with explicit namespace context (nsc) set. If you do not need * explicit namespace contexts (most do not) consider using the API functions * below without nsc set. * If you do not know what a namespace context is, see README.md#xml-and-xpath */ -#if defined(__GNUC__) && __GNUC__ >= 3 cxobj *xpath_first(cxobj *xcur, cvec *nsc, const char *xpformat, ...) __attribute__ ((format (printf, 3, 4))); cxobj *xpath_first_localonly(cxobj *xcur, const char *xpformat, ...) __attribute__ ((format (printf, 2, 3))); int xpath_vec(cxobj *xcur, cvec *nsc, const char *xpformat, cxobj ***vec, size_t *veclen, ...) __attribute__ ((format (printf, 3, 6))); -#else -cxobj *xpath_first(cxobj *xcur, cvec *nsc, const char *xpformat, ...); -cxobj *xpath_first_localonly(cxobj *xcur, const char *xpformat, ...); -int xpath_vec(cxobj *xcur, cvec *nsc, const char *xpformat, cxobj ***vec, size_t *veclen, ...); -#endif int xpath2canonical(const char *xpath0, cvec *nsc0, yang_stmt *yspec, char **xpath1, cvec **nsc1, cbuf **cbreason); int xpath_count(cxobj *xcur, cvec *nsc, const char *xpath, uint32_t *count);