mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Add missing format attributes
Add __attribute__ decorations for printf format checking to the places that
were missing them. Fix the resulting warnings. Add
-Wmissing-format-attribute to the standard set of warnings for GCC, so these
don't happen again.
The warning fixes here are relatively harmless. The one serious problem
discovered by this was already committed earlier in
cf15fb5cab
.
This commit is contained in:
@ -388,7 +388,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
|
||||
*/
|
||||
if (arrsize > 0 && ntuples > arrsize)
|
||||
{
|
||||
ecpg_log("ECPGget_desc on line %d: incorrect number of matches; %d don't fit into array of %d\n",
|
||||
ecpg_log("ECPGget_desc on line %d: incorrect number of matches; %d don't fit into array of %ld\n",
|
||||
lineno, ntuples, arrsize);
|
||||
ecpg_raise(lineno, ECPG_TOO_MANY_MATCHES, ECPG_SQLSTATE_CARDINALITY_VIOLATION, NULL);
|
||||
return false;
|
||||
@ -457,7 +457,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
|
||||
*/
|
||||
if (data_var.ind_arrsize > 0 && ntuples > data_var.ind_arrsize)
|
||||
{
|
||||
ecpg_log("ECPGget_desc on line %d: incorrect number of matches (indicator); %d don't fit into array of %d\n",
|
||||
ecpg_log("ECPGget_desc on line %d: incorrect number of matches (indicator); %d don't fit into array of %ld\n",
|
||||
lineno, ntuples, data_var.ind_arrsize);
|
||||
ecpg_raise(lineno, ECPG_TOO_MANY_MATCHES, ECPG_SQLSTATE_CARDINALITY_VIOLATION, NULL);
|
||||
return false;
|
||||
|
@ -335,7 +335,7 @@ ecpg_raise_backend(int line, PGresult *result, PGconn *conn, int compat)
|
||||
sqlca->sqlcode = ECPG_PGSQL;
|
||||
|
||||
/* %.*s is safe here as long as sqlstate is all-ASCII */
|
||||
ecpg_log("raising sqlstate %.*s (sqlcode %d): %s\n",
|
||||
ecpg_log("raising sqlstate %.*s (sqlcode %ld): %s\n",
|
||||
sizeof(sqlca->sqlstate), sqlca->sqlstate, sqlca->sqlcode, sqlca->sqlerrm.sqlerrmc);
|
||||
|
||||
/* free all memory we have allocated for the user */
|
||||
|
@ -332,7 +332,7 @@ ecpg_store_result(const PGresult *results, int act_field,
|
||||
*/
|
||||
if ((var->arrsize > 0 && ntuples > var->arrsize) || (var->ind_arrsize > 0 && ntuples > var->ind_arrsize))
|
||||
{
|
||||
ecpg_log("ecpg_store_result on line %d: incorrect number of matches; %d don't fit into array of %d\n",
|
||||
ecpg_log("ecpg_store_result on line %d: incorrect number of matches; %d don't fit into array of %ld\n",
|
||||
stmt->lineno, ntuples, var->arrsize);
|
||||
ecpg_raise(stmt->lineno, INFORMIX_MODE(stmt->compat) ? ECPG_INFORMIX_SUBSELECT_NOT_ONE : ECPG_TOO_MANY_MATCHES, ECPG_SQLSTATE_CARDINALITY_VIOLATION, NULL);
|
||||
return false;
|
||||
|
@ -161,7 +161,7 @@ void ecpg_raise(int line, int code, const char *sqlstate, const char *str);
|
||||
void ecpg_raise_backend(int line, PGresult *result, PGconn *conn, int compat);
|
||||
char *ecpg_prepared(const char *, struct connection *);
|
||||
bool ecpg_deallocate_all_conn(int lineno, enum COMPAT_MODE c, struct connection * conn);
|
||||
void ecpg_log(const char *format,...);
|
||||
void ecpg_log(const char *format, ...) __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2)));
|
||||
bool ecpg_auto_prepare(int, const char *, const int, char **, const char *);
|
||||
void ecpg_init_sqlca(struct sqlca_t * sqlca);
|
||||
|
||||
|
Reference in New Issue
Block a user