kicad/Documentation/development/technical_todo.md

6.8 KiB

Technical To-Do List

Some work is blocked for technical reasons, and can only be done once certain other criteria are met (e.g. library versions).

Because KiCad supports distributions with relatively long support cycles, many of these workarounds will be required for some time, so they are easily forgotten.

This section collects these so they can be dealt with when the project's minimum version for that dependency is met. This kind of code should always be documented in detail at the place of use, so that it's clear what action should be taken in future.

[TOC]

C++ Versions

Newer C++ versions include features that make some of our current code unnecessary.

C++11

This C++ standard version is already used by KiCad, but much code that pre-dates the version switch exists and can be tidied.

C++14

This C++ standard version is already used by KiCad on the development branch, but much code that pre-dates this version can be tidied.

Compiler support:

C++17

Compiler support:

Provides:

  • OPT<> can be replaced with std::optional. Header core/optional.h can be removed and replaced with the built-in <optional>. Needs GCC 7.
  • std::filesystem can replace boost::filesystem and the Boost dependency can be dropped entirely from the CMake files.
  • [[fallthrough]] attribute can be used to indicate switch statements intentionally fallthrough. Then Clang -Wimplicit-fallthrough warnings can be enabled.

C++20

Compiler support:

  • TBD (Yet to be released)

Provides:

  • constexpr std::string and constexpr std::vector can be used to initialize items:
    • File extensions in wildcards_and_files_ext.h

Compilers

Some compilers have bugs or limitations to C++ standard support.

GCC

Current versions:

GCC 7

  • Fixes bug #56480 (Explicit specialization in a different namespace). This means the BOOST_TEST_PRINT_NAMESPACE_OPEN macro is not required, a namespace alias can be used instead.

3rd Party Libraries

There are several places in KiCad where workarounds exist for defects in 3rd party library limitations or defects.

Boost

Current versions:

1.59

  • Boost 1.59 brings a major overhaul of the Boost test library.
    • Many "Polyfills" un unit_test_utils.h can be removed:
      • BOOST_TEST_CONTEXT and BOOST_TEST_INFO are available, remove the polyfill macros.
      • boost::unit_test::expected_failures is available, so can remove the HAVE_EXPECTED_FAILURES guard macro.
      • BOOST_TEST_PRINT_NAMESPACE_OPEN doesn't need to switch the namespace

1.64

  • Boost test
    • Boost test print helper for nullptr_t exists, can remove our polyfill
    • The boost_test_print_type customisation point exists and the old code using BOOST_TEST_PRINT_NAMESPACE_OPEN can be converted to use that.

CMake

Current versions:

3.1

3.3

  • Can remove check for CMake policy CMP0063 entirely (the policy exists as of v3.3 and the default is correct).

3.5

  • Can use target_link_libraries(foo Boost::boost) for Boost header-only libraries, rather than ${Boost_INCLUDE_DIRS}. C.f. Github commit

OpenSSL

Current versions:

1.1.0

  • Can remove all locking code from kicad_curl.cpp. From v1.1.0, this is no longer required. C.f. OpenSSL issue 1260

wxWidgets

Current versions:

3.1

This is a development release, but it brings its own set of features and fixes. Most of these will not be available in general distributions until v3.2.

  • DPI scaling on GTK+ available (also needs GTK+ 3.10). C.f. this commit dpi_scaling.cpp should continue to work normally, but the config should no longer be required and the scaling should auto-detect.
  • Once the minimum version is greater than 3.1.3, the code inside the constructor of the HIDPI_GL_CANVAS should be removed, since the default behavior of a wxGLCanvas was changed in 3.1.3 to always want the best resolution.