Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteacbe94

Browse files
committed
Clean up minor inconsistencies in pg_attribute_printf() usage.
For some reason we'd never decorated pg_v*printf() withpg_attribute_printf() annotations. There is a convention forhow to label va_list-using printf functions (write zero for thesecond argument), and we use that liberally elsewhere in thecode, but these core functions lacked it. It's not clear howmuch useful checking the compiler can do for calls of these,but we might as well add the annotations.Also, sync win32security.c's log_error() with our normal conventionthat pg_attribute_printf must be attached to a function's declarationnot definition. Apparently this file is only compiled with compilersthat aren't picky about that, but still it'd be better to beconsistent.No back-patch since there's little reason to think we would catchanything.Discussion:https://postgr.es/m/3492412.1663283395@sss.pgh.pa.us
1 parentb245138 commiteacbe94

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

‎src/include/port.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,13 @@ extern unsigned char pg_ascii_tolower(unsigned char ch);
204204
#undef printf
205205
#endif
206206

207-
externintpg_vsnprintf(char*str,size_tcount,constchar*fmt,va_listargs);
207+
externintpg_vsnprintf(char*str,size_tcount,constchar*fmt,va_listargs)pg_attribute_printf(3,0);
208208
externintpg_snprintf(char*str,size_tcount,constchar*fmt,...)pg_attribute_printf(3,4);
209-
externintpg_vsprintf(char*str,constchar*fmt,va_listargs);
209+
externintpg_vsprintf(char*str,constchar*fmt,va_listargs)pg_attribute_printf(2,0);
210210
externintpg_sprintf(char*str,constchar*fmt,...)pg_attribute_printf(2,3);
211-
externintpg_vfprintf(FILE*stream,constchar*fmt,va_listargs);
211+
externintpg_vfprintf(FILE*stream,constchar*fmt,va_listargs)pg_attribute_printf(2,0);
212212
externintpg_fprintf(FILE*stream,constchar*fmt,...)pg_attribute_printf(2,3);
213-
externintpg_vprintf(constchar*fmt,va_listargs);
213+
externintpg_vprintf(constchar*fmt,va_listargs)pg_attribute_printf(1,0);
214214
externintpg_printf(constchar*fmt,...)pg_attribute_printf(1,2);
215215

216216
/*

‎src/port/win32security.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
#include"postgres_fe.h"
1818
#endif
1919

20+
staticvoidlog_error(constchar*fmt,...)pg_attribute_printf(1,2);
21+
2022

2123
/*
2224
* Utility wrapper for frontend and backend when reporting an error
2325
* message.
2426
*/
25-
static
26-
pg_attribute_printf(1,2)
27-
void
27+
staticvoid
2828
log_error(constchar*fmt,...)
2929
{
3030
va_listap;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp