Build: Major warnings cleanup

This is a major type-mismatch cleanup and warnings elimination.

The IAR toolchain runs with more warnings enabled than ARMCLANG or
GNUARM, which has resulted in this effort.

This should make it easier to enable "pedantic" mode also for GNUARM.

There are still a few warnings about jumping past variable
initialization and falling off the end of non-void functions, but there
are comments in some of these parts that implies that this is done to
catch programming errors, like having case labels for all possible enum
values.

Reordered initializer in tfm_attestation_req_mngr.c to eliminate CI
warning.

Disabled "Pe940" warnings in CommonConfig.cmake to suppress warnings
about inline assembly functions declared to return value that doesn't
declare a return value in the __ASM() statement.

Disabled "Pe546" warnings to supress warnings about jumping over
unused initializers.

Fixed what appears to be a copy/paste bug in tfm_ss_core_test.c.

Removed unused variable "ret" in Driver_PPC.c for AN519 and AN521, to
make it similar to AN524.

Signed-off-by: TTornblom <thomas.tornblom@iar.com>
Change-Id: I2b729c73e4b004cff6b0530cc1350fcf900e4272
diff --git a/lib/ext/qcbor/test/float_tests.c b/lib/ext/qcbor/test/float_tests.c
index 5fd320b..aaf7f49 100644
--- a/lib/ext/qcbor/test/float_tests.c
+++ b/lib/ext/qcbor/test/float_tests.c
@@ -82,7 +82,7 @@
     UsefulBufC HalfPrecision = UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spExpectedHalf);
 
     QCBORDecodeContext DC;
-    QCBORDecode_Init(&DC, HalfPrecision, 0);
+    QCBORDecode_Init(&DC, HalfPrecision, QCBOR_DECODE_MODE_NORMAL);
 
     QCBORItem Item;
 
@@ -210,7 +210,7 @@
         // Now parse the hand-constructed CBOR. This will invoke the
         // conversion to a float
         QCBORDecodeContext DC;
-        QCBORDecode_Init(&DC, UsefulOutBuf_OutUBuf(&UOB), 0);
+        QCBORDecode_Init(&DC, UsefulOutBuf_OutUBuf(&UOB), QCBOR_DECODE_MODE_NORMAL);
 
         QCBORItem Item;
 
diff --git a/lib/ext/qcbor/test/qcbor_decode_tests.c b/lib/ext/qcbor/test/qcbor_decode_tests.c
index a9e1fb2..e185617 100644
--- a/lib/ext/qcbor/test/qcbor_decode_tests.c
+++ b/lib/ext/qcbor/test/qcbor_decode_tests.c
@@ -2080,7 +2080,6 @@
 {
    QCBORDecodeContext DCtx;
    QCBORItem Item;
-   int nCBORError;
 
    QCBORDecode_Init(&DCtx,
                     UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spDateTestInput),
@@ -2092,7 +2091,7 @@
    QCBORDecode_SetCallerConfiguredTagList(&DCtx, &TagList);
 
    // String date
-   if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
+   if(QCBORDecode_GetNext(&DCtx, &Item))
       return -1;
    if(Item.uDataType != QCBOR_TYPE_DATE_STRING ||
       UsefulBuf_Compare(Item.val.dateString, UsefulBuf_FromSZ("1985-04-12"))){
@@ -2100,7 +2099,7 @@
    }
 
    // Epoch date
-   if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
+   if(QCBORDecode_GetNext(&DCtx, &Item))
       return -3;
    if(Item.uDataType != QCBOR_TYPE_DATE_EPOCH ||
       Item.val.epochDate.nSeconds != 1400000000 ||
@@ -2110,7 +2109,7 @@
 
    // Epoch date with extra CBOR_TAG_B64 tag that doesn't really mean anything
    // but want to be sure extra tag doesn't cause a problem
-   if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
+   if(QCBORDecode_GetNext(&DCtx, &Item))
       return -5;
    if(Item.uDataType != QCBOR_TYPE_DATE_EPOCH ||
       Item.val.epochDate.nSeconds != 1400000001 ||
@@ -2125,7 +2124,7 @@
    }
 
    // Epoch date in float format with fractional seconds
-   if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
+   if(QCBORDecode_GetNext(&DCtx, &Item))
       return -8;
    if(Item.uDataType != QCBOR_TYPE_DATE_EPOCH ||
       Item.val.epochDate.nSeconds != 1 ||
@@ -2550,7 +2549,6 @@
 {
    QCBORDecodeContext DCtx;
    QCBORItem Item;
-   int nCBORError;
 
    QCBORDecode_Init(&DCtx,
                     UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spBigNumInput),
@@ -2558,14 +2556,14 @@
 
 
    //
-   if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
+   if(QCBORDecode_GetNext(&DCtx, &Item))
       return -1;
    if(Item.uDataType != QCBOR_TYPE_ARRAY) {
       return -1;
    }
 
    //
-   if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
+   if(QCBORDecode_GetNext(&DCtx, &Item))
       return -1;
    if(Item.uDataType != QCBOR_TYPE_POSBIGNUM ||
       UsefulBuf_Compare(Item.val.bigNum, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spBigNum))){
@@ -2573,7 +2571,7 @@
    }
 
    //
-   if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
+   if(QCBORDecode_GetNext(&DCtx, &Item))
       return -1;
    if(Item.uDataType != QCBOR_TYPE_NEGBIGNUM ||
       UsefulBuf_Compare(Item.val.bigNum, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(spBigNum))){
@@ -2581,13 +2579,13 @@
    }
 
    //
-   if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
+   if(QCBORDecode_GetNext(&DCtx, &Item))
       return -1;
    if(Item.uDataType != QCBOR_TYPE_MAP) {
       return -1;
    }
 
-   if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
+   if(QCBORDecode_GetNext(&DCtx, &Item))
       return -1;
    if(Item.uDataType != QCBOR_TYPE_POSBIGNUM ||
       Item.uLabelType != QCBOR_TYPE_TEXT_STRING ||
@@ -2595,7 +2593,7 @@
       return -1;
    }
 
-   if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
+   if(QCBORDecode_GetNext(&DCtx, &Item))
       return -1;
    if(Item.uDataType != QCBOR_TYPE_POSBIGNUM ||
       Item.uLabelType != QCBOR_TYPE_INT64 ||
@@ -2604,7 +2602,7 @@
       return -1;
    }
 
-   if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
+   if(QCBORDecode_GetNext(&DCtx, &Item))
       return -1;
    if(Item.uDataType != QCBOR_TYPE_NEGBIGNUM ||
       Item.uLabelType != QCBOR_TYPE_TEXT_STRING ||
@@ -2612,7 +2610,7 @@
       return -1;
    }
 
-   if((nCBORError = QCBORDecode_GetNext(&DCtx, &Item)))
+   if(QCBORDecode_GetNext(&DCtx, &Item))
       return -1;
    if(Item.uDataType != QCBOR_TYPE_NEGBIGNUM ||
       Item.uLabelType != QCBOR_TYPE_INT64 ||
@@ -2634,9 +2632,8 @@
                                  QCBORItem *pItem)
 {
    QCBORItem Item;
-   int nCBORError;
 
-   if((nCBORError = QCBORDecode_GetNext(pCtx, &Item))) return -1;
+   if(QCBORDecode_GetNext(pCtx, &Item)) return -1;
    if(Item.uDataType != uDataType) return -1;
    if(uNestingLevel > 0) {
       if(Item.uLabelType != QCBOR_TYPE_INT64 &&
@@ -2811,7 +2808,7 @@
 static int32_t parse_indeflen_nested(UsefulBufC Nested, int nNestLevel)
 {
    QCBORDecodeContext DC;
-   QCBORDecode_Init(&DC, Nested, 0);
+   QCBORDecode_Init(&DC, Nested, QCBOR_DECODE_MODE_NORMAL);
 
    int j;
    for(j = 0; j < nNestLevel; j++) {
@@ -3421,7 +3418,8 @@
    // nothing can be done with it unless that is set up.
    QCBORDecodeContext DC;
    const uint8_t pMinimalCBOR[] = {0xa0}; // One empty map
-   QCBORDecode_Init(&DC, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(pMinimalCBOR),0);
+   QCBORDecode_Init(&DC, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(pMinimalCBOR),
+                    QCBOR_DECODE_MODE_NORMAL);
 
    // Set up an memory pool of 100 bytes
    // Then fish into the internals of the decode context
@@ -3519,7 +3517,8 @@
    // nothing can be done with it unless that is set up.
    QCBORDecodeContext DC;
    const uint8_t pMinimalCBOR[] = {0x62, 0x48, 0x69}; // "Hi"
-   QCBORDecode_Init(&DC, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(pMinimalCBOR),0);
+   QCBORDecode_Init(&DC, UsefulBuf_FROM_BYTE_ARRAY_LITERAL(pMinimalCBOR),
+                    QCBOR_DECODE_MODE_NORMAL);
 
    uint8_t pAllocatorBuffer[50];