diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-10-09 07:34:09 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-10-10 17:04:29 +0300 |
commit | e0e54965df015b954d75ebe945221372f2dffb80 (patch) | |
tree | b5849d8a9a7116a2461c3641fedfe7cfbcf0f8da /test/utils.cpp | |
parent | 603a4d60f6ac4dbc2474700943dd1a0066ee1f23 (diff) |
libcamera: base: utils: Drop defopt
utils::defopt causes compilation issues on gcc 8.0.0 to gcc 8.3.0,
likely due to bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86521
that was fixed in gcc 8.4.0. gcc 8.3.0 may be considered old (libcamera
requires gcc-8 or newer), but it is shipped by Debian 10 that has LTS
support until mid-2024.
As no workaround has been found to fix compilation on gcc 8.3.0 while
still retaining the functionality of utils::defopt, remove it from the
libcamera base library. This change could be reverted once support for
gcc-8 will be dropped.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'test/utils.cpp')
-rw-r--r-- | test/utils.cpp | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/test/utils.cpp b/test/utils.cpp index 58b5a59d..fc56e14e 100644 --- a/test/utils.cpp +++ b/test/utils.cpp @@ -170,55 +170,6 @@ protected: return TestPass; } - int testDefopt() - { - static bool defaultConstructed = false; - - struct ValueType { - ValueType() - : value_(-1) - { - defaultConstructed = true; - } - - ValueType(int value) - : value_(value) - { - } - - int value_; - }; - - /* - * Test that utils::defopt doesn't cause default-construction - * of a ValueType instance when value_or(utils::defopt) is - * called on a std::optional that has a value. - */ - std::optional<ValueType> opt = ValueType(0); - ValueType value = opt.value_or(utils::defopt); - - if (defaultConstructed || value.value_ != 0) { - std::cerr << "utils::defopt didn't prevent default construction" - << std::endl; - return TestFail; - } - - /* - * Then test that the ValueType is correctly default-constructed - * when the std::optional has no value. - */ - opt = std::nullopt; - value = opt.value_or(utils::defopt); - - if (!defaultConstructed || value.value_ != -1) { - std::cerr << "utils::defopt didn't cause default construction" - << std::endl; - return TestFail; - } - - return TestPass; - } - int run() { /* utils::hex() test. */ @@ -339,10 +290,6 @@ protected: if (testDuration() != TestPass) return TestFail; - /* utils::defopt test. */ - if (testDefopt() != TestPass) - return TestFail; - return TestPass; } }; |