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/xp.h src/inc/xp.h index 1439657..8dd596b 100644 --- src/inc/xp.h +++ src/inc/xp.h @@ -49,30 +49,34 @@ * error reporting. */ void xpFree(struct xp **pXp); /* Free up an xp parser. */ int xpLineIx(struct xp *xp); /* Return current line number. */ char *xpFileName(struct xp *xp); /* Return current file name. */ int xpReadFromFile(void *userData, char *buf, int bufSize); /* This is a function you can pass to xpNew as a read handler. * It assumes you've passed an open FILE in as userData. */ -void xpError(struct xp *xp, char *format, ...); +void xpError(struct xp *xp, char *format, ...) /* Output an error message with filename and line number included. */ +#if defined(__GNUC__) +__attribute__((format(printf, 2, 3))) +#endif +; boolean xpParseNext(struct xp *xp, char *tag); /* Skip through file until get given tag. Then parse out the * tag and all of it's children (calling atStartTag/atEndTag). * You can call this repeatedly to process all of a given tag * in file. */ void xpParse(struct xp *xp); /* Parse from start tag to end tag. Throw error if a problem. * Returns FALSE if nothing left to parse. */ #endif /* XP_H */