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

Commitbbfd7ed

Browse files
committed
Add macros wrapping all usage of gcc's __attribute__.
Until now __attribute__() was defined to be empty for all compilers butgcc. That's problematic because it prevents using it in other compilers;which is necessary e.g. for atomics portability. It's also justgenerally dubious to do so in a header as widely included as c.h.Instead add pg_attribute_format_arg, pg_attribute_printf,pg_attribute_noreturn macros which are implemented in the compilers thatunderstand them. Also add pg_attribute_noreturn and pg_attribute_packed,but don't provide fallbacks, since they can affect functionality.This means that external code that, possibly unwittingly, relied on__attribute__ defined to be empty on !gcc compilers may now run intowarnings or errors on those compilers. But there shouldn't be manyoccurances of that and it's hard to work around...Discussion: 54B58BA3.8040302@ohmu.fiAuthor: Oskari Saarenmaa, with some minor changes by me.
1 parent66ece31 commitbbfd7ed

File tree

68 files changed

+167
-132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+167
-132
lines changed

‎contrib/cube/cubescan.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ float ({integer}|{real})([eE]{integer})?
6060

6161
%%
6262

63-
void__attribute__((noreturn))
63+
voidpg_attribute_noreturn
6464
yyerror(NDBOX **result,constchar *message)
6565
{
6666
if (*yytext == YY_END_OF_BUFFER_CHAR)

‎contrib/pg_upgrade/pg_upgrade.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ voidoptionally_create_toast_tables(void);
359359
bool
360360
exec_prog(constchar*log_file,constchar*opt_log_file,
361361
boolthrow_error,constchar*fmt,...)
362-
__attribute__((format(PG_PRINTF_ATTRIBUTE,4,5)));
362+
pg_attribute_printf(4,5);
363363
voidverify_directories(void);
364364
boolpid_lock_file_exists(constchar*datadir);
365365

@@ -445,7 +445,7 @@ voidinit_tablespaces(void);
445445
PGconn*connectToServer(ClusterInfo*cluster,constchar*db_name);
446446
PGresult*
447447
executeQueryOrDie(PGconn*conn,constchar*fmt,...)
448-
__attribute__((format(PG_PRINTF_ATTRIBUTE,2,3)));
448+
pg_attribute_printf(2,3);
449449

450450
char*cluster_conn_opts(ClusterInfo*cluster);
451451

@@ -462,17 +462,17 @@ intget_user_info(char **user_name_p);
462462
voidcheck_ok(void);
463463
void
464464
report_status(eLogTypetype,constchar*fmt,...)
465-
__attribute__((format(PG_PRINTF_ATTRIBUTE,2,3)));
465+
pg_attribute_printf(2,3);
466466
void
467467
pg_log(eLogTypetype,constchar*fmt,...)
468-
__attribute__((format(PG_PRINTF_ATTRIBUTE,2,3)));
468+
pg_attribute_printf(2,3);
469469
void
470470
pg_fatal(constchar*fmt,...)
471-
__attribute__((format(PG_PRINTF_ATTRIBUTE,1,2),noreturn));
471+
pg_attribute_printf(1,2)pg_attribute_noreturn;
472472
voidend_progress_output(void);
473473
void
474474
prep_status(constchar*fmt,...)
475-
__attribute__((format(PG_PRINTF_ATTRIBUTE,1,2)));
475+
pg_attribute_printf(1,2);
476476
voidcheck_ok(void);
477477
constchar*getErrorText(interrNum);
478478
unsignedintstr2uint(constchar*str);
@@ -489,7 +489,7 @@ void old_9_3_check_for_line_data_type_usage(ClusterInfo *cluster);
489489
void
490490
parallel_exec_prog(constchar*log_file,constchar*opt_log_file,
491491
constchar*fmt,...)
492-
__attribute__((format(PG_PRINTF_ATTRIBUTE,3,4)));
492+
pg_attribute_printf(3,4);
493493
voidparallel_transfer_all_new_dbs(DbInfoArr*old_db_arr,DbInfoArr*new_db_arr,
494494
char*old_pgdata,char*new_pgdata,
495495
char*old_tablespace);

‎contrib/pg_upgrade/util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ prep_status(const char *fmt,...)
8282

8383

8484
static
85-
__attribute__((format(PG_PRINTF_ATTRIBUTE,2,0)))
85+
pg_attribute_printf(2,0)
8686
void
8787
pg_log_v(eLogTypetype,constchar*fmt,va_listap)
8888
{

‎contrib/pg_xlogdump/pg_xlogdump.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ typedef struct XLogDumpStats
6969

7070
staticvoid
7171
fatal_error(constchar*fmt,...)
72-
__attribute__((format(PG_PRINTF_ATTRIBUTE,1,2)));
72+
pg_attribute_printf(1,2);
7373

7474
/*
7575
* Big red button to push when things go horribly wrong.

‎contrib/pgcrypto/px.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ voidpx_memset(void *ptr, int c, size_t len);
208208
#ifdefPX_DEBUG
209209
void
210210
px_debug(constchar*fmt,...)
211-
__attribute__((format(PG_PRINTF_ATTRIBUTE,1,2)));
211+
pg_attribute_printf(1,2);
212212
#else
213213
#definepx_debug(...)
214214
#endif

‎contrib/seg/segscan.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ float ({integer}|{real})([eE]{integer})?
5959

6060
%%
6161

62-
void__attribute__((noreturn))
62+
voidpg_attribute_noreturn
6363
yyerror(SEG *result,constchar *message)
6464
{
6565
if (*yytext == YY_END_OF_BUFFER_CHAR)

‎src/backend/access/transam/xlogreader.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static void
3636
report_invalid_record(XLogReaderState*state,constchar*fmt,...)
3737
/* This extension allows gcc to check the format string for consistency with
3838
the supplied arguments. */
39-
__attribute__((format(PG_PRINTF_ATTRIBUTE,2,3)));
39+
pg_attribute_printf(2,3);
4040

4141
staticvoidResetDecoder(XLogReaderState*state);
4242

‎src/backend/postmaster/autovacuum.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ intAutovacuumLauncherPid = 0;
286286
staticpid_tavlauncher_forkexec(void);
287287
staticpid_tavworker_forkexec(void);
288288
#endif
289-
NON_EXEC_STATICvoidAutoVacWorkerMain(intargc,char*argv[])__attribute__((noreturn));
290-
NON_EXEC_STATICvoidAutoVacLauncherMain(intargc,char*argv[])__attribute__((noreturn));
289+
NON_EXEC_STATICvoidAutoVacWorkerMain(intargc,char*argv[])pg_attribute_noreturn;
290+
NON_EXEC_STATICvoidAutoVacLauncherMain(intargc,char*argv[])pg_attribute_noreturn;
291291

292292
staticOiddo_start_worker(void);
293293
staticvoidlauncher_determine_sleep(boolcanlaunch,boolrecursing,

‎src/backend/postmaster/pgarch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static volatile sig_atomic_t ready_to_stop = false;
8686
staticpid_tpgarch_forkexec(void);
8787
#endif
8888

89-
NON_EXEC_STATICvoidPgArchiverMain(intargc,char*argv[])__attribute__((noreturn));
89+
NON_EXEC_STATICvoidPgArchiverMain(intargc,char*argv[])pg_attribute_noreturn;
9090
staticvoidpgarch_exit(SIGNAL_ARGS);
9191
staticvoidArchSigHupHandler(SIGNAL_ARGS);
9292
staticvoidArchSigTermHandler(SIGNAL_ARGS);

‎src/backend/postmaster/pgstat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ static instr_time total_func_time;
251251
staticpid_tpgstat_forkexec(void);
252252
#endif
253253

254-
NON_EXEC_STATICvoidPgstatCollectorMain(intargc,char*argv[])__attribute__((noreturn));
254+
NON_EXEC_STATICvoidPgstatCollectorMain(intargc,char*argv[])pg_attribute_noreturn;
255255
staticvoidpgstat_exit(SIGNAL_ARGS);
256256
staticvoidpgstat_beshutdown_hook(intcode,Datumarg);
257257
staticvoidpgstat_sighup_handler(SIGNAL_ARGS);

‎src/backend/postmaster/postmaster.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,8 @@ static void LogChildExit(int lev, const char *procname,
380380
intpid,intexitstatus);
381381
staticvoidPostmasterStateMachine(void);
382382
staticvoidBackendInitialize(Port*port);
383-
staticvoidBackendRun(Port*port)__attribute__((noreturn));
384-
staticvoidExitPostmaster(intstatus)__attribute__((noreturn));
383+
staticvoidBackendRun(Port*port)pg_attribute_noreturn;
384+
staticvoidExitPostmaster(intstatus)pg_attribute_noreturn;
385385
staticintServerLoop(void);
386386
staticintBackendStartup(Port*port);
387387
staticintProcessStartupPacket(Port*port,boolSSLdone);

‎src/backend/postmaster/syslogger.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static volatile sig_atomic_t rotation_requested = false;
130130
staticpid_tsyslogger_forkexec(void);
131131
staticvoidsyslogger_parseArgs(intargc,char*argv[]);
132132
#endif
133-
NON_EXEC_STATICvoidSysLoggerMain(intargc,char*argv[])__attribute__((noreturn));
133+
NON_EXEC_STATICvoidSysLoggerMain(intargc,char*argv[])pg_attribute_noreturn;
134134
staticvoidprocess_pipe_input(char*logbuffer,int*bytes_in_logbuffer);
135135
staticvoidflush_pipe_input(char*logbuffer,int*bytes_in_logbuffer);
136136
staticvoidopen_csvlogfile(void);

‎src/backend/replication/repl_scanner.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ addlitchar(unsigned char ychar)
205205
appendStringInfoChar(&litbuf, ychar);
206206
}
207207

208-
void__attribute__((noreturn))
208+
voidpg_attribute_noreturn
209209
yyerror(constchar *message)
210210
{
211211
ereport(ERROR,

‎src/backend/replication/walsender.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ typedef void (*WalSndSendDataCallback) (void);
193193
staticvoidWalSndLoop(WalSndSendDataCallbacksend_data);
194194
staticvoidInitWalSenderSlot(void);
195195
staticvoidWalSndKill(intcode,Datumarg);
196-
staticvoidWalSndShutdown(void)__attribute__((noreturn));
196+
staticvoidWalSndShutdown(void)pg_attribute_noreturn;
197197
staticvoidXLogSendPhysical(void);
198198
staticvoidXLogSendLogical(void);
199199
staticvoidWalSndDone(WalSndSendDataCallbacksend_data);

‎src/backend/utils/error/elog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static const char *
8686
err_gettext(constchar*str)
8787
/* This extension allows gcc to check the format string for consistency with
8888
the supplied arguments. */
89-
__attribute__((format_arg(1)));
89+
pg_attribute_format_arg(1);
9090
staticvoidset_errdata_field(MemoryContextData*cxt,char**ptr,constchar*str);
9191

9292
/* Global variables */

‎src/backend/utils/misc/guc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ char *GUC_check_errhint_string;
132132
staticvoid
133133
do_serialize(char**destptr,Size*maxbytes,constchar*fmt,...)
134134
/* This lets gcc check the format string for consistency. */
135-
__attribute__((format(PG_PRINTF_ATTRIBUTE,3,4)));
135+
pg_attribute_printf(3,4);
136136

137137
staticvoidset_config_sourcefile(constchar*name,char*sourcefile,
138138
intsourceline);

‎src/bin/pg_ctl/pg_ctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static void
120120
write_stderr(constchar*fmt,...)
121121
/* This extension allows gcc to check the format string for consistency with
122122
the supplied arguments. */
123-
__attribute__((format(PG_PRINTF_ATTRIBUTE,1,2)));
123+
pg_attribute_printf(1,2);
124124
staticvoiddo_advice(void);
125125
staticvoiddo_help(void);
126126
staticvoidset_mode(char*modeopt);

‎src/bin/pg_dump/parallel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static ParallelSlot *GetMyPSlot(ParallelState *pstate);
8181
staticvoid
8282
parallel_msg_master(ParallelSlot*slot,constchar*modulename,
8383
constchar*fmt,va_listap)
84-
__attribute__((format(PG_PRINTF_ATTRIBUTE,3,0)));
84+
pg_attribute_printf(3,0);
8585
staticvoidarchive_close_connection(intcode,void*arg);
8686
staticvoidShutdownWorkersHard(ParallelState*pstate);
8787
staticvoidWaitForTerminatingWorkers(ParallelState*pstate);

‎src/bin/pg_dump/pg_backup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ extern void archputs(const char *s, Archive *AH);
280280
externint
281281
archprintf(Archive*AH,constchar*fmt,...)
282282
/* This extension allows gcc to check the format string */
283-
__attribute__((format(PG_PRINTF_ATTRIBUTE,2,3)));
283+
pg_attribute_printf(2,3);
284284

285285
#defineappendStringLiteralAH(buf,str,AH) \
286286
appendStringLiteral(buf, str, (AH)->encoding, (AH)->std_strings)

‎src/bin/pg_dump/pg_backup_archiver.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ struct _tocEntry
378378
externintparallel_restore(structParallelArgs*args);
379379
externvoidon_exit_close_archive(Archive*AHX);
380380

381-
externvoidwarn_or_exit_horribly(ArchiveHandle*AH,constchar*modulename,constchar*fmt,...)__attribute__((format(PG_PRINTF_ATTRIBUTE,3,4)));
381+
externvoidwarn_or_exit_horribly(ArchiveHandle*AH,constchar*modulename,constchar*fmt,...)pg_attribute_printf(3,4);
382382

383383
externvoidWriteTOC(ArchiveHandle*AH);
384384
externvoidReadTOC(ArchiveHandle*AH);
@@ -429,8 +429,8 @@ extern intReconnectToServer(ArchiveHandle *AH, const char *dbname, const char *
429429
externvoidDropBlobIfExists(ArchiveHandle*AH,Oidoid);
430430

431431
voidahwrite(constvoid*ptr,size_tsize,size_tnmemb,ArchiveHandle*AH);
432-
intahprintf(ArchiveHandle*AH,constchar*fmt,...)__attribute__((format(PG_PRINTF_ATTRIBUTE,2,3)));
432+
intahprintf(ArchiveHandle*AH,constchar*fmt,...)pg_attribute_printf(2,3);
433433

434-
voidahlog(ArchiveHandle*AH,intlevel,constchar*fmt,...)__attribute__((format(PG_PRINTF_ATTRIBUTE,3,4)));
434+
voidahlog(ArchiveHandle*AH,intlevel,constchar*fmt,...)pg_attribute_printf(3,4);
435435

436436
#endif

‎src/bin/pg_dump/pg_backup_tar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static void tarClose(ArchiveHandle *AH, TAR_MEMBER *TH);
115115
#ifdef__NOT_USED__
116116
staticchar*tarGets(char*buf,size_tlen,TAR_MEMBER*th);
117117
#endif
118-
staticinttarPrintf(ArchiveHandle*AH,TAR_MEMBER*th,constchar*fmt,...)__attribute__((format(PG_PRINTF_ATTRIBUTE,3,4)));
118+
staticinttarPrintf(ArchiveHandle*AH,TAR_MEMBER*th,constchar*fmt,...)pg_attribute_printf(3,4);
119119

120120
staticvoid_tarAddFile(ArchiveHandle*AH,TAR_MEMBER*th);
121121
staticTAR_MEMBER*_tarPositionTo(ArchiveHandle*AH,constchar*filename);

‎src/bin/pg_dump/pg_backup_utils.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ extern const char *progname;
3030
externvoidset_dump_section(constchar*arg,int*dumpSections);
3131
externvoid
3232
write_msg(constchar*modulename,constchar*fmt,...)
33-
__attribute__((format(PG_PRINTF_ATTRIBUTE,2,3)));
33+
pg_attribute_printf(2,3);
3434
externvoid
3535
vwrite_msg(constchar*modulename,constchar*fmt,va_listap)
36-
__attribute__((format(PG_PRINTF_ATTRIBUTE,2,0)));
36+
pg_attribute_printf(2,0);
3737
externvoidon_exit_nicely(on_exit_nicely_callbackfunction,void*arg);
38-
externvoidexit_nicely(intcode)__attribute__((noreturn));
38+
externvoidexit_nicely(intcode)pg_attribute_noreturn;
3939

4040
externvoid
4141
exit_horribly(constchar*modulename,constchar*fmt,...)
42-
__attribute__((format(PG_PRINTF_ATTRIBUTE,2,3),noreturn));
42+
pg_attribute_printf(2,3)pg_attribute_noreturn;
4343

4444
#endif/* PG_BACKUP_UTILS_H */

‎src/bin/psql/common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ extern bool setQFout(const char *fname);
2121
externvoid
2222
psql_error(constchar*fmt,...)
2323
/* This lets gcc check the format string for consistency. */
24-
__attribute__((format(PG_PRINTF_ATTRIBUTE,1,2)));
24+
pg_attribute_printf(1,2);
2525

2626
externvoidNoticeProcessor(void*arg,constchar*message);
2727

‎src/bin/psql/large_obj.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
staticvoid
1616
print_lo_result(constchar*fmt,...)
17-
__attribute__((format(PG_PRINTF_ATTRIBUTE,1,2)));
17+
pg_attribute_printf(1,2);
1818

1919
staticvoid
2020
print_lo_result(constchar*fmt,...)

‎src/include/bootstrap/bootstrap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ extern Form_pg_attribute attrtypes[MAXATTR];
3232
externintnumattr;
3333

3434

35-
externvoidAuxiliaryProcessMain(intargc,char*argv[])__attribute__((noreturn));
35+
externvoidAuxiliaryProcessMain(intargc,char*argv[])pg_attribute_noreturn;
3636

3737
externvoiderr_out(void);
3838

@@ -61,6 +61,6 @@ extern void boot_get_type_io_data(Oid typid,
6161
externintboot_yyparse(void);
6262

6363
externintboot_yylex(void);
64-
externvoidboot_yyerror(constchar*str)__attribute__((noreturn));
64+
externvoidboot_yyerror(constchar*str)pg_attribute_noreturn;
6565

6666
#endif/* BOOTSTRAP_H */

‎src/include/c.h

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,6 @@
156156
#definedummyretchar
157157
#endif
158158

159-
#ifndef__GNUC__
160-
#define__attribute__(_arg_)
161-
#endif
162-
163159
/* ----------------------------------------------------------------
164160
*Section 2:bool, true, false, TRUE, FALSE, NULL
165161
* ----------------------------------------------------------------
@@ -560,6 +556,47 @@ typedef NameData *Name;
560556
/* we don't currently need wider versions of the other ALIGN macros */
561557
#defineMAXALIGN64(LEN)TYPEALIGN64(MAXIMUM_ALIGNOF, (LEN))
562558

559+
/* ----------------
560+
* Attribute macros
561+
*
562+
* GCC: https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
563+
* GCC: https://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html
564+
* Sunpro: https://docs.oracle.com/cd/E18659_01/html/821-1384/gjzke.html
565+
* XLC: http://www-01.ibm.com/support/knowledgecenter/SSGH2K_11.1.0/com.ibm.xlc111.aix.doc/language_ref/function_attributes.html
566+
* XLC: http://www-01.ibm.com/support/knowledgecenter/SSGH2K_11.1.0/com.ibm.xlc111.aix.doc/language_ref/type_attrib.html
567+
* ----------------
568+
*/
569+
570+
/* only GCC supports the unused attribute */
571+
#ifdef__GNUC__
572+
#definepg_attribute_unused __attribute__((unused))
573+
#else
574+
#definepg_attribute_unused
575+
#endif
576+
577+
/* GCC and XLC support format attributes */
578+
#if defined(__GNUC__)|| defined(__IBMC__)
579+
#definepg_attribute_format_arg(a) __attribute__((format_arg(a)))
580+
#definepg_attribute_printf(f,a) __attribute__((format(PG_PRINTF_ATTRIBUTE, f, a)))
581+
#else
582+
#definepg_attribute_format_arg(a)
583+
#definepg_attribute_printf(f,a)
584+
#endif
585+
586+
/* GCC, Sunpro and XLC support aligned, packed and noreturn */
587+
#if defined(__GNUC__)|| defined(__SUNPRO_C)|| defined(__IBMC__)
588+
#definepg_attribute_aligned(a) __attribute__((aligned(a)))
589+
#definepg_attribute_noreturn __attribute__((noreturn))
590+
#definepg_attribute_packed __attribute__((packed))
591+
#else
592+
/*
593+
* NB: aligned and packed are not defined as empty as they affect code
594+
* functionality; they must be implemented by the compiler if they are to be
595+
* used.
596+
*/
597+
#definepg_attribute_noreturn
598+
#endif
599+
563600
/* ----------------------------------------------------------------
564601
*Section 6:assertions
565602
* ----------------------------------------------------------------
@@ -906,7 +943,7 @@ typedef NameData *Name;
906943
#ifdefUSE_ASSERT_CHECKING
907944
#definePG_USED_FOR_ASSERTS_ONLY
908945
#else
909-
#definePG_USED_FOR_ASSERTS_ONLY__attribute__((unused))
946+
#definePG_USED_FOR_ASSERTS_ONLYpg_attribute_unused
910947
#endif
911948

912949

@@ -973,7 +1010,7 @@ typedef NameData *Name;
9731010
externint
9741011
snprintf(char*str,size_tcount,constchar*fmt,...)
9751012
/* This extension allows gcc to check the format string */
976-
__attribute__((format(PG_PRINTF_ATTRIBUTE,3,4)));
1013+
pg_attribute_printf(3,4);
9771014
#endif
9781015

9791016
#if !HAVE_DECL_VSNPRINTF

‎src/include/common/fe_memutils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ extern void pfree(void *pointer);
2626
/* sprintf into a palloc'd buffer --- these are in psprintf.c */
2727
externchar*
2828
psprintf(constchar*fmt,...)
29-
__attribute__((format(PG_PRINTF_ATTRIBUTE,1,2)));
29+
pg_attribute_printf(1,2);
3030
externsize_t
3131
pvsnprintf(char*buf,size_tlen,constchar*fmt,va_listargs)
32-
__attribute__((format(PG_PRINTF_ATTRIBUTE,3,0)));
32+
pg_attribute_printf(3,0);
3333

3434
#endif/* FE_MEMUTILS_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp