* Removed ifdef __GNUC__ around printf-like prototypes since both clang and gcc have format/printf macros defined

This commit is contained in:
Olof hagsand 2022-01-18 16:05:50 +01:00
parent 519fe1f576
commit b164f02277
11 changed files with 1 additions and 56 deletions

View file

@ -96,6 +96,7 @@ Users may have to change how they access the system
### Minor features ### Minor features
* Removed ifdef __GNUC__ around printf-like prototypes since both clang and gcc have format/printf macros defined
* Test changes * Test changes
* Use `YANG_STANDARD_DIR` from `./configure --with-yang-standard-dir=DIR` instead of `YANGMODELS` from site.sh * 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 * Remove dependency of IETF YANGs on most tests

View file

@ -41,11 +41,7 @@
/* /*
* Prototypes * Prototypes
*/ */
#if defined(__GNUC__) && __GNUC__ >= 3
int restconf_reply_header(void *req, const char *name, const char *vfmt, ...) __attribute__ ((format (printf, 3, 4))); 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 */ /* note cb is consumed dont free */
int restconf_reply_send(void *req, int code, cbuf *cb, int head); int restconf_reply_send(void *req, int code, cbuf *cb, int head);

View file

@ -105,11 +105,7 @@ extern char clicon_err_reason[ERR_STRLEN];
* Prototypes * Prototypes
*/ */
int clicon_err_reset(void); 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))); 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); char *clicon_strerror(int err);
void *clicon_err_save(void); void *clicon_err_save(void);
int clicon_err_restore(void *handle); int clicon_err_restore(void *handle);

View file

@ -56,13 +56,8 @@ int clicon_log_exit(void);
int clicon_log_opt(char c); int clicon_log_opt(char c);
int clicon_log_file(char *filename); int clicon_log_file(char *filename);
int clicon_get_logflags(void); 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_log(int level, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
int clicon_debug(int dbglevel, 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_init(int dbglevel, FILE *f);
int clicon_debug_get(void); int clicon_debug_get(void);

View file

@ -85,18 +85,11 @@ int api_path2xml(char *api_path, yang_stmt *yspec, cxobj *xtop,
yang_class nodeclass, int strict, yang_class nodeclass, int strict,
cxobj **xpathp, yang_stmt **ypathp, cxobj **xerr); cxobj **xpathp, yang_stmt **ypathp, cxobj **xerr);
int xml2api_path_1(cxobj *x, cbuf *cb); 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, int clixon_xml_find_api_path(cxobj *xt, yang_stmt *yt, cxobj ***xvec, int *xlen, const char *format,
...) __attribute__ ((format (printf, 5, 6)));; ...) __attribute__ ((format (printf, 5, 6)));;
int clixon_xml_find_instance_id(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,
...) __attribute__ ((format (printf, 5, 6)));; ...) __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_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))); 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_ */ #endif /* _CLIXON_PATH_H_ */

View file

@ -64,11 +64,7 @@ struct clicon_msg {
char *format_int2str(enum format_enum showas); char *format_int2str(enum format_enum showas);
enum format_enum format_str2int(char *str); 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))); 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_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); int clicon_connect_unix(clicon_handle h, char *sockpath);

View file

@ -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_ss_delete(clicon_handle h, char *name, stream_fn_t fn, void *arg);
int stream_notify_xml(clicon_handle h, char *stream, cxobj *xml); 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))); 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 */ /* Replay */
int stream_replay_add(event_stream_t *es, struct timeval *tv, cxobj *xv); int stream_replay_add(event_stream_t *es, struct timeval *tv, cxobj *xv);

View file

@ -91,13 +91,8 @@ char **clicon_strsep(char *string, char *delim, int *nvec0);
char *clicon_strjoin (int argc, char **argv, char *delim); char *clicon_strjoin (int argc, char **argv, char *delim);
int clixon_strsplit(char *nodeid, const int delim, char **prefix, char **id); 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); 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 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))); 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 xml_chardata_cbuf_append(cbuf *cb, char *str);
int uri_percent_decode(char *enc, char **str); int uri_percent_decode(char *enc, char **str);

View file

@ -272,11 +272,7 @@ cxobj *xml_root(cxobj *xn);
int xml_operation(char *opstr, enum operation_type *op); int xml_operation(char *opstr, enum operation_type *op);
char *xml_operation2str(enum operation_type op); char *xml_operation2str(enum operation_type op);
int xml_attr_insert2val(char *instr, enum insert_type *ins); 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))); 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 #ifdef XML_EXPLICIT_INDEX
int xml_search_index_p(cxobj *x); int xml_search_index_p(cxobj *x);

View file

@ -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_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); 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, int clixon_xml_parse_va(yang_bind yb, yang_stmt *yspec, cxobj **xt, cxobj **xerr,
const char *format, ...) __attribute__ ((format (printf, 5, 6))); 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); int clixon_xml_attr_copy(cxobj *xin, cxobj *xout, char *name);
#endif /* _CLIXON_XML_IO_H_ */ #endif /* _CLIXON_XML_IO_H_ */

View file

@ -134,31 +134,18 @@ int xpath_tree_free(xpath_tree *xs);
int xpath_parse(const char *xpath, xpath_tree **xptree); 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); 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_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, int xpath_vec_flag(cxobj *xcur, cvec *nsc, const char *xpformat, uint16_t flags,
cxobj ***vec, int *veclen, ...) __attribute__ ((format (printf, 3, 7))); 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 /* Functions with explicit namespace context (nsc) set. If you do not need
* explicit namespace contexts (most do not) consider using the API functions * explicit namespace contexts (most do not) consider using the API functions
* below without nsc set. * below without nsc set.
* If you do not know what a namespace context is, see README.md#xml-and-xpath * 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(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))); 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))); 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 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); int xpath_count(cxobj *xcur, cvec *nsc, const char *xpath, uint32_t *count);