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/dyOut.h src/inc/dyOut.h index ba84fe3..7a5244d 100644 --- src/inc/dyOut.h +++ src/inc/dyOut.h @@ -12,33 +12,37 @@ // // Output goes to STDOUT unless a single alternative out file is registered. #ifdef DSPRINT_H // NEVER INCLUDE TWICE. ONLY INCLUDE DIRECTLY IN C FILES. #error Including dyOut.h twice! Only include directly in C files as this redefines printf !!! #else//ifndef DSPRINT_H #define DSPRINT_H #include "common.h" #include "dystring.h" int dyOutOpen(int initialBufSize); // Allocate dynamic string and puts at top of stack // returns token to be used for later stack accounting asserts -int dyOutPrintf(char *format, ...); +int dyOutPrintf(char *format, ...) // Prints into end of the top ds buffer, and return resulting string length // If there is no current buffer, this acts like a simple printf and returns -1 +#if defined(__GNUC__) +__attribute__((format(printf, 1, 2))) +#endif +; #define dyOutPuts(str) dyOutPrintf("%s\n",str) #define dyOutPutc(chr) dyOutPrintf("%c",chr) #define SWAP_PRINTF #ifdef SWAP_PRINTF #define printf dyOutPrintf #define puts dyOutPuts #undef putc #define putc dyOutPutc #endif//def SWAP_PRINTF int dyOutPrintDirectly(int token,FILE *file); // Prints the contents of the top buffer directly to a file. // Will leave the filled buffer at top of stack // Returns the length printed.