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

Commitb5b3229

Browse files
committed
Avoid -Wconversion warnings from direct use of GET_n_BYTES macros.
The GET/SET_n_BYTES macros are meant to be infrastructure for theDatumGetFoo/FooGetDatum macros, which include a cast to the intendedtarget type. Using them directly without a cast, as DatumGetFloat4and friends previously did, can yield warnings when -Wconversion is on.This is of little significance when building Postgres proper, becausethere are such a huge number of such warnings in the server that nobodywould think -Wconversion is of any use. But some extensions build with-Wconversion due to outside constraints. Commit14cca1b did a disserviceto those extensions by moving DatumGetFloat4 et al into postgres.h,where they can now cause warnings in extension builds.To fix, use DatumGetInt32 and friends in place of the low-level macros.This is arguably a bit cleaner anyway.Chapman FlackDiscussion:https://postgr.es/m/592E4D04.1070609@anastigmatix.net
1 parent54e839f commitb5b3229

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎src/include/postgres.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ DatumGetFloat4(Datum X)
679679
float4retval;
680680
}myunion;
681681

682-
myunion.value=GET_4_BYTES(X);
682+
myunion.value=DatumGetInt32(X);
683683
returnmyunion.retval;
684684
}
685685
#else
@@ -704,7 +704,7 @@ Float4GetDatum(float4 X)
704704
}myunion;
705705

706706
myunion.value=X;
707-
returnSET_4_BYTES(myunion.retval);
707+
returnInt32GetDatum(myunion.retval);
708708
}
709709
#else
710710
externDatumFloat4GetDatum(float4X);
@@ -727,7 +727,7 @@ DatumGetFloat8(Datum X)
727727
float8retval;
728728
}myunion;
729729

730-
myunion.value=GET_8_BYTES(X);
730+
myunion.value=DatumGetInt64(X);
731731
returnmyunion.retval;
732732
}
733733
#else
@@ -753,7 +753,7 @@ Float8GetDatum(float8 X)
753753
}myunion;
754754

755755
myunion.value=X;
756-
returnSET_8_BYTES(myunion.retval);
756+
returnInt64GetDatum(myunion.retval);
757757
}
758758
#else
759759
externDatumFloat8GetDatum(float8X);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp