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

Commit3691edf

Browse files
committed
pg_noreturn to replace pg_attribute_noreturn()
We want to support a "noreturn" decoration on more compilers besidesjust GCC-compatible ones, but for that we need to move the decorationin front of the function declaration instead of either behind it orwherever, which is the current style afforded by GCC-style attributes.Also rename the macro to "pg_noreturn" to be similar to the C11standard "noreturn".pg_noreturn is now supported on all compilers that support C11 (using_Noreturn), as well as GCC-compatible ones (using __attribute__, asbefore), as well as MSVC (using __declspec). (When PostgreSQLrequires C11, the latter two variants can be dropped.)Now, all supported compilers effectively support pg_noreturn, so theextra code for !HAVE_PG_ATTRIBUTE_NORETURN can be dropped.This also fixes a possible problem if third-party code includesstdnoreturn.h, because then the current definition of #define pg_attribute_noreturn() __attribute__((noreturn))would cause an error.Note that the C standard does not support a noreturn attribute onfunction pointer types. So we have to drop these here. There areonly two instances at this time, so it's not a big loss. In one case,we can make up for it by adding the pg_noreturn to a wrapper functionand adding a pg_unreachable(), in the other case, the latter wasalready done before.Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>Reviewed-by: Andres Freund <andres@anarazel.de>Discussion:https://www.postgresql.org/message-id/flat/pxr5b3z7jmkpenssra5zroxi7qzzp6eswuggokw64axmdixpnk@zbwxuq7gbbcw
1 parentcc5d985 commit3691edf

File tree

54 files changed

+118
-118
lines changed

Some content is hidden

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

54 files changed

+118
-118
lines changed

‎contrib/dblink/dblink.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ xpstrdup(const char *in)
160160
returnpstrdup(in);
161161
}
162162

163-
staticvoid
164-
pg_attribute_noreturn()
163+
pg_noreturnstaticvoid
165164
dblink_res_internalerror(PGconn*conn,PGresult*res,constchar*p2)
166165
{
167166
char*msg=pchomp(PQerrorMessage(conn));
@@ -170,8 +169,7 @@ dblink_res_internalerror(PGconn *conn, PGresult *res, const char *p2)
170169
elog(ERROR,"%s: %s",p2,msg);
171170
}
172171

