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

Commitfbb2e9a

Browse files
committed
Fix assorted compiler warnings seen in the buildfarm.
Failure to use DatumGetFoo/FooGetDatum macros correctly, or at all,causes some warnings about sign conversion. This is just cosmeticat the moment but in principle it's a type violation, so clean upthe instances I could find.autoprewarm.c and sharedfileset.c contained code that unportablyassumed that pid_t is the same size as int. We've variously dealtwith this by casting pid_t to int or to unsigned long for printingpurposes; I went with the latter.Fix uninitialized-variable warning in RestoreGUCState. This isa live bug in some sense, but of no great significance given thatnobody is very likely to care what "line number" is associated witha GUC that hasn't got a source file recorded.
1 parent447dbf7 commitfbb2e9a

File tree

8 files changed

+54
-36
lines changed

8 files changed

+54
-36
lines changed

‎contrib/hstore/hstore_io.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,10 +1462,14 @@ hstore_to_jsonb_loose(PG_FUNCTION_ARGS)
14621462
HSTORE_VALLEN(entries,i));
14631463
if (IsValidJsonNumber(tmp.data,tmp.len))
14641464
{
1465+
Datumnumd;
1466+
14651467
val.type=jbvNumeric;
1466-
val.val.numeric=DatumGetNumeric(
1467-
DirectFunctionCall3(numeric_in,
1468-
CStringGetDatum(tmp.data),0,-1));
1468+
numd=DirectFunctionCall3(numeric_in,
1469+
CStringGetDatum(tmp.data),
1470+
ObjectIdGetDatum(InvalidOid),
1471+
Int32GetDatum(-1));
1472+
val.val.numeric=DatumGetNumeric(numd);
14691473
}
14701474
else
14711475
{

‎contrib/jsonb_plpython/jsonb_plpython.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,13 @@ PLyNumber_ToJsonbValue(PyObject *obj, JsonbValue *jbvNum)
325325

326326
PG_TRY();
327327
{
328-
num=DatumGetNumeric(DirectFunctionCall3(numeric_in,
329-
CStringGetDatum(str),0,-1));
328+
Datumnumd;
329+
330+
numd=DirectFunctionCall3(numeric_in,
331+
CStringGetDatum(str),
332+
ObjectIdGetDatum(InvalidOid),
333+
Int32GetDatum(-1));
334+
num=DatumGetNumeric(numd);
330335
}
331336
PG_CATCH();
332337
{

‎contrib/pg_prewarm/autoprewarm.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ autoprewarm_main(Datum main_arg)
180180
{
181181
LWLockRelease(&apw_state->lock);
182182
ereport(LOG,
183-
(errmsg("autoprewarm worker is already running under PID %d",
184-
apw_state->bgworker_pid)));
183+
(errmsg("autoprewarm worker is already running under PID %lu",
184+
(unsigned long)apw_state->bgworker_pid)));
185185
return;
186186
}
187187
apw_state->bgworker_pid=MyProcPid;
@@ -290,8 +290,8 @@ apw_load_buffers(void)
290290
{
291291
LWLockRelease(&apw_state->lock);
292292
ereport(LOG,
293-
(errmsg("skipping prewarm because block dump file is being written by PID %d",
294-
apw_state->pid_using_dumpfile)));
293+
(errmsg("skipping prewarm because block dump file is being written by PID %lu",
294+
(unsigned long)apw_state->pid_using_dumpfile)));
295295
return;
296296
}
297297
LWLockRelease(&apw_state->lock);
@@ -580,12 +580,12 @@ apw_dump_now(bool is_bgworker, bool dump_unlogged)
580580
{
581581
if (!is_bgworker)
582582
ereport(ERROR,
583-
(errmsg("could not perform block dump because dump file is being used by PID %d",
584-
apw_state->pid_using_dumpfile)));
583+
(errmsg("could not perform block dump because dump file is being used by PID %lu",
584+
(unsigned long)apw_state->pid_using_dumpfile)));
585585

586586
ereport(LOG,
587-
(errmsg("skipping block dump because it is already being performed by PID %d",
588-
apw_state->pid_using_dumpfile)));
587+
(errmsg("skipping block dump because it is already being performed by PID %lu",
588+
(unsigned long)apw_state->pid_using_dumpfile)));
589589
return0;
590590
}
591591

@@ -717,8 +717,8 @@ autoprewarm_start_worker(PG_FUNCTION_ARGS)
717717
if (pid!=InvalidPid)
718718
ereport(ERROR,
719719
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
720-
errmsg("autoprewarm worker is already running under PID %d",
721-
pid)));
720+
errmsg("autoprewarm worker is already running under PID %lu",
721+
(unsigned long)pid)));
722722

723723
apw_start_master_worker();
724724

‎src/backend/storage/file/sharedfileset.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ SharedFileSetPath(char *path, SharedFileSet *fileset, Oid tablespace)
214214
chartempdirpath[MAXPGPATH];
215215

216216
TempTablespacePath(tempdirpath,tablespace);
217-
snprintf(path,MAXPGPATH,"%s/%s%d.%u.sharedfileset",
217+
snprintf(path,MAXPGPATH,"%s/%s%lu.%u.sharedfileset",
218218
tempdirpath,PG_TEMP_FILE_PREFIX,
219-
fileset->creator_pid,fileset->number);
219+
(unsigned long)fileset->creator_pid,fileset->number);
220220
}
221221

