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/htmshell.h src/inc/htmshell.h index 96e4422..a32949f 100644 --- src/inc/htmshell.h +++ src/inc/htmshell.h @@ -5,38 +5,46 @@ * To use this generally you should call the function htmShell() * very early inside of main(). You pass htmShell() a routine * which does most of the work of your web server-side applet. * * These routines will throw errors, which are caught by * htmShell, which then returns. For the most part you just * want an error to cause an error message to be printed and * then terminate your CGI program, so this works fine. * * This file is copyright 2002 Jim Kent, but license is hereby * granted for all use - public, private or commercial. */ void htmlSetCookie(char* name, char* value, char* expires, char* path, char* domain, boolean isSecure); /* create a cookie with the given stats */ -void htmlParagraph(char *line, ...); +void htmlParagraph(char *line, ...) /* Print a line in it's own paragraph. */ +#if defined(__GNUC__) +__attribute__((format(printf, 1, 2))) +#endif +; void htmlVaParagraph(char *line, va_list args); /* Print a line in it's own paragraph. */ -void htmlCenterParagraph(char *line, ...); +void htmlCenterParagraph(char *line, ...) /* Center a line in it's own paragraph. */ +#if defined(__GNUC__) +__attribute__((format(printf, 1, 2))) +#endif +; void htmlHorizontalLine(); /* Print a horizontal line. */ void htmlNbSpaces(int count); /* Print a number of non-breaking spaces. */ void htmHorizontalLine(FILE *f); /* Print a horizontal line. */ void htmTextOut(FILE *f, char *s); /* Print out string to file, if necessary replacing > with > and the like */ void htmlTextOut(char *s); /* Print out string, if necessary replacing > with > and the like */