Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 996530f7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix clang-analyzer-core.uninitialized.Branch warnings" am: 54ac3c69

Change-Id: I70c5ddab762983999d392dec4ef03e7f5335b0b7
parents f471241f 54ac3c69
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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) {
+5 −2
Original line number Diff line number Diff line
@@ -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++;
    }