mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +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:
@ -286,7 +286,7 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
|
||||
(GET_MAJOR_VERSION(old_cluster.major_version) <= 804) ?
|
||||
"" : ", 'pg_largeobject_metadata', 'pg_largeobject_metadata_oid_index'");
|
||||
|
||||
res = executeQueryOrDie(conn, query);
|
||||
res = executeQueryOrDie(conn, "%s", query);
|
||||
|
||||
ntups = PQntuples(res);
|
||||
|
||||
|
@ -292,8 +292,8 @@ void split_old_dump(void);
|
||||
|
||||
/* exec.c */
|
||||
|
||||
int exec_prog(bool throw_error,
|
||||
const char *cmd,...);
|
||||
int exec_prog(bool throw_error, const char *cmd, ...)
|
||||
__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
|
||||
void verify_directories(void);
|
||||
bool is_server_running(const char *datadir);
|
||||
void rename_old_pg_control(void);
|
||||
@ -377,7 +377,8 @@ void init_tablespaces(void);
|
||||
/* server.c */
|
||||
|
||||
PGconn *connectToServer(ClusterInfo *cluster, const char *db_name);
|
||||
PGresult *executeQueryOrDie(PGconn *conn, const char *fmt,...);
|
||||
PGresult *executeQueryOrDie(PGconn *conn, const char *fmt, ...)
|
||||
__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
|
||||
|
||||
void start_postmaster(ClusterInfo *cluster);
|
||||
void stop_postmaster(bool fast);
|
||||
@ -390,9 +391,12 @@ void check_pghost_envvar(void);
|
||||
char *quote_identifier(const char *s);
|
||||
int get_user_info(char **user_name);
|
||||
void check_ok(void);
|
||||
void report_status(eLogType type, const char *fmt,...);
|
||||
void pg_log(eLogType type, char *fmt,...);
|
||||
void prep_status(const char *fmt,...);
|
||||
void report_status(eLogType type, const char *fmt, ...)
|
||||
__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
|
||||
void pg_log(eLogType type, char *fmt, ...)
|
||||
__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
|
||||
void prep_status(const char *fmt, ...)
|
||||
__attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2)));
|
||||
void check_ok(void);
|
||||
char *pg_strdup(const char *s);
|
||||
void *pg_malloc(int size);
|
||||
|
@ -71,7 +71,9 @@ transfer_all_new_dbs(DbInfoArr *old_db_arr,
|
||||
}
|
||||
}
|
||||
|
||||
prep_status(""); /* in case nothing printed */
|
||||
prep_status(" "); /* in case nothing printed; pass a space so gcc
|
||||
* doesn't complain about empty format
|
||||
* string */
|
||||
check_ok();
|
||||
|
||||
return msg;
|
||||
|
Reference in New Issue
Block a user