0999158088e0fb3715eb27703c8c4f7123d77144 galt Mon Sep 21 16:51:20 2015 -0700 added GNU-C attributes to function declarations in src/inc, src/hg/inc, and some CGIs so that the compiler can catch errors where the parameter list given by the user does not match their format string. These var-args functions are like printf. diff --git src/inc/xap.h src/inc/xap.h index 7183240..68b0faa 100644 --- src/inc/xap.h +++ src/inc/xap.h @@ -35,32 +35,37 @@ void *topObject; /* Top level object - valid after xapParse. */ FILE *f; /* File. */ }; struct xap *xapNew(void *(*startHandler)(struct xap *xap, char *name, char **atts), void (*endHandler)(struct xap *xap, char *name) , char *fileName); /* Create a new parse stack. FileName may be NULL. */ void xapFree(struct xap **pXp); /* Free up a parse stack. */ void xapParseFile(struct xap *xap, char *fileName); /* Open up file and parse it all. */ -void xapError(struct xap *xap, char *format, ...); +void xapError(struct xap *xap, char *format, ...) /* Issue an error message and abort*/ +#if defined(__GNUC__) +__attribute__((format(printf, 2, 3))) +#endif +; + void xapIndent(int count, FILE *f); /* Write out some spaces. */ void xapSkip(struct xap *xap); /* Skip current tag and any children. Called from startHandler. */ void xapParseAny(char *fileName, char *type, void *(*startHandler)(struct xap *xap, char *name, char **atts), void (*endHandler)(struct xap *xap, char *name), char **retType, void *retObj); /* Parse any object out of an XML file. * If type parameter is non-NULL, force type. * example: * xapParseAny("file.xml", "das", dasStartHandler, dasEndHandler, &type, &obj); */