173-
staticvoid
174-
pg_attribute_noreturn()
172+
pg_noreturnstaticvoid
175173
dblink_conn_not_avail(constchar*conname)
176174
{
177175
if (conname)

‎contrib/pgcrypto/px.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ intpx_find_hmac(const char *name, PX_HMAC **res);
181181
intpx_find_cipher(constchar*name,PX_Cipher**res);
182182
intpx_find_combo(constchar*name,PX_Combo**res);
183183

184-
voidpx_THROW_ERROR(interr)pg_attribute_noreturn();
184+
pg_noreturnvoidpx_THROW_ERROR(interr);
185185
constchar*px_strerror(interr);
186186

187187
constchar*px_resolve_alias(constPX_Alias*list,constchar*name);

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4778,8 +4778,7 @@ check_primary_slot_name(char **newval, void **extra, GucSource source)
47784778
* that we have odd behaviors such as unexpected GUC ordering dependencies.
47794779
*/
47804780

4781-
staticvoid
4782-
pg_attribute_noreturn()
4781+
pg_noreturnstaticvoid
47834782
error_multiple_recovery_targets(void)
47844783
{
47854784
ereport(ERROR,

‎src/backend/backup/basebackup_incremental.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ static void manifest_process_wal_range(JsonManifestParseContext *context,
139139
TimeLineIDtli,
140140
XLogRecPtrstart_lsn,
141141
XLogRecPtrend_lsn);
142-
staticvoidmanifest_report_error(JsonManifestParseContext*context,
143-
constchar*fmt,...)
144-
pg_attribute_printf(2,3)pg_attribute_noreturn();
142+
pg_noreturnstaticvoidmanifest_report_error(JsonManifestParseContext*context,
143+
constchar*fmt,...)
144+
pg_attribute_printf(2,3);
145145
staticintcompare_block_numbers(constvoid*a,constvoid*b);
146146

147147
/*

‎src/backend/postmaster/autovacuum.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ intAutovacuumLauncherPid = 0;
317317

318318
staticOiddo_start_worker(void);
319319
staticvoidProcessAutoVacLauncherInterrupts(void);
320-
staticvoidAutoVacLauncherShutdown(void)pg_attribute_noreturn();
320+
pg_noreturnstaticvoidAutoVacLauncherShutdown(void);
321321
staticvoidlauncher_determine_sleep(boolcanlaunch,boolrecursing,
322322
structtimeval*nap);
323323
staticvoidlaunch_worker(TimestampTznow);

‎src/backend/postmaster/launch_backend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static pid_t internal_forkexec(const char *child_kind, int child_slot,
171171
typedefstruct
172172
{
173173
constchar*name;
174-
void(*main_fn) (constvoid*startup_data,size_tstartup_data_len)pg_attribute_noreturn();
174+
void(*main_fn) (constvoid*startup_data,size_tstartup_data_len);
175175
boolshmem_attach;
176176
}child_process_kind;
177177

‎src/backend/postmaster/postmaster.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ static void LogChildExit(int lev, const char *procname,
425425
staticvoidPostmasterStateMachine(void);
426426
staticvoidUpdatePMState(PMStatenewState);
427427

428-
staticvoidExitPostmaster(intstatus)pg_attribute_noreturn();
428+
pg_noreturnstaticvoidExitPostmaster(intstatus);
429429
staticintServerLoop(void);
430430
staticintBackendStartup(ClientSocket*client_sock);
431431
staticvoidreport_fork_failure_to_client(ClientSocket*client_sock,interrnum);

‎src/backend/replication/logical/tablesync.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ static StringInfo copybuf = NULL;
139139
/*
140140
* Exit routine for synchronization worker.
141141
*/
142-
staticvoid
143-
pg_attribute_noreturn()
142+
pg_noreturnstaticvoid
144143
finish_sync_worker(void)
145144
{
146145
/*

‎src/backend/replication/walsender.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ typedef void (*WalSndSendDataCallback) (void);
237237
staticvoidWalSndLoop(WalSndSendDataCallbacksend_data);
238238
staticvoidInitWalSenderSlot(void);
239239
staticvoidWalSndKill(intcode,Datumarg);
240-
staticvoidWalSndShutdown(void)pg_attribute_noreturn();
240+
pg_noreturnstaticvoidWalSndShutdown(void);
241241
staticvoidXLogSendPhysical(void);
242242
staticvoidXLogSendLogical(void);
243243
staticvoidWalSndDone(WalSndSendDataCallbacksend_data);

‎src/backend/utils/adt/ri_triggers.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,10 @@ static bool ri_PerformCheck(const RI_ConstraintInfo *riinfo,
235235
staticvoidri_ExtractValues(Relationrel,TupleTableSlot*slot,
236236
constRI_ConstraintInfo*riinfo,boolrel_is_pk,
237237
Datum*vals,char*nulls);
238-
staticvoidri_ReportViolation(constRI_ConstraintInfo*riinfo,
239-
Relationpk_rel,Relationfk_rel,
240-
TupleTableSlot*violatorslot,TupleDesctupdesc,
241-
intqueryno,boolis_restrict,boolpartgone)pg_attribute_noreturn();
238+
pg_noreturnstaticvoidri_ReportViolation(constRI_ConstraintInfo*riinfo,
239+
Relationpk_rel,Relationfk_rel,
240+
TupleTableSlot*violatorslot,TupleDesctupdesc,
241+
intqueryno,boolis_restrict,boolpartgone);
242242

243243

244244
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp