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/hg/inc/jsHelper.h src/hg/inc/jsHelper.h
index bc8ca76..5c99cff 100644
--- src/hg/inc/jsHelper.h
+++ src/hg/inc/jsHelper.h
@@ -143,21 +143,24 @@
* With support for varying font size */
void jsEndCollapsibleSection();
/* End the collapsible
. */
void jsReloadOnBackButton(struct cart *cart);
/* Add some javascript to detect that the back button (or reload) has been pressed,
* and to resubmit in that case to redraw the page with the latest cart contents. */
// --- Genome browser specific json stuff - see also inc/json.h for more generic stuff
void jsonPrint(struct jsonElement *json, char *name, int indentLevel);
// print out a jsonElement and children using hPrintf, and for indentLevel >=0
// bracketing with comments. See also jsonPrintToFile.
-void jsonErrPrintf(struct dyString *ds, char *format, ...);
+void jsonErrPrintf(struct dyString *ds, char *format, ...)
// Printf a json error to a dyString for communicating with ajax code; format is:
// {"error": error message here}
-
+#if defined(__GNUC__)
+__attribute__((format(printf, 2, 3)))
+#endif
+;
#endif /* JSHELPER_H */