You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-09-16 09:06:18 +02:00
Remove -Wno-implicit-fallthrough and explicitly mark fallthrough.
Last time we tried this the markered seems a bit unreliable but __attribute__((fallthrough)) appears to work pretty well.
This commit is contained in:
@@ -97,9 +97,6 @@ warning_disable = [
|
||||
|
||||
# Warn if a structure’s initializer has some fields missing. Disable so we can initialize with {0}.
|
||||
'-Wno-missing-field-initializers',
|
||||
|
||||
# Warn when a switch case falls through. Disable because this an useful aspect of switches and tests should catch problems.
|
||||
'-Wno-implicit-fallthrough',
|
||||
]
|
||||
|
||||
add_project_arguments(cc.get_supported_arguments(warning_enable, warning_disable), language: 'c')
|
||||
|
@@ -90,36 +90,47 @@ strIdBitFromZN(const StringIdBit bit, const char *const buffer, size_t size)
|
||||
{
|
||||
case 12:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[11]] << 59;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
case 11:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[10]] << 54;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
case 10:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[9]] << 49;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
case 9:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[8]] << 44;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
case 8:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[7]] << 39;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
case 7:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[6]] << 34;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
case 6:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[5]] << 29;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
case 5:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[4]] << 24;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
case 4:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[3]] << 19;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
case 3:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[2]] << 14;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
case 2:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[1]] << 9;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
case 1:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[0]] << 4;
|
||||
@@ -181,30 +192,39 @@ strIdBitFromZN(const StringIdBit bit, const char *const buffer, size_t size)
|
||||
{
|
||||
case 10:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[9]] << 58;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
case 9:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[8]] << 52;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
case 8:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[7]] << 46;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
case 7:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[6]] << 40;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
case 6:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[5]] << 34;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
case 5:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[4]] << 28;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
case 4:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[3]] << 22;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
case 3:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[2]] << 16;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
case 2:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[1]] << 10;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
case 1:
|
||||
result |= (uint64_t)map[(uint8_t)buffer[0]] << 4;
|
||||
|
@@ -138,6 +138,8 @@ storageLstInsert(StorageList *const this, const unsigned int idx, const StorageI
|
||||
listInfo.detail.linkDestination = blbAdd(
|
||||
this->blob, strZ(info->linkDestination), strSize(info->linkDestination) + 1);
|
||||
}
|
||||
|
||||
__attribute__((fallthrough));
|
||||
}
|
||||
|
||||
case storageInfoLevelBasic:
|
||||
@@ -147,10 +149,13 @@ storageLstInsert(StorageList *const this, const unsigned int idx, const StorageI
|
||||
|
||||
if (info->versionId != NULL)
|
||||
listInfo.basic.versionId = blbAdd(this->blob, strZ(info->versionId), strSize(info->versionId) + 1);
|
||||
|
||||
__attribute__((fallthrough));
|
||||
}
|
||||
|
||||
case storageInfoLevelType:
|
||||
listInfo.type.type = info->type;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -195,6 +200,8 @@ storageLstGet(const StorageList *const this, const unsigned int idx)
|
||||
|
||||
if (listInfo->detail.linkDestination != NULL)
|
||||
result.linkDestination = strCatZ(strTrunc(this->linkDestination), listInfo->detail.linkDestination);
|
||||
|
||||
__attribute__((fallthrough));
|
||||
}
|
||||
|
||||
case storageInfoLevelBasic:
|
||||
@@ -204,10 +211,13 @@ storageLstGet(const StorageList *const this, const unsigned int idx)
|
||||
|
||||
if (listInfo->basic.versionId != NULL)
|
||||
result.versionId = strCatZ(strTrunc(this->versionId), listInfo->basic.versionId);
|
||||
|
||||
__attribute__((fallthrough));
|
||||
}
|
||||
|
||||
case storageInfoLevelType:
|
||||
result.type = listInfo->type.type;
|
||||
__attribute__((fallthrough));
|
||||
|
||||
default:
|
||||
break;
|
||||
|
Reference in New Issue
Block a user