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/tokenizer.h src/inc/tokenizer.h index d1ce9d9..15623a4 100644 --- src/inc/tokenizer.h +++ src/inc/tokenizer.h @@ -36,31 +36,36 @@ void tokenizerReuse(struct tokenizer *tkz); /* Reuse token. */ int tokenizerLineCount(struct tokenizer *tkz); /* Return line of current token. */ char *tokenizerFileName(struct tokenizer *tkz); /* Return name of file. */ char *tokenizerNext(struct tokenizer *tkz); /* Return token's next string (also available as tkz->string) or * NULL at EOF. This string will be overwritten with the next call * to tokenizerNext, so cloneString if you need to save it. */ -void tokenizerErrAbort(struct tokenizer *tkz, char *format, ...); +void tokenizerErrAbort(struct tokenizer *tkz, char *format, ...) /* Print error message followed by file and line number and * abort. */ +#if defined(__GNUC__) +__attribute__((format(printf, 2, 3))) +#endif +; + void tokenizerNotEnd(struct tokenizer *tkz); /* Squawk if at end. */ char *tokenizerMustHaveNext(struct tokenizer *tkz); /* Get next token, which must be there. */ void tokenizerMustMatch(struct tokenizer *tkz, char *string); /* Require next token to match string. Return next token * if it does, otherwise abort. */ #endif /* TOKENIZER_H */