222222
/*

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ jsonb_in_scalar(void *pstate, char *token, JsonTokenType tokentype)
343343
{
344344
JsonbInState*_state= (JsonbInState*)pstate;
345345
JsonbValuev;
346+
Datumnumd;
346347

347348
switch (tokentype)
348349
{
@@ -361,18 +362,19 @@ jsonb_in_scalar(void *pstate, char *token, JsonTokenType tokentype)
361362
*/
362363
Assert(token!=NULL);
363364
v.type=jbvNumeric;
364-
v.val.numeric=DatumGetNumeric(DirectFunctionCall3(numeric_in,CStringGetDatum(token),0,-1));
365-
365+
numd=DirectFunctionCall3(numeric_in,
366+
CStringGetDatum(token),
367+
ObjectIdGetDatum(InvalidOid),
368+
Int32GetDatum(-1));
369+
v.val.numeric=DatumGetNumeric(numd);
366370
break;
367371
caseJSON_TOKEN_TRUE:
368372
v.type=jbvBool;
369373
v.val.boolean= true;
370-
371374
break;
372375
caseJSON_TOKEN_FALSE:
373376
v.type=jbvBool;
374377
v.val.boolean= false;
375-
376378
break;
377379
caseJSON_TOKEN_NULL:
378380
v.type=jbvNull;
@@ -772,9 +774,14 @@ datum_to_jsonb(Datum val, bool is_null, JsonbInState *result,
772774
strchr(outputstr,'n')!=NULL);
773775
if (!numeric_error)
774776
{
775-
jb.type=jbvNumeric;
776-
jb.val.numeric=DatumGetNumeric(DirectFunctionCall3(numeric_in,CStringGetDatum(outputstr),0,-1));
777+
Datumnumd;
777778

779+
jb.type=jbvNumeric;
780+
numd=DirectFunctionCall3(numeric_in,
781+
CStringGetDatum(outputstr),
782+
ObjectIdGetDatum(InvalidOid),
783+
Int32GetDatum(-1));
784+
jb.val.numeric=DatumGetNumeric(numd);
778785
pfree(outputstr);
779786
}
780787
else

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3818,8 +3818,8 @@ numeric_avg_deserialize(PG_FUNCTION_ARGS)
38183818
/* sumX */
38193819
temp=DirectFunctionCall3(numeric_recv,
38203820
PointerGetDatum(&buf),
3821-
InvalidOid,
3822-
-1);
3821+
ObjectIdGetDatum(InvalidOid),
3822+
Int32GetDatum(-1));
38233823
init_var_from_num(DatumGetNumeric(temp),&tmp_var);
38243824
accum_sum_add(&(result->sumX),&tmp_var);
38253825

@@ -3941,16 +3941,16 @@ numeric_deserialize(PG_FUNCTION_ARGS)
39413941
/* sumX */
39423942
temp=DirectFunctionCall3(numeric_recv,
39433943
PointerGetDatum(&buf),
3944-
InvalidOid,
3945-
-1);
3944+
ObjectIdGetDatum(InvalidOid),
3945+
Int32GetDatum(-1));
39463946
init_var_from_num(DatumGetNumeric(temp),&sumX_var);
39473947
accum_sum_add(&(result->sumX),&sumX_var);
39483948

39493949
/* sumX2 */
39503950
temp=DirectFunctionCall3(numeric_recv,
39513951
PointerGetDatum(&buf),
3952-
InvalidOid,
3953-
-1);
3952+
ObjectIdGetDatum(InvalidOid),
3953+
Int32GetDatum(-1));
39543954
init_var_from_num(DatumGetNumeric(temp),&sumX2_var);
39553955
accum_sum_add(&(result->sumX2),&sumX2_var);
39563956

@@ -4340,14 +4340,14 @@ numeric_poly_deserialize(PG_FUNCTION_ARGS)
43404340
/* sumX */
43414341
sumX=DirectFunctionCall3(numeric_recv,
43424342
PointerGetDatum(&buf),
4343-
InvalidOid,
4344-
-1);
4343+
ObjectIdGetDatum(InvalidOid),
4344+
Int32GetDatum(-1));
43454345

43464346
/* sumX2 */
43474347
sumX2=DirectFunctionCall3(numeric_recv,
43484348
PointerGetDatum(&buf),
4349-
InvalidOid,
4350-
-1);
4349+
ObjectIdGetDatum(InvalidOid),
4350+
Int32GetDatum(-1));
43514351

43524352
init_var_from_num(DatumGetNumeric(sumX),&sumX_var);
43534353
#ifdefHAVE_INT128
@@ -4550,8 +4550,8 @@ int8_avg_deserialize(PG_FUNCTION_ARGS)
45504550
/* sumX */
45514551
temp=DirectFunctionCall3(numeric_recv,
45524552
PointerGetDatum(&buf),
4553-
InvalidOid,
4554-
-1);
4553+
ObjectIdGetDatum(InvalidOid),
4554+
Int32GetDatum(-1));
45554555
init_var_from_num(DatumGetNumeric(temp),&num);
45564556
#ifdefHAVE_INT128
45574557
numericvar_to_int128(&num,&result->sumX);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
813813
*/
814814
nulls[12]= true;
815815
nulls[13]= true;
816-
values[14]=DatumGetInt32(-1);
816+
values[14]=Int32GetDatum(-1);
817817
}
818818
else
819819
{

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9610,6 +9610,8 @@ RestoreGUCState(void *gucstate)
96109610
if (varsourcefile[0])
96119611
read_gucstate_binary(&srcptr,srcend,
96129612
&varsourceline,sizeof(varsourceline));
9613+
else
9614+
varsourceline=0;
96139615
read_gucstate_binary(&srcptr,srcend,
96149616
&varsource,sizeof(varsource));
96159617
read_gucstate_binary(&srcptr,srcend,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp