Small cleanup of QCBOR_DISABLE_EXP_AND_MANTISSA, remove QCBOR_DISABLE_UNCOMMON_TAGS

Expand test coverage for decimal fractions. Fix c++ for qcbor_decode_tags.h. Close out some tag-related TODO's that didn't need much. Tidy up  QCBOR_DISABLE_EXP_AND_MANTISSA #ifdefs


* Small cleanup of QCBOR_DISABLE_EXP_AND_MANTISSA

* Remove DISABLE_UNCOMMON_TAGS

* expand decimal frac test coverage; close out todo's

---------

Co-authored-by: Laurence Lundblade <lgl@securitytheory.com>
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1e233d2..a6f27ac 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -51,10 +51,6 @@
           container: ubuntu:22.04
           dis-xxx: '-DQCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS'
 
-        - os-image: ubuntu-latest
-          container: ubuntu:22.04
-          dis-xxx: '-DQCBOR_DISABLE_UNCOMMON_TAGS'
-
 
     name: ${{ matrix.config.dis-xxx }} • ${{ matrix.c-compiler }} • ${{ matrix.config.container }}
 
diff --git a/README.md b/README.md
index 805279d..0be7770 100644
--- a/README.md
+++ b/README.md
@@ -445,16 +445,25 @@
 
 ### Disabling Features
 
-Here's the list of all features that can be disabled to save object
-code. The amount saved is an approximation.
+The following table is all the features that can be disabled and an
+approximate amount by which they reduce the total size of the library.
+Note that in many cases enabling dead stripping and not calling
+functions will reduce what is linked from the library by a lot.
+
+For example, not calling any function that operates on big floats or
+decimal fractions will save the 5000 bytes listed even without
+QCBOR_DISABLE_EXP_AND_MANTISSA. But also note that the configuration
+option still exists because some may wish to use the number conversion
+functions with their support for decimal fractions and big numbers
+disabled.
+
 
     | #define                                 | Saves |
     | ----------------------------------------| ------|
     | QCBOR_DISABLE_ENCODE_USAGE_GUARDS       |   150 |
     | QCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS |   400 |
     | QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS  |   200 |
-    | QCBOR_DISABLE_UNCOMMON_TAGS             |   100 |
-    | QCBOR_DISABLE_EXP_AND_MANTISSA          |   400 |
+    | QCBOR_DISABLE_EXP_AND_MANTISSA          |  5000 |
     | QCBOR_DISABLE_PREFERRED_FLOAT           |   900 |
     | QCBOR_DISABLE_FLOAT_HW_USE              |    50 |
     | QCBOR_DISABLE_TAGS                      |   400 |
@@ -486,9 +495,9 @@
 QCBOR_DISABLE_INDEFINITE_LENGTH_ARRAYS which will result in an error
 when an indefinite-length map or array arrives for decoding.
 
-QCBOR_DISABLE_UNCOMMON_TAGS disables the decoding of explicit tags for
-base 64, regex, UUID and MIME data. This just disables the automatic
-recognition of these from a major type 6 tag.
+QCBOR_DISABLE_UNCOMMON_TAGS is removed from QCBOR v2. It didn't save
+very much and you can get the same effect by not install
+the tag content handlers.
 
 QCBOR_DISABLE_EXP_AND_MANTISSA disables the decoding of decimal
 fractions and big floats.
diff --git a/inc/qcbor/qcbor_common.h b/inc/qcbor/qcbor_common.h
index 89bfd00..d986742 100644
--- a/inc/qcbor/qcbor_common.h
+++ b/inc/qcbor/qcbor_common.h
@@ -33,8 +33,6 @@
 #ifndef qcbor_common_h
 #define qcbor_common_h
 
-//TODO: get rid of  QCBOR_DISABLE_EXP_AND_MANTISSA and uncommon tags
-
 #ifdef __cplusplus
 extern "C" {
 #if 0
diff --git a/inc/qcbor/qcbor_encode.h b/inc/qcbor/qcbor_encode.h
index 2270544..2ceb999 100644
--- a/inc/qcbor/qcbor_encode.h
+++ b/inc/qcbor/qcbor_encode.h
@@ -2670,7 +2670,7 @@
                                     UsefulBufC          BigNumber);
 
 
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
 /* Deprecated. Use QCBOREncode_AddTDecimalFraction() instead */
 static void
 QCBOREncode_AddDecimalFraction(QCBOREncodeContext *pCtx,
@@ -2798,7 +2798,7 @@
                                     UsefulBufC          Mantissa,
                                     bool                bIsNegative,
                                     int64_t             nBase2Exponent);
-#endif /* ! QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* ! QCBOR_DISABLE_EXP_AND_MANTISSA */
 
 
 /* ========================================================================= *
@@ -2899,7 +2899,7 @@
 QCBOREncode_AddNegativeBignumToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, UsefulBufC BigNumber);
 
 
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
 
 /* Use QCBOREncode_AddTDecimalFraction() instead */
 static void
@@ -2986,7 +2986,7 @@
                                     UsefulBufC          Mantissa,
                                     bool                bIsNegative,
                                     int64_t             nBase2Exponent);
-#endif /* ! QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* ! QCBOR_DISABLE_EXP_AND_MANTISSA */
 
 /* Use QCBOREncode_AddTURI() instead */
 static void
diff --git a/inc/qcbor/qcbor_spiffy_decode.h b/inc/qcbor/qcbor_spiffy_decode.h
index e690f31..16542d5 100644
--- a/inc/qcbor/qcbor_spiffy_decode.h
+++ b/inc/qcbor/qcbor_spiffy_decode.h
@@ -2368,7 +2368,7 @@
                              UsefulBufC         *pValue,
                              bool               *pbIsNegative);
 
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
 /* Use QCBORDecode_GetTDecimalFraction() instead */
 static void
 QCBORDecode_GetDecimalFraction(QCBORDecodeContext *pCtx,
@@ -2483,7 +2483,7 @@
                                   UsefulBufC         *pMantissa,
                                   bool               *pbMantissaIsNegative,
                                   int64_t            *pnExponent);
-#endif /* ! QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* ! QCBOR_DISABLE_EXP_AND_MANTISSA */
 
 
 
@@ -3443,7 +3443,7 @@
    QCBORDecode_GetTBigNumberRawInMapSZ(pMe, szLabel, uTagRequirement, pBigNumber, pbIsNegative);
 }
 
-#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
+#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
 static inline void
 QCBORDecode_GetDecimalFraction(QCBORDecodeContext *pMe,
                                uint8_t             uTagRequirement,
@@ -3591,7 +3591,7 @@
                                                  pbMantissaIsNegative,
                                                  pnExponent);
 }
-#endif /* ! QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
+#endif /* ! QCBOR_DISABLE_EXP_AND_MANTISSA */
 
 #ifdef __cplusplus
 }
diff --git a/inc/qcbor/qcbor_tag_decode.h b/inc/qcbor/qcbor_tag_decode.h
index 137ed35..7efd9e2 100644
--- a/inc/qcbor/qcbor_tag_decode.h
+++ b/inc/qcbor/qcbor_tag_decode.h
@@ -15,6 +15,13 @@
 
 #include "qcbor/qcbor_decode.h"
 
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} // Keep editor indention formatting happy
+#endif
+#endif
+
 /**
  * @file qcbor_tag_decode.h
  *
@@ -40,7 +47,7 @@
 
 
 /*
-
+ TODO: integrate this
  In v1, some spiffy decode functions ignored tag numbers and
  some didn't.  For example, GetInt64 ignored and GetString didn't.
  The "GetXxx" where Xxxx is a tag ignore conditionally based
@@ -305,6 +312,7 @@
                       uint64_t            uTagNumber,
                       QCBORItem          *pDecodedItem);
 
+
 /**
  * @brief Decode decimal fractions and big floats.
  *
@@ -338,9 +346,11 @@
 
 
 
-/* ------------------------------------------------------------------------
- * Inline implementations of public functions defined above.
- * ---- */
+/* ========================================================================= *
+ *    BEGINNING OF PRIVATE INLINE IMPLEMENTATION                             *
+ * ========================================================================= */
+
+
 #ifndef QCBOR_DISABLE_TAGS
 static inline void
 QCBORDecode_InstallTagDecoders(QCBORDecodeContext                *pMe,
@@ -353,4 +363,14 @@
 
 #endif /* ! QCBOR_DISABLE_TAGS */
 
+
+/* ======================================================================== *
+ *    END OF PRIVATE INLINE IMPLEMENTATION                                  *
+ * ======================================================================== */
+
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* qcbor_tag_decode_h */
diff --git a/src/qcbor_decode.c b/src/qcbor_decode.c
index 2992ce1..73ae425 100644
--- a/src/qcbor_decode.c
+++ b/src/qcbor_decode.c
@@ -5637,7 +5637,7 @@
    return (*pfExp)(uMantissa, nExponent, puResult);
 }
 
-#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
+#endif /* ! QCBOR_DISABLE_EXP_AND_MANTISSA */
 
 
 
@@ -6060,7 +6060,7 @@
             return QCBOR_ERR_UNEXPECTED_TYPE;
          }
          break;
-#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
+#endif /* ! QCBOR_DISABLE_EXP_AND_MANTISSA */
 
 
       default:
@@ -6459,7 +6459,7 @@
             return QCBOR_ERR_UNEXPECTED_TYPE;
          }
          break;
-#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
+#endif /* ! QCBOR_DISABLE_EXP_AND_MANTISSA */
       default:
          return QCBOR_ERR_UNEXPECTED_TYPE;
    }
diff --git a/src/qcbor_tag_decode.c b/src/qcbor_tag_decode.c
index 36e8dae..33e8dba 100644
--- a/src/qcbor_tag_decode.c
+++ b/src/qcbor_tag_decode.c
@@ -182,7 +182,7 @@
          return uBase;
 
       case QCBOR_TYPE_UINT64:
-         return uBase + (QCBOR_TYPE_DECIMAL_FRACTION_POS_U64 - QCBOR_TYPE_DECIMAL_FRACTION); // TODO: test this
+         return uBase + (QCBOR_TYPE_DECIMAL_FRACTION_POS_U64 - QCBOR_TYPE_DECIMAL_FRACTION);
 
       case QCBOR_TYPE_65BIT_NEG_INT:
          return uBase + (QCBOR_TYPE_DECIMAL_FRACTION_NEG_U64 - QCBOR_TYPE_DECIMAL_FRACTION);
@@ -268,7 +268,7 @@
               MantissaItem.uDataType == QCBOR_TYPE_NEGBIGNUM) {
       /* Got a good big num mantissa */
       pDecodedItem->val.expAndMantissa.Mantissa.bigNum = MantissaItem.val.bigNum;
-#endif /* QCBOR_DISABLE_TAGS */
+#endif /* ! QCBOR_DISABLE_TAGS */
    } else if(MantissaItem.uDataType == QCBOR_TYPE_UINT64) {
       pDecodedItem->val.expAndMantissa.Mantissa.uInt = MantissaItem.val.uint64;
    } else if(MantissaItem.uDataType == QCBOR_TYPE_65BIT_NEG_INT) {
@@ -346,7 +346,7 @@
    {CBOR_TAG_B64,           QCBOR_TYPE_BASE64},
    {CBOR_TAG_REGEX,         QCBOR_TYPE_REGEX},
    {CBOR_TAG_BIN_UUID,      QCBOR_TYPE_UUID                  | IS_BYTE_STRING_BIT},
-   {CBOR_TAG_CBOR_SEQUENCE, QBCOR_TYPE_WRAPPED_CBOR_SEQUENCE | IS_BYTE_STRING_BIT}, // TODO: does this belong here?
+   {CBOR_TAG_CBOR_SEQUENCE, QBCOR_TYPE_WRAPPED_CBOR_SEQUENCE | IS_BYTE_STRING_BIT},
    {CBOR_TAG_INVALID16,     QCBOR_TYPE_NONE}
 };
 
@@ -408,17 +408,15 @@
    {CBOR_TAG_B64,              QCBORDecode_StringsTagCB},
    {CBOR_TAG_REGEX,            QCBORDecode_StringsTagCB},
    {CBOR_TAG_BIN_UUID,         QCBORDecode_StringsTagCB},
-   {CBOR_TAG_CBOR_SEQUENCE,    QCBORDecode_StringsTagCB}, // TODO: does this belong here?
+   {CBOR_TAG_CBOR_SEQUENCE,    QCBORDecode_StringsTagCB},
    {CBOR_TAG_MIME,             QCBORDecode_MIMETagCB},
    {CBOR_TAG_BINARY_MIME,      QCBORDecode_MIMETagCB},
 #ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
-
    {CBOR_TAG_BIGFLOAT,         QCBORDecode_ExpMantissaTagCB},
    {CBOR_TAG_DECIMAL_FRACTION, QCBORDecode_ExpMantissaTagCB},
-#endif
+#endif /* ! QCBOR_DISABLE_EXP_AND_MANTISSA */
    {CBOR_TAG_DAYS_EPOCH,       QCBORDecode_DaysEpochTagCB},
    {CBOR_TAG_INVALID64,        NULL},
 };
 
 #endif /* ! QCBOR_DISABLE_TAGS */
-
diff --git a/test/qcbor_decode_tests.c b/test/qcbor_decode_tests.c
index e4f0f9e..2355fe0 100644
--- a/test/qcbor_decode_tests.c
+++ b/test/qcbor_decode_tests.c
@@ -4202,7 +4202,7 @@
    uError = QCBORDecode_GetNext(&DCtx, &Item);
    uError = QCBORDecode_GetNext(&DCtx, &Item);
 
-#else /* QCBOR_DISABLE_EXP_AND_MANTISSA */
+#else /* ! QCBOR_DISABLE_EXP_AND_MANTISSA */
    if(uError != QCBOR_SUCCESS ||
       Item.uDataType != QCBOR_TYPE_DECIMAL_FRACTION ||
       QCBORDecode_GetNthTag(&DCtx, &Item, 0) != CBOR_TAG_INVALID64 ||
@@ -4212,7 +4212,7 @@
       QCBORDecode_GetNthTag(&DCtx, &Item, 4) != CBOR_TAG_INVALID64 ) {
       return -5;
    }
-#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
+#endif /* ! QCBOR_DISABLE_EXP_AND_MANTISSA */
 
    /*
     More than 4 tags on an item 225(226(227(228(229([])))))
@@ -6419,6 +6419,38 @@
       9223372036854775807,
       {(const uint8_t []){0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, 8},
       false
+   },
+   {
+      "13. Decimal fraction with large exponent and positive unsigned mantissa",
+      {(const uint8_t []){0xC4, 0x82, 0x1B, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+                          0x1B, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, 20},
+      QCBOR_TAG_REQUIREMENT_OPTIONAL_TAG,
+      true,
+
+      QCBOR_SUCCESS, /* for GetNext */
+      QCBOR_TYPE_DECIMAL_FRACTION_POS_U64,
+      9223372036854775807,
+      0,
+      0xffffffffffffffff,
+      {(const uint8_t []){0x00}, 0},
+
+      QCBOR_ERR_CONVERSION_UNDER_OVER_FLOW, /* GetDecimalFraction */
+      0,
+      0,
+
+      QCBOR_SUCCESS, /* for GetTDecimalFractionBigMantissa */
+      9223372036854775807,
+      {(const uint8_t []){0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, 8},
+      false,
+
+      QCBOR_ERR_BAD_EXP_AND_MANTISSA, /* for GetBigFloat */
+      0,
+      0,
+
+      QCBOR_ERR_BAD_EXP_AND_MANTISSA, /* for GetTBigFloatBigMantissa */
+      0,
+      {(const uint8_t []){0x00}, 1},
+      false,
    }
 };
 
@@ -6438,7 +6470,7 @@
    for(uIndex = 0; uIndex < C_ARRAY_COUNT(pEaMTests, struct EaMTest); uIndex++) {
       const struct EaMTest *pT = &pEaMTests[uIndex];
 
-      if(uIndex + 1 == 4) {
+      if(uIndex + 1 == 13) {
          nExponent = 99; // just to set a break point
       }
 
@@ -6789,7 +6821,7 @@
                                               struct DecodeFailTestInput));
 }
 
-#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
+#endif /* ! QCBOR_DISABLE_EXP_AND_MANTISSA */
 
 
 
@@ -7779,9 +7811,9 @@
 
 #ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
 #define EXP_AND_MANTISSA_ERROR(x) x
-#else
+#else /* ! QCBOR_DISABLE_EXP_AND_MANTISSA */
 #define EXP_AND_MANTISSA_ERROR(x) QCBOR_ERR_UNEXPECTED_TYPE
-#endif
+#endif /* ! QCBOR_DISABLE_EXP_AND_MANTISSA */
 
 
 static const struct NumberConversion NumberConversions[] = {
@@ -8986,12 +9018,10 @@
       return 23;
    }
 
-#ifndef QCBOR_DISABLE_UNCOMMON_TAGS
    QCBORDecode_GetB64InMapN(&DC, 30, QCBOR_TAG_REQUIREMENT_TAG, &String);
    if(QCBORDecode_GetAndResetError(&DC) != QCBOR_SUCCESS) {
       return 30;
    }
-#endif
    QCBORDecode_GetB64InMapN(&DC, 31, QCBOR_TAG_REQUIREMENT_NOT_A_TAG, &String);
    if(QCBORDecode_GetAndResetError(&DC) != QCBOR_SUCCESS) {
       return 31;
@@ -9005,12 +9035,10 @@
       return 33;
    }
 
-#ifndef QCBOR_DISABLE_UNCOMMON_TAGS
    QCBORDecode_GetB64URLInMapN(&DC, 40, QCBOR_TAG_REQUIREMENT_TAG, &String);
    if(QCBORDecode_GetAndResetError(&DC) != QCBOR_SUCCESS) {
       return 40;
    }
-#endif
    QCBORDecode_GetB64URLInMapN(&DC, 41, QCBOR_TAG_REQUIREMENT_NOT_A_TAG, &String);
    if(QCBORDecode_GetAndResetError(&DC) != QCBOR_SUCCESS) {
       return 41;
@@ -9024,12 +9052,10 @@
       return 43;
    }
 
-#ifndef QCBOR_DISABLE_UNCOMMON_TAGS
    QCBORDecode_GetRegexInMapN(&DC, 50, QCBOR_TAG_REQUIREMENT_TAG, &String);
    if(QCBORDecode_GetAndResetError(&DC) != QCBOR_SUCCESS) {
       return 50;
    }
-#endif
    QCBORDecode_GetRegexInMapN(&DC, 51, QCBOR_TAG_REQUIREMENT_NOT_A_TAG, &String);
    if(QCBORDecode_GetAndResetError(&DC) != QCBOR_SUCCESS) {
       return 51;
@@ -9043,7 +9069,6 @@
       return 53;
    }
 
-#ifndef QCBOR_DISABLE_UNCOMMON_TAGS
    // MIME
    bool bIsNot7Bit;
    QCBORDecode_GetMIMEMessageInMapN(&DC, 60, QCBOR_TAG_REQUIREMENT_TAG, &String, &bIsNot7Bit);
@@ -9080,7 +9105,6 @@
    if(QCBORDecode_GetAndResetError(&DC) != QCBOR_SUCCESS) {
       return 70;
    }
-#endif /* #ifndef QCBOR_DISABLE_UNCOMMON_TAGS */
 
    QCBORDecode_GetBinaryUUIDInMapN(&DC, 71, QCBOR_TAG_REQUIREMENT_NOT_A_TAG, &String);
    if(QCBORDecode_GetAndResetError(&DC) != QCBOR_SUCCESS) {
diff --git a/test/qcbor_decode_tests.h b/test/qcbor_decode_tests.h
index 37d061e..50fc845 100644
--- a/test/qcbor_decode_tests.h
+++ b/test/qcbor_decode_tests.h
@@ -259,7 +259,7 @@
  Hostile input tests for decimal fractions and big floats.
  */
 int32_t ExponentAndMantissaDecodeFailTests(void);
-#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
+#endif /* ! QCBOR_DISABLE_EXP_AND_MANTISSA */
 
 
 int32_t EnterMapTest(void);
diff --git a/test/qcbor_encode_tests.c b/test/qcbor_encode_tests.c
index b9187fc..3c758f2 100644
--- a/test/qcbor_encode_tests.c
+++ b/test/qcbor_encode_tests.c
@@ -3332,7 +3332,7 @@
 }
 
 
-#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
+#endif /* ! QCBOR_DISABLE_EXP_AND_MANTISSA */
 
 
 int32_t QCBORHeadTest(void)
diff --git a/test/qcbor_encode_tests.h b/test/qcbor_encode_tests.h
index cb9f00f..676b375 100644
--- a/test/qcbor_encode_tests.h
+++ b/test/qcbor_encode_tests.h
@@ -167,7 +167,7 @@
  made up of an exponent and mantissa
  */
 int32_t ExponentAndMantissaEncodeTests(void);
-#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
+#endif /* ! QCBOR_DISABLE_EXP_AND_MANTISSA */
 
 
 /*
diff --git a/test/run_tests.c b/test/run_tests.c
index 578c34c..bcb4540 100644
--- a/test/run_tests.c
+++ b/test/run_tests.c
@@ -173,7 +173,7 @@
    TEST_ENTRY(ExponentAndMantissaDecodeFailTests),
 #endif /* QCBOR_DISABLE_TAGS */
    TEST_ENTRY(ExponentAndMantissaEncodeTests),
-#endif /* QCBOR_DISABLE_EXP_AND_MANTISSA */
+#endif /* ! QCBOR_DISABLE_EXP_AND_MANTISSA */
    TEST_ENTRY(SortMapTest),
 #if !defined(USEFULBUF_DISABLE_ALL_FLOAT) && !defined(QCBOR_DISABLE_PREFERRED_FLOAT)
    TEST_ENTRY(CDETest),