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/web.h src/hg/inc/web.h index adbc4de..79988de 100644 --- src/hg/inc/web.h +++ src/hg/inc/web.h @@ -3,93 +3,109 @@ /* Copyright (C) 2014 The Regents of the University of California * See README in this or parent directory for licensing information. */ #ifndef WEB_H #define WEB_H #include "cart.h" #include "dbDb.h" void webSetStyle(char *style); /* set a style to add to the header */ void webStartText(); /* output the head for a text page */ -void webStart(struct cart *theCart, char *db, char* format,...); +void webStart(struct cart *theCart, char *db, char* format,...) /* output a CGI and HTML header with the given title in printf format */ +#if defined(__GNUC__) +__attribute__((format(printf, 3, 4))) +#endif +; -void webStartHeader(struct cart *theCart, char *db, char *header, char* format,...); +void webStartHeader(struct cart *theCart, char *db, char *header, char* format,...) /* output a CGI and HTML header with the given title in printf format */ +#if defined(__GNUC__) +__attribute__((format(printf, 4, 5))) +#endif +; void webStartWrapper(struct cart *theCart, char *db, char *format, va_list args, boolean withHttpHeader, boolean withLogo); /* output a CGI and HTML header with the given title in printf format */ void webStartWrapperDetailedArgs(struct cart *theCart, char *db, char *headerText, char *format, va_list args, boolean withHttpHeader, boolean withLogo, boolean skipSectionHeader, boolean withHtmlHeader); /* output a CGI and HTML header with the given title in printf format with * quite a few options. See also next: */ void webStartWrapperDetailedNoArgs(struct cart *theCart, char *db, char *headerText, char *format, boolean withHttpHeader, boolean withLogo, boolean skipSectionHeader, boolean withHtmlHeader); /* output a CGI and HTML header with the given title in printf format with * quite a few options. Same as above without va_list args */ void webPragmasEtc(); /* Print out stuff that tells people not to cache us, and that we use the * usual character set and scripting langauge. (Normally done by webStartWrap) */ void webStartSectionTables(); /* Put up start of nepharious table layout stuff. (Normally done by webStartWrap). */ void webFirstSection(char *title); /* Put up the first section (normally done by webStartWrap). */ -void webNewSection(char* format, ...); +void webNewSection(char* format, ...) /* create a new section on the web page */ +#if defined(__GNUC__) +__attribute__((format(printf, 1, 2))) +#endif +; void webNewEmptySection(); /* create a new section on the web page to maintain table layout */ void webNewSectionHeaderStart(boolean hasTitle); /* Start a new collapsible section on the web page, with +- control. Allows use of jsBeginCollapsibleSection() */ void webNewSectionHeaderEnd(); /* Properly close header of collapsible section on web page */ void webEnd(); /* output the footer of the HTML page */ void webEndSection(); /* Close down a section */ void webEndSectionTables(); /* Finish with section tables (but don't do /BODY /HTML lik * webEnd does. */ void webVaWarn(char *format, va_list args); /* Warning handler that closes off web page. */ boolean webGotWarnings(); /* Return TRUE if webVaWarn has been called. */ -void webAbort(char* title, char* format, ...); +void webAbort(char* title, char* format, ...) /* an abort function that outputs a error page */ +#if defined(__GNUC__) +__attribute__((format(printf, 2, 3))) +#endif +; void printCladeListHtml(char *genome, char *onChangeText); /* Make an HTML select input listing the clades. */ void printGenomeListHtml(char *db, char *onChangeText); /* Prints to stdout the HTML to render a dropdown list containing * a list of the possible genomes to choose from. * param db - The database whose genome will be selected by default. * If NULL, no default selection. * param onChangeText - Optional (can be NULL) text to pass in any * onChange javascript. */ void printBlatGenomeListHtml(char *db, char *onChangeText); /* Prints to stdout the HTML to render a dropdown list containing