diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2017-03-28 13:16:19 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2017-03-28 13:16:19 -0400 |
commit | 16e815279135ea70616692c8bade43d9f1e1d05e (patch) | |
tree | 32396e3b780420bd1a8fe028f8de34170ec4f2d6 | |
parent | 24fc43d40aad5f888f22af9a543113a168a08307 (diff) | |
download | postgresql-16e815279135ea70616692c8bade43d9f1e1d05e.tar.gz postgresql-16e815279135ea70616692c8bade43d9f1e1d05e.zip |
Suppress implicit-conversion warnings seen with newer clang versions.
We were assigning values near 255 through "char *" pointers. On machines
where char is signed, that's not entirely kosher, and it's reasonable
for compilers to warn about it.
A better solution would be to change the pointer type to "unsigned char *",
but that would be vastly more invasive. For the moment, let's just apply
this simple backpatchable solution.
Aleksander Alekseev
Discussion: https://postgr.es/m/20170220141239.GD12278@e733.localdomain
Discussion: https://postgr.es/m/2839.1490714708@sss.pgh.pa.us
-rw-r--r-- | src/backend/access/transam/xlog.c | 2 | ||||
-rw-r--r-- | src/backend/access/transam/xloginsert.c | 6 | ||||
-rw-r--r-- | src/bin/pg_resetxlog/pg_resetxlog.c | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index e42e1027d3f..cd81c600fc7 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -4830,7 +4830,7 @@ BootStrapXLOG(void) record->xl_rmid = RM_XLOG_ID; recptr += SizeOfXLogRecord; /* fill the XLogRecordDataHeaderShort struct */ - *(recptr++) = XLR_BLOCK_ID_DATA_SHORT; + *(recptr++) = (char) XLR_BLOCK_ID_DATA_SHORT; *(recptr++) = sizeof(checkPoint); memcpy(recptr, &checkPoint, sizeof(checkPoint)); recptr += sizeof(checkPoint); diff --git a/src/backend/access/transam/xloginsert.c b/src/backend/access/transam/xloginsert.c index 925c430f072..dbc906c38a6 100644 --- a/src/backend/access/transam/xloginsert.c +++ b/src/backend/access/transam/xloginsert.c @@ -703,7 +703,7 @@ XLogRecordAssemble(RmgrId rmid, uint8 info, /* followed by the record's origin, if any */ if (include_origin && replorigin_session_origin != InvalidRepOriginId) { - *(scratch++) = XLR_BLOCK_ID_ORIGIN; + *(scratch++) = (char) XLR_BLOCK_ID_ORIGIN; memcpy(scratch, &replorigin_session_origin, sizeof(replorigin_session_origin)); scratch += sizeof(replorigin_session_origin); } @@ -713,13 +713,13 @@ XLogRecordAssemble(RmgrId rmid, uint8 info, { if (mainrdata_len > 255) { - *(scratch++) = XLR_BLOCK_ID_DATA_LONG; + *(scratch++) = (char) XLR_BLOCK_ID_DATA_LONG; memcpy(scratch, &mainrdata_len, sizeof(uint32)); scratch += sizeof(uint32); } else { - *(scratch++) = XLR_BLOCK_ID_DATA_SHORT; + *(scratch++) = (char) XLR_BLOCK_ID_DATA_SHORT; *(scratch++) = (uint8) mainrdata_len; } rdt_datas_last->next = mainrdata_head; diff --git a/src/bin/pg_resetxlog/pg_resetxlog.c b/src/bin/pg_resetxlog/pg_resetxlog.c index 6615aea509f..75a9d2c89e5 100644 --- a/src/bin/pg_resetxlog/pg_resetxlog.c +++ b/src/bin/pg_resetxlog/pg_resetxlog.c @@ -1100,7 +1100,7 @@ WriteEmptyXLOG(void) record->xl_rmid = RM_XLOG_ID; recptr += SizeOfXLogRecord; - *(recptr++) = XLR_BLOCK_ID_DATA_SHORT; + *(recptr++) = (char) XLR_BLOCK_ID_DATA_SHORT; *(recptr++) = sizeof(CheckPoint); memcpy(recptr, &ControlFile.checkPointCopy, sizeof(CheckPoint)); |