Merge "Fix clang-analyzer-core.uninitialized.Branch warnings" am: 54ac3c6932 am: 996530f7c1
Change-Id: Ic0e0fe3c131c1f9960251204db36a42d2e92035e
This commit is contained in:
@@ -200,7 +200,7 @@ skip_bytes(int fd, ssize_t size, char* scratch, int scratchSize)
|
||||
|
||||
static int
|
||||
skip_unknown_field(int fd, uint64_t tag, char* scratch, int scratchSize) {
|
||||
bool done;
|
||||
bool done = false;
|
||||
int err;
|
||||
uint64_t size;
|
||||
switch (tag & 0x7) {
|
||||
|
||||
@@ -368,10 +368,13 @@ static bool generatePrivacyFlags(const Descriptor* descriptor, const Destination
|
||||
// Don't generate a variable twice
|
||||
if (!hasDefaultFlags[i]) variableNames[fieldName] = false;
|
||||
}
|
||||
// hasDefaultFlags[i] has been initialized in the above for-loop,
|
||||
// but clang-tidy analyzer still report uninitized values.
|
||||
// So we use NOLINT to suppress those false positives.
|
||||
|
||||
bool allDefaults = true;
|
||||
for (size_t i=0; i<fieldsInOrder.size(); i++) {
|
||||
allDefaults &= hasDefaultFlags[i];
|
||||
allDefaults &= hasDefaultFlags[i]; // NOLINT(clang-analyzer-core.uninitialized.Assign)
|
||||
}
|
||||
|
||||
parents->erase(messageName); // erase the message type name when exit the message.
|
||||
@@ -384,7 +387,7 @@ static bool generatePrivacyFlags(const Descriptor* descriptor, const Destination
|
||||
printf("Privacy* %s[] = {\n", messageName.c_str());
|
||||
for (size_t i=0; i<fieldsInOrder.size(); i++) {
|
||||
const FieldDescriptor* field = fieldsInOrder[i];
|
||||
if (hasDefaultFlags[i]) continue;
|
||||
if (hasDefaultFlags[i]) continue; // NOLINT(clang-analyzer-core.uninitialized.Branch)
|
||||
printf(" &%s,\n", getFieldName(field).c_str());
|
||||
policyCount++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user