diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..4cd52cc18 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,18 @@ +ARG BASE_IMAGE_NAME="clang:latest" + +FROM ${BASE_IMAGE_NAME} + +ARG REINSTALL_CMAKE_VERSION_FROM_SOURCE="3.31.7" + +# Optionally install the cmake for vcpkg +COPY ./reinstall-cmake.sh /tmp/ + +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends \ + git \ + wget + +RUN if [ "${REINSTALL_CMAKE_VERSION_FROM_SOURCE}" != "none" ]; then \ + chmod +x /tmp/reinstall-cmake.sh && /tmp/reinstall-cmake.sh ${REINSTALL_CMAKE_VERSION_FROM_SOURCE}; \ + fi \ + && rm -f /tmp/reinstall-cmake.sh diff --git a/.devcontainer/clang10/devcontainer.json b/.devcontainer/clang10/devcontainer.json new file mode 100644 index 000000000..d34b0411b --- /dev/null +++ b/.devcontainer/clang10/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Clang 10", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "silkeh/clang:10" + }, + "context": "../context" + } +} diff --git a/.devcontainer/clang11/devcontainer.json b/.devcontainer/clang11/devcontainer.json new file mode 100644 index 000000000..6727e4977 --- /dev/null +++ b/.devcontainer/clang11/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Clang 11", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "silkeh/clang:11" + }, + "context": "../context" + } +} diff --git a/.devcontainer/clang12/devcontainer.json b/.devcontainer/clang12/devcontainer.json new file mode 100644 index 000000000..26ab72ca8 --- /dev/null +++ b/.devcontainer/clang12/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Clang 12", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "silkeh/clang:12" + }, + "context": "../context" + } +} diff --git a/.devcontainer/clang13/devcontainer.json b/.devcontainer/clang13/devcontainer.json new file mode 100644 index 000000000..309ced685 --- /dev/null +++ b/.devcontainer/clang13/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Clang 13", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "silkeh/clang:13" + }, + "context": "../context" + } +} diff --git a/.devcontainer/clang14/devcontainer.json b/.devcontainer/clang14/devcontainer.json new file mode 100644 index 000000000..ecdf0ad96 --- /dev/null +++ b/.devcontainer/clang14/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Clang 14", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "silkeh/clang:14" + }, + "context": "../context" + } +} diff --git a/.devcontainer/clang15/devcontainer.json b/.devcontainer/clang15/devcontainer.json new file mode 100644 index 000000000..35a1cceff --- /dev/null +++ b/.devcontainer/clang15/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Clang 15", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "silkeh/clang:15" + }, + "context": "../context" + } +} diff --git a/.devcontainer/clang16/devcontainer.json b/.devcontainer/clang16/devcontainer.json new file mode 100644 index 000000000..aa9b25ee5 --- /dev/null +++ b/.devcontainer/clang16/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Clang 16", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "silkeh/clang:16" + }, + "context": "../context" + } +} diff --git a/.devcontainer/clang17/devcontainer.json b/.devcontainer/clang17/devcontainer.json new file mode 100644 index 000000000..deb08dbb3 --- /dev/null +++ b/.devcontainer/clang17/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Clang 17", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "silkeh/clang:17" + }, + "context": "../context" + } +} diff --git a/.devcontainer/clang18/devcontainer.json b/.devcontainer/clang18/devcontainer.json new file mode 100644 index 000000000..d79541453 --- /dev/null +++ b/.devcontainer/clang18/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Clang 18", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "silkeh/clang:18-bullseye" + }, + "context": "../context" + } +} diff --git a/.devcontainer/clang19/devcontainer.json b/.devcontainer/clang19/devcontainer.json new file mode 100644 index 000000000..7c525acf2 --- /dev/null +++ b/.devcontainer/clang19/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Clang 19", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "silkeh/clang:19-bullseye" + }, + "context": "../context" + } +} diff --git a/.devcontainer/clang20/devcontainer.json b/.devcontainer/clang20/devcontainer.json new file mode 100644 index 000000000..0dadc10ba --- /dev/null +++ b/.devcontainer/clang20/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Clang 20", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "silkeh/clang:20-bullseye" + }, + "context": "../context" + } +} diff --git a/.devcontainer/clang7/devcontainer.json b/.devcontainer/clang7/devcontainer.json new file mode 100644 index 000000000..09a67efa3 --- /dev/null +++ b/.devcontainer/clang7/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Clang 07", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "silkeh/clang:7" + }, + "context": "../context" + } +} diff --git a/.devcontainer/clang8/devcontainer.json b/.devcontainer/clang8/devcontainer.json new file mode 100644 index 000000000..99a853e5a --- /dev/null +++ b/.devcontainer/clang8/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Clang 08", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "silkeh/clang:8" + }, + "context": "../context" + } +} diff --git a/.devcontainer/clang9/devcontainer.json b/.devcontainer/clang9/devcontainer.json new file mode 100644 index 000000000..b77d4f2b7 --- /dev/null +++ b/.devcontainer/clang9/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Clang 09", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "silkeh/clang:9" + }, + "context": "../context" + } +} diff --git a/.devcontainer/context/reinstall-cmake.sh b/.devcontainer/context/reinstall-cmake.sh new file mode 100644 index 000000000..280d81459 --- /dev/null +++ b/.devcontainer/context/reinstall-cmake.sh @@ -0,0 +1,291 @@ +#!/usr/bin/env bash + +# For more detailed debugging, uncomment the next line +# set -x + +# Explicitly set CMAKE_VERSION from first argument, default to "none" +CMAKE_VERSION=${1:-"none"} + +# --- Configuration --- +DOWNLOAD_ATTEMPTS=3 +DOWNLOAD_RETRY_DELAY=5 # seconds + +# --- Global Variables --- +TMP_DIR="" # Initialize TMP_DIR, will be set by mktemp +# Filenames used within TMP_DIR +CMAKE_INSTALLER_SCRIPT_LOCAL_NAME="cmake-installer.sh" +CMAKE_CHECKSUM_FILE_LOCAL_NAME="cmake-checksums.txt" +# This will be the actual name of the CMake binary, derived from version and arch +# It's important for matching against the checksum file. +DERIVED_CMAKE_BINARY_FILENAME="" + +# --- Cleanup Function --- +# This trap will execute on EXIT, ERR, SIGINT, SIGTERM +# It's crucial for debugging to see the state of TMP_DIR if things go wrong. +cleanup() { + # $? is the exit code of the last command before the trap was triggered + # or the argument to exit if the script called exit explicitly. + LAST_EXIT_CODE=$? + echo # Newline for readability + + # Only proceed with detailed cleanup if TMP_DIR was actually created + if [[ -n "${TMP_DIR}" && -d "${TMP_DIR}" ]]; then + echo "--- Cleanup: Temporary Directory Inspector (${TMP_DIR}) ---" + echo "Listing contents of TMP_DIR:" + ls -la "${TMP_DIR}" + + # Check and display checksum file content + if [[ -f "${TMP_DIR}/${CMAKE_CHECKSUM_FILE_LOCAL_NAME}" ]]; then + echo "--- Content of downloaded checksum file (${CMAKE_CHECKSUM_FILE_LOCAL_NAME}) ---" + cat "${TMP_DIR}/${CMAKE_CHECKSUM_FILE_LOCAL_NAME}" + echo "--- End of checksum file ---" + else + echo "Checksum file (${CMAKE_CHECKSUM_FILE_LOCAL_NAME}) not found in TMP_DIR." + fi + + # Check and display head of (potentially) installer script + # Useful to see if it's an HTML error page + if [[ -f "${TMP_DIR}/${CMAKE_INSTALLER_SCRIPT_LOCAL_NAME}" ]]; then + echo "--- First 10 lines of downloaded installer script (${CMAKE_INSTALLER_SCRIPT_LOCAL_NAME}) ---" + head -n 10 "${TMP_DIR}/${CMAKE_INSTALLER_SCRIPT_LOCAL_NAME}" + echo "--- End of installer script head ---" + elif [[ -f "${TMP_DIR}/${DERIVED_CMAKE_BINARY_FILENAME}" ]]; then + # If it was renamed + echo "--- First 10 lines of downloaded installer script (${DERIVED_CMAKE_BINARY_FILENAME}) ---" + head -n 10 "${TMP_DIR}/${DERIVED_CMAKE_BINARY_FILENAME}" + echo "--- End of installer script head ---" + else + echo "Installer script not found in TMP_DIR (checked for ${CMAKE_INSTALLER_SCRIPT_LOCAL_NAME} and ${DERIVED_CMAKE_BINARY_FILENAME})." + fi + + echo "Attempting to remove temporary directory: ${TMP_DIR}" + rm -Rf "${TMP_DIR}" + echo "Temporary directory removed." + echo "--- End of Cleanup ---" + else + echo "--- Cleanup: TMP_DIR was not set or not a directory, no temp files to inspect or clean. ---" + fi + + # Ensure the script exits with the LAST_EXIT_CODE observed by the trap + # unless it was 0 and the script is exiting due to an explicit non-zero exit. + # The 'exit' command within the trap will override the script's natural exit code. + # So, if the script was going to exit 0, but cleanup had an issue, this could change it. + # However, for debugging an exit code 8, we want to preserve the code that *caused* the trap. + echo "Script finished with exit code: ${LAST_EXIT_CODE}." + exit "${LAST_EXIT_CODE}" +} +trap cleanup EXIT ERR SIGINT SIGTERM + +# Immediately turn on `set -e` after trap setup +set -e + +# --- Helper Functions --- +# Function to download a file with retries and basic validation +download_file() { + local url="$1" + local output_filename="$2" + local attempts_left=$DOWNLOAD_ATTEMPTS + local wget_exit_code=0 + + while [ $attempts_left -gt 0 ]; do + echo "Downloading: ${url}" + echo "Saving to: ${TMP_DIR}/${output_filename}" + echo "Attempt $((DOWNLOAD_ATTEMPTS - attempts_left + 1)) of ${DOWNLOAD_ATTEMPTS}..." + + # Use wget with: + # -O: specify output file + # --timeout: connection/read timeout + # --tries: number of retries (wget's own retry, distinct from this loop) + # --quiet: suppress normal output, but errors still go to stderr + # --show-progress: if not quiet, shows a progress bar (optional) + # Using -q for less verbose logs, but on failure, we need to know. + wget -O "${TMP_DIR}/${output_filename}" --timeout=30 --tries=1 "${url}" + wget_exit_code=$? + + if [ ${wget_exit_code} -eq 0 ]; then + echo "Download command successful for ${output_filename}." + if [ -s "${TMP_DIR}/${output_filename}" ]; then # -s: file exists and has a size greater than 0 + # Basic check for common HTML error page indicators + # This is a heuristic and might not catch all error pages. + if head -n 5 "${TMP_DIR}/${output_filename}" | grep -Eiq ' /dev/null; then + echo "wget not found. Attempting to install wget via apt-get..." + if command -v apt-get > /dev/null; then + apt-get update -y + apt-get install -y --no-install-recommends wget + echo "wget installed." + else + echo "ERROR: apt-get not found. Cannot install wget. Please install wget manually." + exit 1 + fi +else + echo "wget is available." +fi + +# 2. (Optional) Remove existing CMake installed via apt +echo "Attempting to remove any existing CMake installed via apt..." +if command -v apt-get > /dev/null; then + if dpkg -s cmake &> /dev/null; then # Check if cmake package is actually installed + apt-get -y purge --auto-remove cmake + echo "cmake package purged." + else + echo "cmake package not found via dpkg, skipping purge." + fi +else + echo "apt-get not found, skipping removal of CMake via apt." +fi + +# 3. Create installation and temporary directories +echo "Creating CMake installation directory /opt/cmake..." +mkdir -p /opt/cmake + +TMP_DIR=$(mktemp -d -t cmake-install-XXXXXXXXXX) +echo "Temporary directory created: ${TMP_DIR}" +# Crucial: subsequent operations needing temp files should happen in or relative to TMP_DIR +# We will cd into TMP_DIR later, or use full paths like ${TMP_DIR}/filename + +# 4. Determine system architecture +echo "Determining system architecture..." +architecture=$(dpkg --print-architecture) +case "${architecture}" in + arm64) ARCH="aarch64" ;; + amd64) ARCH="x86_64" ;; + *) + echo "ERROR: Unsupported architecture '${architecture}' reported by dpkg." + exit 1 + ;; +esac +echo "Detected architecture: ${architecture} (mapped to CMake arch: ${ARCH})" + +# 5. Define CMake download URLs and the filename expected by checksum +DERIVED_CMAKE_BINARY_FILENAME="cmake-${CMAKE_VERSION}-linux-${ARCH}.sh" +CMAKE_BINARY_URL="https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${DERIVED_CMAKE_BINARY_FILENAME}" +CMAKE_CHECKSUM_FILE_URL="https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-SHA-256.txt" + +# 6. Download CMake binary and checksum file +echo "--- Downloading Files ---" +if ! download_file "${CMAKE_BINARY_URL}" "${CMAKE_INSTALLER_SCRIPT_LOCAL_NAME}"; then + echo "ERROR: Failed to download CMake binary installer. See messages above." + exit 1 +fi + +if ! download_file "${CMAKE_CHECKSUM_FILE_URL}" "${CMAKE_CHECKSUM_FILE_LOCAL_NAME}"; then + echo "ERROR: Failed to download CMake checksum file. See messages above." + exit 1 +fi +echo "Downloads complete." +echo "--- End of Downloading Files ---" +echo # Newline for readability + +# Before checksum, rename the downloaded installer to its derived name, +# as the checksum file refers to this specific name. +echo "Renaming downloaded installer from '${CMAKE_INSTALLER_SCRIPT_LOCAL_NAME}' to '${DERIVED_CMAKE_BINARY_FILENAME}' for checksum verification." +mv "${TMP_DIR}/${CMAKE_INSTALLER_SCRIPT_LOCAL_NAME}" "${TMP_DIR}/${DERIVED_CMAKE_BINARY_FILENAME}" +if [ ! -f "${TMP_DIR}/${DERIVED_CMAKE_BINARY_FILENAME}" ]; then + echo "ERROR: Failed to rename installer script for checksum. File '${TMP_DIR}/${DERIVED_CMAKE_BINARY_FILENAME}' does not exist after move." + exit 1 +fi + +# 7. Verify checksum +echo "--- Verifying Checksum ---" +echo "Checksum file is: ${TMP_DIR}/${CMAKE_CHECKSUM_FILE_LOCAL_NAME}" +echo "Binary file to check is: ${TMP_DIR}/${DERIVED_CMAKE_BINARY_FILENAME}" + +# Ensure the checksum file actually contains an entry for our binary +# This is important because the SHA-256.txt file contains checksums for *all* release assets +echo "Checking if checksum file contains entry for '${DERIVED_CMAKE_BINARY_FILENAME}'..." +if ! grep -q "${DERIVED_CMAKE_BINARY_FILENAME}" "${TMP_DIR}/${CMAKE_CHECKSUM_FILE_LOCAL_NAME}"; then + echo "ERROR: The downloaded checksum file '${CMAKE_CHECKSUM_FILE_LOCAL_NAME}' does NOT contain an entry for '${DERIVED_CMAKE_BINARY_FILENAME}'." + echo "This strongly suggests that the CMAKE_VERSION ('${CMAKE_VERSION}') or ARCH ('${ARCH}') is incorrect, or the specified version does not provide a .sh installer for this architecture." + echo "Please verify the version and available files at https://github.com/Kitware/CMake/releases/tag/v${CMAKE_VERSION}" + exit 1 +fi +echo "Checksum file contains an entry for '${DERIVED_CMAKE_BINARY_FILENAME}'." + +# Perform the checksum. We need to be in the directory where the files are. +echo "Changing directory to ${TMP_DIR} for checksum verification." +cd "${TMP_DIR}" # <<<<<<< IMPORTANT: sha256sum -c needs to find files + +echo "Verifying checksum of '${DERIVED_CMAKE_BINARY_FILENAME}' using '${CMAKE_CHECKSUM_FILE_LOCAL_NAME}'..." +# The --ignore-missing flag is good, as the .txt file has many checksums. +# The --strict flag would cause it to error if there are improperly formatted lines. +# We rely on the grep check above to ensure our specific file is mentioned. +if sha256sum -c --ignore-missing "${CMAKE_CHECKSUM_FILE_LOCAL_NAME}"; then + echo "Checksum verification successful for '${DERIVED_CMAKE_BINARY_FILENAME}'." +else + SHA_EXIT_CODE=$? + echo "ERROR: Checksum verification FAILED for '${DERIVED_CMAKE_BINARY_FILENAME}' with exit code ${SHA_EXIT_CODE}." + # Cleanup trap will show file contents. + exit 1 # Critical failure +fi +echo "--- End of Verifying Checksum ---" +echo # Newline for readability + +# 8. Install CMake +echo "--- Installing CMake ---" +echo "Making the CMake installer script '${DERIVED_CMAKE_BINARY_FILENAME}' executable..." +chmod +x "${DERIVED_CMAKE_BINARY_FILENAME}" # Still in TMP_DIR + +echo "Executing CMake installer script: ./${DERIVED_CMAKE_BINARY_FILENAME} --prefix=/opt/cmake --skip-license" +# Execute the script. If this script exits with 8, this is our culprit. +if ./"${DERIVED_CMAKE_BINARY_FILENAME}" --prefix=/opt/cmake --skip-license; then + echo "CMake installer script executed successfully." +else + INSTALLER_EXIT_CODE=$? + echo "ERROR: CMake installer script FAILED with exit code ${INSTALLER_EXIT_CODE}." + # This is the most likely place for an exit code 8 if downloads and checksums were okay. + # The trap will handle cleanup. The script will exit with INSTALLER_EXIT_CODE due to the trap. + exit ${INSTALLER_EXIT_CODE} # Explicitly exit with the installer's code +fi +echo "--- End of Installing CMake ---" +echo # Newline for readability + +# 9. Create symlinks +echo "Creating symbolic links for cmake and ctest in /usr/local/bin/..." +ln -sf /opt/cmake/bin/cmake /usr/local/bin/cmake +ln -sf /opt/cmake/bin/ctest /usr/local/bin/ctest +echo "Symbolic links created." + +echo # Newline for readability +echo "SUCCESS: CMake ${CMAKE_VERSION} installation and setup complete." + +# The script will exit with 0 here. The trap will run, see $? is 0, and then exit 0. +exit 0 \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..161faeec8 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Default", + "build": { + "dockerfile": "./Dockerfile", + "args": { + "BASE_IMAGE_NAME": "mcr.microsoft.com/devcontainers/cpp:debian-12" + }, + "context": "./context" + } +} diff --git a/.devcontainer/gcc09/devcontainer.json b/.devcontainer/gcc09/devcontainer.json new file mode 100644 index 000000000..ab5e64ee0 --- /dev/null +++ b/.devcontainer/gcc09/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Gcc 09", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "gcc:9" + }, + "context": "../context" + } +} diff --git a/.devcontainer/gcc10/devcontainer.json b/.devcontainer/gcc10/devcontainer.json new file mode 100644 index 000000000..03bf117e9 --- /dev/null +++ b/.devcontainer/gcc10/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Gcc 10", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "gcc:10" + }, + "context": "../context" + } +} diff --git a/.devcontainer/gcc11/devcontainer.json b/.devcontainer/gcc11/devcontainer.json new file mode 100644 index 000000000..9d837fadc --- /dev/null +++ b/.devcontainer/gcc11/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Gcc 11", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "gcc:11" + }, + "context": "../context" + } +} diff --git a/.devcontainer/gcc12/devcontainer.json b/.devcontainer/gcc12/devcontainer.json new file mode 100644 index 000000000..9c07a79f1 --- /dev/null +++ b/.devcontainer/gcc12/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Gcc 12", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "gcc:12" + }, + "context": "../context" + } +} diff --git a/.devcontainer/gcc13/devcontainer.json b/.devcontainer/gcc13/devcontainer.json new file mode 100644 index 000000000..4b9767e87 --- /dev/null +++ b/.devcontainer/gcc13/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Gcc 13", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "gcc:13" + }, + "context": "../context" + } +} diff --git a/.devcontainer/gcc14/devcontainer.json b/.devcontainer/gcc14/devcontainer.json new file mode 100644 index 000000000..374ff299b --- /dev/null +++ b/.devcontainer/gcc14/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Gcc 14", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "gcc:14" + }, + "context": "../context" + } +} diff --git a/.devcontainer/gcc15/devcontainer.json b/.devcontainer/gcc15/devcontainer.json new file mode 100644 index 000000000..498a6fe8f --- /dev/null +++ b/.devcontainer/gcc15/devcontainer.json @@ -0,0 +1,12 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/cpp +{ + "name": "Gcc 15", + "build": { + "dockerfile": "../Dockerfile", + "args": { + "BASE_IMAGE_NAME": "gcc:15" + }, + "context": "../context" + } +} diff --git a/.github/workflows/clang-c++11.yml b/.github/workflows/clang-c++11.yml index 3bfb863c2..2e243e80d 100644 --- a/.github/workflows/clang-c++11.yml +++ b/.github/workflows/clang-c++11.yml @@ -22,7 +22,7 @@ jobs: export CC=clang export CXX=clang++ export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 - cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=11 ./ + cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=11 ./ clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -44,7 +44,7 @@ jobs: export CC=clang export CXX=clang++ export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 - cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=11 ./ + cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=11 ./ clang --version make -j $(getconf _NPROCESSORS_ONLN) diff --git a/.github/workflows/clang-c++14.yml b/.github/workflows/clang-c++14.yml index 6ec45fdb9..7d2338d3e 100644 --- a/.github/workflows/clang-c++14.yml +++ b/.github/workflows/clang-c++14.yml @@ -22,7 +22,7 @@ jobs: export CC=clang export CXX=clang++ export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 - cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=14 ./ + cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=14 ./ clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -44,7 +44,7 @@ jobs: export CC=clang export CXX=clang++ export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 - cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=14 ./ + cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=14 ./ clang --version make -j $(getconf _NPROCESSORS_ONLN) diff --git a/.github/workflows/clang-c++17.yml b/.github/workflows/clang-c++17.yml index 789ce3be2..62afaf427 100644 --- a/.github/workflows/clang-c++17.yml +++ b/.github/workflows/clang-c++17.yml @@ -22,7 +22,7 @@ jobs: export CC=clang export CXX=clang++ export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 - cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=17 ./ + cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=17 ./ clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -44,7 +44,7 @@ jobs: export CC=clang export CXX=clang++ export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 - cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=17 ./ + cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=17 ./ clang --version make -j $(getconf _NPROCESSORS_ONLN) diff --git a/.github/workflows/clang-c++20.yml b/.github/workflows/clang-c++20.yml index 37d0b75b9..e403e5c0a 100644 --- a/.github/workflows/clang-c++20.yml +++ b/.github/workflows/clang-c++20.yml @@ -29,7 +29,7 @@ jobs: export CC=clang-17 export CXX=clang++-17 export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 - cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=20 ./ + cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=20 ./ clang-17 --version make -j $(getconf _NPROCESSORS_ONLN) @@ -58,7 +58,7 @@ jobs: export CC=clang-17 export CXX=clang++-17 export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 - cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=20 ./ + cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=20 ./ clang-17 --version make -j $(getconf _NPROCESSORS_ONLN) @@ -87,7 +87,7 @@ jobs: export CC=clang-17 export CXX=clang++-17 export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 - cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=20 ./ + cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=20 ./ clang-17 --version make -j $(getconf _NPROCESSORS_ONLN) @@ -109,7 +109,7 @@ jobs: export CC=clang export CXX=clang++ export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 - cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=20 ./ + cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=20 ./ clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -131,7 +131,7 @@ jobs: export CC=clang export CXX=clang++ export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 - cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=20 ./ + cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=20 ./ clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -153,7 +153,7 @@ jobs: export CC=clang export CXX=clang++ export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 - cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=20 ./ + cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=20 ./ clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -175,7 +175,7 @@ jobs: export CC=clang export CXX=clang++ export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 - cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=20 ./ + cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=20 ./ clang --version make -j $(getconf _NPROCESSORS_ONLN) diff --git a/.github/workflows/clang-c++23.yml b/.github/workflows/clang-c++23.yml new file mode 100644 index 000000000..82c4a16da --- /dev/null +++ b/.github/workflows/clang-c++23.yml @@ -0,0 +1,184 @@ +name: clang-c++23 +on: + push: + branches: [ master, development, pull-request/* ] + pull_request: + branches: [ master, pull-request/* ] + +jobs: + + build-clang-cpp23-linux-no-stl: + name: Clang C++23 Linux - No STL + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - uses: actions/checkout@v4 + + # Temporary fix. See https://github.com/actions/runner-images/issues/8659 + - name: Install newer Clang + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x ./llvm.sh + sudo ./llvm.sh 17 + + - name: Build + run: | + export CC=clang-17 + export CXX=clang++-17 + export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 + cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=23 ./ + clang-17 --version + make -j $(getconf _NPROCESSORS_ONLN) + + - name: Run tests + run: ./test/etl_tests + + build-clang-cpp23-linux-stl-force-cpp03: + name: Clang C++23 Linux - STL - Force C++03 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - uses: actions/checkout@v4 + + # Temporary fix. See https://github.com/actions/runner-images/issues/8659 + - name: Install newer Clang + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x ./llvm.sh + sudo ./llvm.sh 17 + + - name: Build + run: | + export CC=clang-17 + export CXX=clang++-17 + export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 + cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=23 ./ + clang-17 --version + make -j $(getconf _NPROCESSORS_ONLN) + + - name: Run tests + run: ./test/etl_tests + + build-clang-cpp2-linux-no-stl-force-cpp03: + name: Clang C++23 Linux - No STL - Force C++03 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - uses: actions/checkout@v4 + + # Temporary fix. See https://github.com/actions/runner-images/issues/8659 + - name: Install newer Clang + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x ./llvm.sh + sudo ./llvm.sh 17 + + - name: Build + run: | + export CC=clang-17 + export CXX=clang++-17 + export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 + cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=23 ./ + clang-17 --version + make -j $(getconf _NPROCESSORS_ONLN) + + - name: Run tests + run: ./test/etl_tests + + build-clang-cpp23-osx-stl: + name: Clang C++23 OSX - STL + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-13] + + steps: + - uses: actions/checkout@v4 + + - name: Build + run: | + export CC=clang + export CXX=clang++ + export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 + cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=23 ./ + clang --version + make -j $(getconf _NPROCESSORS_ONLN) + + - name: Run tests + run: ./test/etl_tests + + build-clang-cpp23-osx-no-stl: + name: Clang C++23 OSX - No STL + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-13] + + steps: + - uses: actions/checkout@v4 + + - name: Build + run: | + export CC=clang + export CXX=clang++ + export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 + cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=23 ./ + clang --version + make -j $(getconf _NPROCESSORS_ONLN) + + - name: Run tests + run: ./test/etl_tests + + build-clang-cpp23-osx-stl-force-cpp03: + name: Clang C++23 OSX - STL - Force C++03 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-13] + + steps: + - uses: actions/checkout@v4 + + - name: Build + run: | + export CC=clang + export CXX=clang++ + export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 + cmake -D BUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=23 ./ + clang --version + make -j $(getconf _NPROCESSORS_ONLN) + + - name: Run tests + run: ./test/etl_tests + + build-clang-cpp23-osx-no-stl-force-cpp03: + name: Clang C++23 OSX - No STL - Force C++03 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-13] + + steps: + - uses: actions/checkout@v4 + + - name: Build + run: | + export CC=clang + export CXX=clang++ + export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 + cmake -D BUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=23 ./ + clang --version + make -j $(getconf _NPROCESSORS_ONLN) + + - name: Run tests + run: ./test/etl_tests + diff --git a/.github/workflows/clang-syntax-checks.yml b/.github/workflows/clang-syntax-checks.yml index 2baf9ef23..c0c5f4e25 100644 --- a/.github/workflows/clang-syntax-checks.yml +++ b/.github/workflows/clang-syntax-checks.yml @@ -20,7 +20,7 @@ jobs: run: | export CC=clang export CXX=clang++ - cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=03 ./test/syntax_check clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -38,7 +38,7 @@ jobs: run: | export CC=clang export CXX=clang++ - cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=03 ./test/syntax_check clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -56,7 +56,7 @@ jobs: run: | export CC=clang export CXX=clang++ - cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=11 ./test/syntax_check clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -74,7 +74,7 @@ jobs: run: | export CC=clang export CXX=clang++ - cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=11 ./test/syntax_check clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -92,7 +92,7 @@ jobs: run: | export CC=clang export CXX=clang++ - cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=11 ./test/syntax_check clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -110,7 +110,7 @@ jobs: run: | export CC=clang export CXX=clang++ - cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=11 ./test/syntax_check clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -128,7 +128,7 @@ jobs: run: | export CC=clang export CXX=clang++ - cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=14 ./test/syntax_check clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -146,7 +146,7 @@ jobs: run: | export CC=clang export CXX=clang++ - cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=14 ./test/syntax_check clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -164,7 +164,7 @@ jobs: run: | export CC=clang export CXX=clang++ - cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=14 ./test/syntax_check clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -182,7 +182,7 @@ jobs: run: | export CC=clang export CXX=clang++ - cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=14 ./test/syntax_check clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -200,7 +200,7 @@ jobs: run: | export CC=clang export CXX=clang++ - cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=17 ./test/syntax_check clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -218,7 +218,7 @@ jobs: run: | export CC=clang export CXX=clang++ - cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=17 ./test/syntax_check clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -236,7 +236,7 @@ jobs: run: | export CC=clang export CXX=clang++ - cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=17 ./test/syntax_check clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -254,7 +254,7 @@ jobs: run: | export CC=clang export CXX=clang++ - cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=17 ./test/syntax_check clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -272,7 +272,7 @@ jobs: run: | export CC=clang export CXX=clang++ - cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=20 ./test/syntax_check clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -290,7 +290,7 @@ jobs: run: | export CC=clang export CXX=clang++ - cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=20 ./test/syntax_check clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -308,7 +308,7 @@ jobs: run: | export CC=clang export CXX=clang++ - cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=20 ./test/syntax_check clang --version make -j $(getconf _NPROCESSORS_ONLN) @@ -326,6 +326,78 @@ jobs: run: | export CC=clang export CXX=clang++ - cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=20 ./test/syntax_check + clang --version + make -j $(getconf _NPROCESSORS_ONLN) + + build-clang-cpp23-linux-STL: + name: Syntax Check - Clang C++23 Linux STL + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - uses: actions/checkout@v4 + + - name: Build + run: | + export CC=clang + export CXX=clang++ + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=23 ./test/syntax_check + clang --version + make -j $(getconf _NPROCESSORS_ONLN) + + build-clang-cpp23-linux-No-STL: + name: Syntax Check - Clang C++23 Linux No STL + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - uses: actions/checkout@v4 + + - name: Build + run: | + export CC=clang + export CXX=clang++ + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=23 ./test/syntax_check + clang --version + make -j $(getconf _NPROCESSORS_ONLN) + + build-clang-cpp23-linux-STL-Force-CPP03: + name: Syntax Check - Clang C++23 Linux STL Force C++03 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - uses: actions/checkout@v4 + + - name: Build + run: | + export CC=clang + export CXX=clang++ + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=23 ./test/syntax_check + clang --version + make -j $(getconf _NPROCESSORS_ONLN) + + build-clang-cpp23-linux-No-STL-Force-CPP03: + name: Syntax Check - Clang C++23 Linux No STL Force C++03 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - uses: actions/checkout@v4 + + - name: Build + run: | + export CC=clang + export CXX=clang++ + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=23 ./test/syntax_check clang --version make -j $(getconf _NPROCESSORS_ONLN) diff --git a/.github/workflows/gcc-c++11.yml b/.github/workflows/gcc-c++11.yml index 030d2482e..f4cea1b35 100644 --- a/.github/workflows/gcc-c++11.yml +++ b/.github/workflows/gcc-c++11.yml @@ -23,7 +23,7 @@ jobs: export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 export CC=gcc export CXX=g++ - cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=11 ./ + cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=11 ./ gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -46,7 +46,7 @@ jobs: export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 export CC=gcc export CXX=g++ - cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=11 ./ + cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=11 ./ gcc --version make -j $(getconf _NPROCESSORS_ONLN) diff --git a/.github/workflows/gcc-c++14.yml b/.github/workflows/gcc-c++14.yml index 9220446fd..a24f9312e 100644 --- a/.github/workflows/gcc-c++14.yml +++ b/.github/workflows/gcc-c++14.yml @@ -22,7 +22,7 @@ jobs: export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 export CC=gcc export CXX=g++ - cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=14 ./ + cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=14 ./ gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -44,7 +44,7 @@ jobs: export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 export CC=gcc export CXX=g++ - cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=14 ./ + cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=14 ./ gcc --version make -j $(getconf _NPROCESSORS_ONLN) diff --git a/.github/workflows/gcc-c++17.yml b/.github/workflows/gcc-c++17.yml index 34929496d..f16538ffa 100644 --- a/.github/workflows/gcc-c++17.yml +++ b/.github/workflows/gcc-c++17.yml @@ -22,7 +22,7 @@ jobs: export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 export CC=gcc export CXX=g++ - cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=17 ./ + cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=17 ./ gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -44,7 +44,7 @@ jobs: export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 export CC=gcc export CXX=g++ - cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=17 ./ + cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=17 ./ gcc --version make -j $(getconf _NPROCESSORS_ONLN) diff --git a/.github/workflows/gcc-c++20.yml b/.github/workflows/gcc-c++20.yml index be28e824f..35de10cff 100644 --- a/.github/workflows/gcc-c++20.yml +++ b/.github/workflows/gcc-c++20.yml @@ -22,7 +22,7 @@ jobs: export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 export CC=gcc export CXX=g++ - cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=20 ./ + cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=20 ./ gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -44,7 +44,7 @@ jobs: export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 export CC=gcc export CXX=g++ - cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=20 ./ + cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=20 ./ gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -66,7 +66,7 @@ jobs: export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 export CC=gcc export CXX=g++ - cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=20 ./ + cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=20 ./ gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -88,7 +88,7 @@ jobs: export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 export CC=gcc export CXX=g++ - cmake -DBUILD_TESTS=ON -DNO_STL=OON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=20 ./ + cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=20 ./ gcc --version make -j $(getconf _NPROCESSORS_ONLN) diff --git a/.github/workflows/gcc-c++23.yml b/.github/workflows/gcc-c++23.yml new file mode 100644 index 000000000..93881f848 --- /dev/null +++ b/.github/workflows/gcc-c++23.yml @@ -0,0 +1,96 @@ +name: gcc-c++23 +on: + push: + branches: [ master, development, pull-request/* ] + pull_request: + branches: [ master, pull-request/* ] + +jobs: + + build-gcc-cpp23-linux-stl: + name: GCC C++23 Linux - STL + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - uses: actions/checkout@v4 + + - name: Build + run: | + export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 + export CC=gcc + export CXX=g++ + cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=23 ./ + gcc --version + make -j $(getconf _NPROCESSORS_ONLN) + + - name: Run tests + run: ./test/etl_tests + + build-gcc-cpp23-linux-no-stl: + name: GCC C++23 Linux - No STL + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - uses: actions/checkout@v4 + + - name: Build + run: | + export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 + export CC=gcc + export CXX=g++ + cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=23 ./ + gcc --version + make -j $(getconf _NPROCESSORS_ONLN) + + - name: Run tests + run: ./test/etl_tests + + build-gcc-cpp23-linux-stl-force-cpp03: + name: GCC C++23 Linux - STL - Force C++03 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - uses: actions/checkout@v4 + + - name: Build + run: | + export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 + export CC=gcc + export CXX=g++ + cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=23 ./ + gcc --version + make -j $(getconf _NPROCESSORS_ONLN) + + - name: Run tests + run: ./test/etl_tests + + build-gcc-cpp23-linux-no-stl-force-cpp03: + name: GCC C++23 Linux - No STL - Force C++03 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - uses: actions/checkout@v4 + + - name: Build + run: | + export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0 + export CC=gcc + export CXX=g++ + cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=23 ./ + gcc --version + make -j $(getconf _NPROCESSORS_ONLN) + + - name: Run tests + run: ./test/etl_tests \ No newline at end of file diff --git a/.github/workflows/gcc-syntax-checks.yml b/.github/workflows/gcc-syntax-checks.yml index 75bcafa33..106d6d3b5 100644 --- a/.github/workflows/gcc-syntax-checks.yml +++ b/.github/workflows/gcc-syntax-checks.yml @@ -20,7 +20,7 @@ jobs: run: | export CC=gcc export CXX=g++ - cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=03 ./test/syntax_check gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -38,7 +38,7 @@ jobs: run: | export CC=gcc export CXX=g++ - cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=03 ./test/syntax_check gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -56,7 +56,7 @@ jobs: run: | export CC=gcc export CXX=g++ - cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=11 ./test/syntax_check gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -74,7 +74,7 @@ jobs: run: | export CC=gcc export CXX=g++ - cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=11 ./test/syntax_check gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -92,7 +92,7 @@ jobs: run: | export CC=gcc export CXX=g++ - cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=11 ./test/syntax_check gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -110,7 +110,7 @@ jobs: run: | export CC=gcc export CXX=g++ - cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=11 ./test/syntax_check gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -128,7 +128,7 @@ jobs: run: | export CC=gcc export CXX=g++ - cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=14 ./test/syntax_check gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -146,7 +146,7 @@ jobs: run: | export CC=gcc export CXX=g++ - cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=14 ./test/syntax_check gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -164,7 +164,7 @@ jobs: run: | export CC=gcc export CXX=g++ - cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=14 ./test/syntax_check gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -182,7 +182,7 @@ jobs: run: | export CC=gcc export CXX=g++ - cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=14 ./test/syntax_check gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -200,7 +200,7 @@ jobs: run: | export CC=gcc export CXX=g++ - cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=17 ./test/syntax_check gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -218,7 +218,7 @@ jobs: run: | export CC=gcc export CXX=g++ - cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=17 ./test/syntax_check gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -236,7 +236,7 @@ jobs: run: | export CC=gcc export CXX=g++ - cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=17 ./test/syntax_check gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -254,7 +254,7 @@ jobs: run: | export CC=gcc export CXX=g++ - cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=17 ./test/syntax_check gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -272,7 +272,7 @@ jobs: run: | export CC=gcc export CXX=g++ - cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=20 ./test/syntax_check gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -290,7 +290,7 @@ jobs: run: | export CC=gcc export CXX=g++ - cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF ./test/syntax_check + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=20 ./test/syntax_check gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -308,7 +308,7 @@ jobs: run: | export CC=gcc export CXX=g++ - cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=20 ./test/syntax_check gcc --version make -j $(getconf _NPROCESSORS_ONLN) @@ -326,6 +326,78 @@ jobs: run: | export CC=gcc export CXX=g++ - cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON ./test/syntax_check + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=20 ./test/syntax_check + gcc --version + make -j $(getconf _NPROCESSORS_ONLN) + + build-gcc-cpp23-linux-STL: + name: Syntax Check - GCC C++23 Linux STL + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - uses: actions/checkout@v4 + + - name: Build + run: | + export CC=gcc + export CXX=g++ + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=23 ./test/syntax_check + gcc --version + make -j $(getconf _NPROCESSORS_ONLN) + + build-gcc-cpp23-linux-No-STL: + name: Syntax Check - GCC C++23 Linux No STL + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - uses: actions/checkout@v4 + + - name: Build + run: | + export CC=gcc + export CXX=g++ + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=23 ./test/syntax_check + gcc --version + make -j $(getconf _NPROCESSORS_ONLN) + + build-gcc-cpp23-linux-STL-Force-CPP03: + name: Syntax Check - GCC C++23 Linux STL Force C++03 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - uses: actions/checkout@v4 + + - name: Build + run: | + export CC=gcc + export CXX=g++ + cmake -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=23 ./test/syntax_check + gcc --version + make -j $(getconf _NPROCESSORS_ONLN) + + build-gcc-cpp23-linux-No-STL-Force-CPP03: + name: Syntax Check - GCC C++23 Linux No STL Force C++03 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - uses: actions/checkout@v4 + + - name: Build + run: | + export CC=gcc + export CXX=g++ + cmake -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=23 ./test/syntax_check gcc --version make -j $(getconf _NPROCESSORS_ONLN) \ No newline at end of file diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml index 8324c507a..f910048a0 100644 --- a/.github/workflows/msvc.yml +++ b/.github/workflows/msvc.yml @@ -21,7 +21,7 @@ jobs: - name: Build run: | - cmake -G "Visual Studio 17 2022" -AWin32 -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=20 ./ + cmake -G "Visual Studio 17 2022" -AWin32 -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=20 ./ MSBuild.exe -version MSBuild.exe .\etl.sln @@ -42,7 +42,7 @@ jobs: - name: Build run: | - cmake -G "Visual Studio 17 2022" -AWin32 -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=OFF -DETL_CXX_STANDARD=17 ./ + cmake -G "Visual Studio 17 2022" -AWin32 -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=17 ./ MSBuild.exe -version MSBuild.exe .\etl.sln @@ -64,7 +64,7 @@ jobs: - name: Build run: | - cmake -G "Visual Studio 17 2022" -AWin32 -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=17 ./ + cmake -G "Visual Studio 17 2022" -AWin32 -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=17 ./ MSBuild.exe -version MSBuild.exe .\etl.sln @@ -86,7 +86,7 @@ jobs: - name: Build run: | - cmake -G "Visual Studio 17 2022" -AWin32 -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03=ON -DETL_CXX_STANDARD=17 ./ + cmake -G "Visual Studio 17 2022" -AWin32 -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=17 ./ MSBuild.exe -version MSBuild.exe .\etl.sln diff --git a/.gitignore b/.gitignore index 54c9275f1..8caedc192 100644 --- a/.gitignore +++ b/.gitignore @@ -397,3 +397,6 @@ test/syntax_check/bgcc test/syntax_check/bclang test/vs2022/Debug Clang C++20 test/vs2022/Debug MSVC C++20 - Forve C++03 - No virtual messages +test/reflog.txt +test/etl_error_handler/assert_function/build-make +test/syntax_check/bgcc diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f81b8bbe..cbe4564db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,14 +1,14 @@ ####################################################################### # The Embedded Template Library (https://www.etlcpp.com/) ####################################################################### -cmake_minimum_required(VERSION 3.5.0) +cmake_minimum_required(VERSION 3.10) include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/helpers.cmake) set(MSG_PREFIX "etl |") -determine_version_with_git(${GIT_DIR_LOOKUP_POLICY}) +etl_determine_version_with_git(${GIT_DIR_LOOKUP_POLICY}) if(NOT ETL_VERSION) - determine_version_with_file("version.txt") + etl_determine_version_with_file("version.txt") endif() project(etl VERSION ${ETL_VERSION} LANGUAGES CXX) @@ -52,11 +52,24 @@ if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME}) ) if(ETL_VERSION) # Generate the package configuration files using CMake provided macros - write_basic_package_version_file( - "${PROJECT_NAME}ConfigVersion.cmake" - COMPATIBILITY SameMajorVersion - ARCH_INDEPENDENT - ) + if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.14) + # Generate the package configuration files using CMake provided macros + write_basic_package_version_file( + "${PROJECT_NAME}ConfigVersion.cmake" + COMPATIBILITY SameMajorVersion + ARCH_INDEPENDENT + ) + else() + # This is needed for CMake < 3.14 + # because the ARCH_INDEPENDENT option is not available + # in CMake < 3.14 + # See https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html + # for more information + write_basic_package_version_file( + "${PROJECT_NAME}ConfigVersion.cmake" + COMPATIBILITY SameMajorVersion + ) + endif() endif() configure_package_config_file( "${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aa9253af5..693910fe1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,5 +9,5 @@ If your are considering creating a pull request, please observe the following: There is a project file for VS2022 for C++14, 17, 20, and bash scripts that run the tests for C++11, 14, 17, 20 under Linux with GCC and Clang. -If you are thinking of adding a new feature then raise this on the GitHub Issues page for disccussion as the maintainers and user of the ETL may have questions or suggestions. +If you are thinking of adding a new feature then raise this on the GitHub Issues page for discussion as the maintainers and user of the ETL may have questions or suggestions. It is possible that the maintainer of the ETL or another contributor is already working on the same or a related feature. diff --git a/README.md b/README.md index 50c564c75..b237c5e83 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,14 @@ Embedded Template Library (ETL) ![CI](https://github.com/ETLCPP/etl/actions/workflows/gcc-c++14.yml/badge.svg?branch=master) ![CI](https://github.com/ETLCPP/etl/actions/workflows/gcc-c++17.yml/badge.svg?branch=master) ![CI](https://github.com/ETLCPP/etl/actions/workflows/gcc-c++20.yml/badge.svg?branch=master) +![CI](https://github.com/ETLCPP/etl/actions/workflows/gcc-c++23.yml/badge.svg?branch=master) ![CI](https://github.com/ETLCPP/etl/actions/workflows/gcc-syntax-checks.yml/badge.svg?branch=master) ![CI](https://github.com/ETLCPP/etl/actions/workflows/clang-c++11.yml/badge.svg?branch=master) ![CI](https://github.com/ETLCPP/etl/actions/workflows/clang-c++14.yml/badge.svg?branch=master) ![CI](https://github.com/ETLCPP/etl/actions/workflows/clang-c++17.yml/badge.svg?branch=master) ![CI](https://github.com/ETLCPP/etl/actions/workflows/clang-c++20.yml/badge.svg?branch=master) +![CI](https://github.com/ETLCPP/etl/actions/workflows/clang-c++23.yml/badge.svg?branch=master) ![CI](https://github.com/ETLCPP/etl/actions/workflows/clang-syntax-checks.yml/badge.svg?branch=master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/3c14cd918ccf40008d0bcd7b083d5946)](https://www.codacy.com/manual/jwellbelove/etl?utm_source=github.com&utm_medium=referral&utm_content=ETLCPP/etl&utm_campaign=Badge_Grade) @@ -44,13 +46,13 @@ The ETL is not designed to completely replace the STL, but complement it. Its design objective covers three areas. - Create a set of containers where the size or maximum size is determined at compile time. These containers are direct equivalents of those supplied in the STL. -- Be compatible with C++ 03 but implement as many of the C++ 11/14/17/20 additions as possible. +- Be compatible with C++ 03 but implement as many of the C++ 11/14/17/20/23 additions as possible. - Add other useful components that are not present in the standard library. The embedded template library has been designed for lower resource embedded applications. It contains a set of containers, algorithms and utilities, some of which emulate parts of the STL. There is no dynamic memory allocation. The library makes no use of the heap. All of the containers have a fixed capacity allowing all memory allocation to be determined at compile time. -The library is intended for any compiler that supports C++98/03/11/14/17/20. +The library is intended for any compiler that supports C++98/03/11/14/17/20/23. ## Main features diff --git a/appveyor.yml b/appveyor.yml index a3cba3df1..0b8eef403 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,11 +16,5 @@ install: build: project: test/vs2022/etl.vcxproj verbosity: minimal -notifications: -- provider: Webhook - url: https://hooks.slack.com/services/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 - method: POST - on_build_success: true - on_build_failure: true - on_build_status_changed: true + \ No newline at end of file diff --git a/arduino/library-arduino.json b/arduino/library-arduino.json index f3956d8ce..3561c28d6 100644 --- a/arduino/library-arduino.json +++ b/arduino/library-arduino.json @@ -1,6 +1,6 @@ { "name": "Embedded Template Library ETL", - "version": "20.40.0", + "version": "20.41.1", "authors": { "name": "John Wellbelove", "email": "john.wellbelove@etlcpp.com" diff --git a/arduino/library-arduino.properties b/arduino/library-arduino.properties index 307259d18..7719f66af 100644 --- a/arduino/library-arduino.properties +++ b/arduino/library-arduino.properties @@ -1,5 +1,5 @@ name=Embedded Template Library ETL -version=20.40.0 +version=20.41.1 author= John Wellbelove maintainer=John Wellbelove license=MIT diff --git a/cmake/GetGitRevisionDescription.cmake b/cmake/GetGitRevisionDescription.cmake index 07ec5fafb..d0966da11 100644 --- a/cmake/GetGitRevisionDescription.cmake +++ b/cmake/GetGitRevisionDescription.cmake @@ -12,23 +12,6 @@ # Returns the results of git describe on the source tree, and adjusting # the output so that it tests false if an error occurs. # -# git_describe_working_tree( [ ...]) -# -# Returns the results of git describe on the working tree (--dirty option), -# and adjusting the output so that it tests false if an error occurs. -# -# git_get_exact_tag( [ ...]) -# -# Returns the results of git describe --exact-match on the source tree, -# and adjusting the output so that it tests false if there was no exact -# matching tag. -# -# git_local_changes() -# -# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes. -# Uses the return code of "git diff-index --quiet HEAD --". -# Does not regard untracked files. -# # Requires CMake 2.6 or newer (uses the 'function' command) # # Original Author: @@ -43,10 +26,10 @@ # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -if(__get_git_revision_description) +if(__etl_get_git_revision_description) return() endif() -set(__get_git_revision_description YES) +set(__etl_get_git_revision_description YES) # We must run the following at "include" time, not at function call time, # to find the path to this module rather than the path to a calling list file @@ -62,7 +45,7 @@ get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) # neither foo nor bar contain a file/directory .git. This will return # C:/bla/.git # -function(_git_find_closest_git_dir _start_dir _git_dir_var) +function(_etl_git_find_closest_git_dir _start_dir _git_dir_var) set(cur_dir "${_start_dir}") set(git_dir "${_start_dir}/.git") while(NOT EXISTS "${git_dir}") @@ -83,8 +66,8 @@ function(_git_find_closest_git_dir _start_dir _git_dir_var) PARENT_SCOPE) endfunction() -function(get_git_head_revision _refspecvar _hashvar) - _git_find_closest_git_dir("${CMAKE_CURRENT_SOURCE_DIR}" GIT_DIR) +function(etl_get_git_head_revision _refspecvar _hashvar) + _etl_git_find_closest_git_dir("${CMAKE_CURRENT_SOURCE_DIR}" GIT_DIR) if("${ARGN}" STREQUAL "ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR") set(ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR TRUE) @@ -143,7 +126,7 @@ function(get_git_head_revision _refspecvar _hashvar) string(REGEX REPLACE "gitdir: (.*)$" "\\1" git_worktree_dir ${worktree_ref}) string(STRIP ${git_worktree_dir} git_worktree_dir) - _git_find_closest_git_dir("${git_worktree_dir}" GIT_DIR) + _etl_git_find_closest_git_dir("${git_worktree_dir}" GIT_DIR) set(HEAD_SOURCE_FILE "${git_worktree_dir}/HEAD") endif() else() @@ -172,11 +155,11 @@ function(get_git_head_revision _refspecvar _hashvar) PARENT_SCOPE) endfunction() -function(git_describe _var) +function(etl_git_describe _var) if(NOT GIT_FOUND) find_package(Git QUIET) endif() - get_git_head_revision(refspec hash ${ARGN}) + etl_get_git_head_revision(refspec hash ${ARGN}) if(NOT GIT_FOUND) set(${_var} "GIT-NOTFOUND" @@ -214,71 +197,3 @@ function(git_describe _var) "${out}" PARENT_SCOPE) endfunction() - -function(git_describe_working_tree _var) - if(NOT GIT_FOUND) - find_package(Git QUIET) - endif() - if(NOT GIT_FOUND) - set(${_var} - "GIT-NOTFOUND" - PARENT_SCOPE) - return() - endif() - - execute_process( - COMMAND "${GIT_EXECUTABLE}" describe --dirty ${ARGN} - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - RESULT_VARIABLE res - OUTPUT_VARIABLE out - ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - if(NOT res EQUAL 0) - set(out "${out}-${res}-NOTFOUND") - endif() - - set(${_var} - "${out}" - PARENT_SCOPE) -endfunction() - -function(git_get_exact_tag _var) - git_describe(out --exact-match ${ARGN}) - set(${_var} - "${out}" - PARENT_SCOPE) -endfunction() - -function(git_local_changes _var) - if(NOT GIT_FOUND) - find_package(Git QUIET) - endif() - get_git_head_revision(refspec hash) - if(NOT GIT_FOUND) - set(${_var} - "GIT-NOTFOUND" - PARENT_SCOPE) - return() - endif() - if(NOT hash) - set(${_var} - "HEAD-HASH-NOTFOUND" - PARENT_SCOPE) - return() - endif() - - execute_process( - COMMAND "${GIT_EXECUTABLE}" diff-index --quiet HEAD -- - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - RESULT_VARIABLE res - OUTPUT_VARIABLE out - ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - if(res EQUAL 0) - set(${_var} - "CLEAN" - PARENT_SCOPE) - else() - set(${_var} - "DIRTY" - PARENT_SCOPE) - endif() -endfunction() diff --git a/cmake/helpers.cmake b/cmake/helpers.cmake index 4624f3c2e..00172c880 100644 --- a/cmake/helpers.cmake +++ b/cmake/helpers.cmake @@ -1,4 +1,4 @@ -function(determine_version_with_file VER_FILE_NAME) +function(etl_determine_version_with_file VER_FILE_NAME) file(READ ${VER_FILE_NAME} ETL_VERSION_RAW) # Remove trailing whitespaces and/or newline string(STRIP ${ETL_VERSION_RAW} ETL_VERSION) @@ -8,9 +8,9 @@ function(determine_version_with_file VER_FILE_NAME) message(STATUS "${MSG_PREFIX} Determined ETL version ${ETL_VERSION} from version.txt file") endfunction() -function(determine_version_with_git) +function(etl_determine_version_with_git) include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/GetGitRevisionDescription.cmake) - git_describe(VERSION ${ARGN}) + etl_git_describe(VERSION ${ARGN}) string(FIND ${VERSION} "." VALID_VERSION) if(VALID_VERSION EQUAL -1) if(CMAKE_CURRENT_LIST_DIR STREQUAL PROJECT_SOURCE_DIR) diff --git a/include/etl/algorithm.h b/include/etl/algorithm.h index 5dc231bb3..7773ac281 100644 --- a/include/etl/algorithm.h +++ b/include/etl/algorithm.h @@ -43,7 +43,10 @@ SOFTWARE. #include "iterator.h" #include "functional.h" #include "utility.h" +#include "largest.h" #include "gcd.h" +#include "error_handler.h" +#include "exception.h" #include #include @@ -82,6 +85,27 @@ namespace etl template ETL_CONSTEXPR14 void insertion_sort(TIterator first, TIterator last, TCompare compare); + + class algorithm_exception : public etl::exception + { + public: + + algorithm_exception(string_type reason_, string_type file_name_, numeric_type line_number_) + : exception(reason_, file_name_, line_number_) + { + } + }; + + class algorithm_error : public algorithm_exception + { + public: + + algorithm_error(string_type file_name_, numeric_type line_number_) + : algorithm_exception(ETL_ERROR_TEXT("algorithm:error", ETL_ALGORITHM_FILE_ID"A"), file_name_, line_number_) + { + } + }; + } //***************************************************************************** @@ -929,12 +953,12 @@ namespace etl while ((value_index > top_index) && compare(first[parent], value)) { - first[value_index] = etl::move(first[parent]); + first[value_index] = ETL_MOVE(first[parent]); value_index = parent; parent = (value_index - 1) / 2; } - first[value_index] = etl::move(value); + first[value_index] = ETL_MOVE(value); } // Adjust Heap Helper @@ -951,18 +975,18 @@ namespace etl --child2nd; } - first[value_index] = etl::move(first[child2nd]); + first[value_index] = ETL_MOVE(first[child2nd]); value_index = child2nd; child2nd = 2 * (child2nd + 1); } if (child2nd == length) { - first[value_index] = etl::move(first[child2nd - 1]); + first[value_index] = ETL_MOVE(first[child2nd - 1]); value_index = child2nd - 1; } - push_heap(first, value_index, top_index, etl::move(value), compare); + push_heap(first, value_index, top_index, ETL_MOVE(value), compare); } // Is Heap Helper @@ -995,10 +1019,10 @@ namespace etl typedef typename etl::iterator_traits::value_type value_t; typedef typename etl::iterator_traits::difference_type distance_t; - value_t value = etl::move(last[-1]); - last[-1] = etl::move(first[0]); + value_t value = ETL_MOVE(last[-1]); + last[-1] = ETL_MOVE(first[0]); - private_heap::adjust_heap(first, distance_t(0), distance_t(last - first - 1), etl::move(value), compare); + private_heap::adjust_heap(first, distance_t(0), distance_t(last - first - 1), ETL_MOVE(value), compare); } // Pop Heap @@ -1017,7 +1041,7 @@ namespace etl typedef typename etl::iterator_traits::difference_type difference_t; typedef typename etl::iterator_traits::value_type value_t; - private_heap::push_heap(first, difference_t(last - first - 1), difference_t(0), value_t(etl::move(*(last - 1))), compare); + private_heap::push_heap(first, difference_t(last - first - 1), difference_t(0), value_t(ETL_MOVE(*(last - 1))), compare); } // Push Heap @@ -1045,7 +1069,7 @@ namespace etl while (true) { - private_heap::adjust_heap(first, parent, length, etl::move(*(first + parent)), compare); + private_heap::adjust_heap(first, parent, length, ETL_MOVE(*(first + parent)), compare); if (parent == 0) { @@ -1182,7 +1206,7 @@ namespace etl for (int i = 0; i < gcd_nm; i++) { - value_type temp = etl::move(*(first + i)); + value_type temp = ETL_MOVE(*(first + i)); int j = i; while (true) @@ -1199,11 +1223,11 @@ namespace etl break; } - *(first + j) = etl::move(*(first + k)); + *(first + j) = ETL_MOVE(*(first + k)); j = k; } - *(first + j) = etl::move(temp); + *(first + j) = ETL_MOVE(temp); } return result; @@ -1324,13 +1348,13 @@ namespace etl typedef typename etl::iterator_traits::value_type value_type; // Save the first item. - value_type temp(etl::move(*first)); + value_type temp(ETL_MOVE(*first)); // Move the rest. TIterator result = etl::move(etl::next(first), last, first); // Restore the first item in its rotated position. - *result = etl::move(temp); + *result = ETL_MOVE(temp); // The new position of the first item. return result; @@ -1346,13 +1370,13 @@ namespace etl // Save the last item. TIterator previous = etl::prev(last); - value_type temp(etl::move(*previous)); + value_type temp(ETL_MOVE(*previous)); // Move the rest. TIterator result = etl::move_backward(first, previous, last); // Restore the last item in its rotated position. - *first = etl::move(temp); + *first = ETL_MOVE(temp); // The new position of the first item. return result; @@ -2127,7 +2151,7 @@ namespace etl { while (first != last) { - sum = etl::move(sum) + *first; + sum = ETL_MOVE(sum) + *first; ++first; } @@ -2144,7 +2168,7 @@ namespace etl { while (first != last) { - sum = operation(etl::move(sum), *first); + sum = operation(ETL_MOVE(sum), *first); ++first; } @@ -2201,7 +2225,7 @@ namespace etl { if (!(*itr == value)) { - *first++ = etl::move(*itr); + *first++ = ETL_MOVE(*itr); } } } @@ -2227,7 +2251,7 @@ namespace etl { if (!predicate(*itr)) { - *first++ = etl::move(*itr); + *first++ = ETL_MOVE(*itr); } } } @@ -2257,16 +2281,27 @@ namespace etl ETL_CONSTEXPR14 typename etl::enable_if::value && etl::is_random_iterator::value, TOutputIterator>::type - copy_s(TInputIterator i_begin, - TInputIterator i_end, - TOutputIterator o_begin, - TOutputIterator o_end) + copy_s(TInputIterator i_begin, + TInputIterator i_end, + TOutputIterator o_begin, + TOutputIterator o_end) { - size_t s_size = etl::distance(i_begin, i_end); - size_t d_size = etl::distance(o_begin, o_end); - size_t size = (s_size < d_size) ? s_size : d_size; + typedef typename iterator_traits::difference_type s_size_type; + typedef typename iterator_traits::difference_type d_size_type; + +#if ETL_USING_CPP11 + typedef typename etl::common_type::type min_size_type; +#else + typedef typename etl::largest_type::type min_size_type; +#endif - return etl::copy(i_begin, i_begin + size, o_begin); + s_size_type s_size = etl::distance(i_begin, i_end); + ETL_ASSERT(s_size >= 0, ETL_ERROR(algorithm_error)); + d_size_type d_size = etl::distance(o_begin, o_end); + ETL_ASSERT(d_size >= 0, ETL_ERROR(algorithm_error)); + min_size_type size = etl::min(s_size, d_size); + + return etl::copy(i_begin, i_begin + size, o_begin); } //*************************************************************************** @@ -2429,9 +2464,15 @@ namespace etl TOutputIterator o_begin, TOutputIterator o_end) { - size_t s_size = etl::distance(i_begin, i_end); - size_t d_size = etl::distance(o_begin, o_end); - size_t size = (s_size < d_size) ? s_size : d_size; + using s_size_type = typename iterator_traits::difference_type; + using d_size_type = typename iterator_traits::difference_type; + using min_size_type = typename etl::common_type::type; + + s_size_type s_size = etl::distance(i_begin, i_end); + ETL_ASSERT(s_size >= 0, ETL_ERROR(algorithm_error)); + d_size_type d_size = etl::distance(o_begin, o_end); + ETL_ASSERT(d_size >= 0, ETL_ERROR(algorithm_error)); + min_size_type size = etl::min(s_size, d_size); return etl::move(i_begin, i_begin + size, o_begin); } diff --git a/include/etl/alignment.h b/include/etl/alignment.h index c6a4de066..dab558322 100644 --- a/include/etl/alignment.h +++ b/include/etl/alignment.h @@ -36,6 +36,7 @@ SOFTWARE. #include "static_assert.h" #include "error_handler.h" #include "exception.h" +#include "utility.h" #include @@ -71,10 +72,23 @@ namespace etl } }; + //*************************************************************************** + /// Typed storage exception. + //*************************************************************************** + class typed_storage_error : public alignment_exception + { + public: + + typed_storage_error(string_type file_name_, numeric_type line_number_) + : alignment_exception(ETL_ERROR_TEXT("typed_storage:error", ETL_ALIGNMENT_FILE_ID"B"), file_name_, line_number_) + { + } + }; + //***************************************************************************** /// Check that 'p' has 'required_alignment'. //***************************************************************************** - inline bool is_aligned(void* p, size_t required_alignment) + inline bool is_aligned(const void* p, size_t required_alignment) { uintptr_t address = reinterpret_cast(p); return (address % required_alignment) == 0U; @@ -84,7 +98,7 @@ namespace etl /// Check that 'p' has 'Alignment'. //***************************************************************************** template - bool is_aligned(void* p) + bool is_aligned(const void* p) { uintptr_t address = reinterpret_cast(p); return (address % Alignment) == 0U; @@ -94,7 +108,7 @@ namespace etl /// Check that 'p' has the alignment of 'T'. //***************************************************************************** template - bool is_aligned(void* p) + bool is_aligned(const void* p) { return is_aligned::value>(p); } @@ -334,6 +348,167 @@ namespace etl template using aligned_storage_as_t = typename aligned_storage_as::type; #endif + + //*************************************************************************** + /// Wrapper class that provides a memory area and lets the user create an + /// instance of T in this memory at runtime. This class also erases the + /// destructor call of T, i.e. if typed_storage goes out of scope, the + /// destructor if the wrapped type will not be called. This can be done + /// explicitly by calling destroy(). + /// \tparam T Type of element stored in this instance of typed_storage. + //*************************************************************************** + template + class typed_storage + { + public: + + typedef T value_type; + typedef T& reference; + typedef const T& const_reference; + typedef T* pointer; + typedef const T* const_pointer; + + // Constructor + typed_storage() + : valid(false) + { + } + + //*************************************************************************** + /// Default destructor which will NOT call the destructor of the object which + /// was created by calling create(). + //*************************************************************************** + ~typed_storage() = default; + + //*************************************************************************** + /// Calls the destructor of the wrapped object and asserts if has_value() is false. + //*************************************************************************** + void destroy() + { + ETL_ASSERT(has_value(), ETL_ERROR(etl::typed_storage_error)); + data.template get_reference().~T(); + valid = false; + } + + //*************************************************************************** + /// \returns true if object has been constructed using create(). + /// \returns false otherwise. + //*************************************************************************** + bool has_value() const + { + return valid; + } + +#if ETL_USING_CPP11 + //*************************************************************************** + /// Constructs the instance of T forwarding the given \p args to its constructor and + /// asserts if has_value() is false. + /// + /// \returns the instance of T which has been constructed in the internal byte array. + //*************************************************************************** + template + reference create(Args&&... args) + { + ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error)); + valid = true; + return *::new (data.template get_address()) value_type(etl::forward(args)...); + } +#else + //*************************************************************************** + /// Constructs the instance of T with type T1 + /// asserts if has_value() is false. + /// + /// \returns the instance of T which has been constructed in the internal byte array. + //*************************************************************************** + template + reference create(const T1& t1) + { + ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error)); + valid = true; + return *::new (data.template get_address()) value_type(t1); + } + + //*************************************************************************** + /// Constructs the instance of T with types T1, T2 + /// asserts if has_value() is false. + /// + /// \returns the instance of T which has been constructed in the internal byte array. + //*************************************************************************** + template + reference create(const T1& t1, const T2& t2) + { + ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error)); + valid = true; + return *::new (data.template get_address()) value_type(t1, t2); + } + + //*************************************************************************** + /// Constructs the instance of T with types T1, T2, T3 + /// asserts if has_value() is false. + /// + /// \returns the instance of T which has been constructed in the internal byte array. + //*************************************************************************** + template + reference create(const T1& t1, const T2& t2, const T3& t3) + { + ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error)); + valid = true; + return *::new (data.template get_address()) value_type(t1, t2, t3); + } + + //*************************************************************************** + /// Constructs the instance of T with types T1, T2, T3, T4 + /// asserts if has_value() is false. + /// + /// \returns the instance of T which has been constructed in the internal byte array. + //*************************************************************************** + template + reference create(const T1& t1, const T2& t2, const T3& t3, const T4& t4) + { + ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error)); + valid = true; + return *::new (data.template get_address()) value_type(t1, t2, t3, t4); + } +#endif + + //*************************************************************************** + /// \returns a pointer of type T and asserts if has_value() is false. + //*************************************************************************** + pointer operator->() + { + ETL_ASSERT(has_value(), ETL_ERROR(etl::typed_storage_error)); + return data.template get_address(); + } + + //*************************************************************************** + /// \returns a const pointer of type T and asserts if has_value() is false. + //*************************************************************************** + const_pointer operator->() const + { + return operator->(); + } + + //*************************************************************************** + /// \returns reference of type T and asserts if has_value() is false. + //*************************************************************************** + reference operator*() + { + return *operator->(); + } + + //*************************************************************************** + /// \returns const reference of type T and asserts if has_value() is false. + //*************************************************************************** + const_reference operator*() const + { + return *operator->(); + } + + private: + + typename aligned_storage_as::type data; + bool valid; + }; } #endif diff --git a/include/etl/array.h b/include/etl/array.h index 8615f5af8..230ada247 100644 --- a/include/etl/array.h +++ b/include/etl/array.h @@ -204,7 +204,7 @@ namespace etl ETL_CONSTEXPR14 pointer data() ETL_NOEXCEPT { - return &_buffer[0]; + return _buffer; } //************************************************************************* @@ -213,7 +213,7 @@ namespace etl ETL_NODISCARD ETL_CONSTEXPR const_pointer data() const ETL_NOEXCEPT { - return &_buffer[0]; + return _buffer; } //************************************************************************* @@ -227,7 +227,7 @@ namespace etl ETL_CONSTEXPR14 iterator begin() ETL_NOEXCEPT { - return &_buffer[0]; + return _buffer; } //************************************************************************* @@ -236,7 +236,7 @@ namespace etl ETL_NODISCARD ETL_CONSTEXPR const_iterator begin() const ETL_NOEXCEPT { - return &_buffer[0]; + return _buffer; } //************************************************************************* @@ -602,6 +602,461 @@ namespace etl template ETL_CONSTANT size_t array::SIZE; + //*************************************************************************** + ///\ingroup array + /// A replacement for std::array if you haven't got C++0x11. + /// Specialisation for zero sized array. + //*************************************************************************** + template + class array + { + private: + + typedef typename etl::parameter_type::type parameter_t; + + public: + + static ETL_CONSTANT size_t SIZE = 0; + + typedef T value_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef T& reference; + typedef const T& const_reference; + typedef T* pointer; + typedef const T* const_pointer; + typedef T* iterator; + typedef const T* const_iterator; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; + + //************************************************************************* + // Element access + //************************************************************************* + + //************************************************************************* + /// Returns a reference to the value at index 'i'. + ///\param i The index of the element to access. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR14 + reference at(size_t) + { + return *data(); + } + + //************************************************************************* + /// Returns a const reference to the value at index 'i'. + ///\param i The index of the element to access. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR14 + const_reference at(size_t) const + { + return *data(); + } + + //************************************************************************* + /// [] operator. + /// Returns a reference to the value at index 'i'. + ///\param i The index of the element to access. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR14 + reference operator[](size_t) + { + return *data(); + } + + //************************************************************************* + /// [] operator. + /// Returns a const reference to the value at index 'i'. + ///\param i The index of the element to access. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR const_reference operator[](size_t) const + { + return *data(); + } + + //************************************************************************* + /// Returns a reference to the first element. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR14 + reference front() + { + return *data(); + } + + //************************************************************************* + /// Returns a const reference to the first element. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR const_reference front() const + { + return *data(); + } + + //************************************************************************* + /// Returns a reference to the last element. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR14 + reference back() + { + return *data(); + } + + //************************************************************************* + /// Returns a const reference to the last element. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR const_reference back() const + { + return *data(); + } + + //************************************************************************* + /// Returns a pointer to the first element of the internal buffer. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR14 + pointer data() ETL_NOEXCEPT + { + return (T*)0; + } + + //************************************************************************* + /// Returns a const pointer to the first element of the internal buffer. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR const_pointer data() const ETL_NOEXCEPT + { + return (const T*)0; + } + + //************************************************************************* + // Iterators + //************************************************************************* + + //************************************************************************* + /// Returns an iterator to the beginning of the array. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR14 + iterator begin() ETL_NOEXCEPT + { + return iterator(); + } + + //************************************************************************* + /// Returns a const iterator to the beginning of the array. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR const_iterator begin() const ETL_NOEXCEPT + { + return const_iterator(); + } + + //************************************************************************* + /// Returns a const iterator to the beginning of the array. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR const_iterator cbegin() const ETL_NOEXCEPT + { + return const_iterator(); + } + + //************************************************************************* + /// Returns an iterator to the end of the array. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR14 + iterator end() ETL_NOEXCEPT + { + return iterator(); + } + + //************************************************************************* + /// Returns a const iterator to the end of the array. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR const_iterator end() const ETL_NOEXCEPT + { + return const_iterator(); + } + + //************************************************************************* + // Returns a const iterator to the end of the array. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR const_iterator cend() const ETL_NOEXCEPT + { + return const_iterator(); + } + + //************************************************************************* + // Returns an reverse iterator to the reverse beginning of the array. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR14 + reverse_iterator rbegin() ETL_NOEXCEPT + { + return reverse_iterator(end()); + } + + //************************************************************************* + /// Returns a const reverse iterator to the reverse beginning of the array. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR const_reverse_iterator rbegin() const ETL_NOEXCEPT + { + return const_reverse_iterator(end()); + } + + //************************************************************************* + /// Returns a const reverse iterator to the reverse beginning of the array. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR const_reverse_iterator crbegin() const ETL_NOEXCEPT + { + return const_reverse_iterator(end()); + } + + //************************************************************************* + /// Returns a reverse iterator to the end of the array. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR14 + reverse_iterator rend() ETL_NOEXCEPT + { + return reverse_iterator(begin()); + } + + //************************************************************************* + /// Returns a const reverse iterator to the end of the array. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR const_reverse_iterator rend() const ETL_NOEXCEPT + { + return const_reverse_iterator(begin()); + } + + //************************************************************************* + /// Returns a const reverse iterator to the end of the array. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR const_reverse_iterator crend() const ETL_NOEXCEPT + { + return const_reverse_iterator(begin()); + } + + //************************************************************************* + // Capacity + //************************************************************************* + + //************************************************************************* + /// Returns true if the array size is zero. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR bool empty() const ETL_NOEXCEPT + { + return true; + } + + //************************************************************************* + /// Returns the size of the array. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR size_t size() const ETL_NOEXCEPT + { + return 0; + } + + //************************************************************************* + /// Returns the maximum possible size of the array. + //************************************************************************* + ETL_NODISCARD + ETL_CONSTEXPR size_t max_size() const ETL_NOEXCEPT + { + return 0; + } + + //************************************************************************* + // Operations + //************************************************************************* + + //************************************************************************* + /// Fills the array with the specified value. + ///\param value The value to fill the array with. + //************************************************************************* + ETL_CONSTEXPR14 void fill(parameter_t) + { + } + + //************************************************************************* + /// Swaps the contents of this array and another. + ///\param other A reference to the other array. + //************************************************************************* + ETL_CONSTEXPR14 void swap(array&) ETL_NOEXCEPT + { + } + + //************************************************************************* + /// Fills the array from the range. + /// If the range is smaller than the array then the unused array elements are left unmodified. + ///\param first The iterator to the first item in the range. + ///\param last The iterator to one past the final item in the range. + ///\return An iterator to the first unassigned array element, or end(). + //************************************************************************* + template + iterator assign(TIterator, const TIterator) + { + return iterator(); + } + + //************************************************************************* + /// Fills the array from the range. + /// If the range is smaller than the array then the unused array elements are initialised with the supplied value. + ///\param first The iterator to the first item in the range. + ///\param last The iterator to one past the final item in the range. + ///\return An iterator to the first array element set to 'value', or end(). + //************************************************************************* + template + iterator assign(TIterator, const TIterator, parameter_t) + { + return iterator(); + } + + //************************************************************************* + /// Inserts a value into the array. + ///\param position The index of the position to insert at. + ///\param value The value to insert. + //************************************************************************* + inline iterator insert_at(size_t, parameter_t) + { + return iterator(); + } + + //************************************************************************* + /// Inserts a value into the array. + ///\param position The iterator to the position to insert at. + ///\param value The value to insert. + //************************************************************************* + iterator insert(const_iterator, parameter_t) + { + return iterator(); + } + + //************************************************************************* + /// Insert into the array from the range. + ///\param position The position to insert at. + ///\param first The iterator to the first item in the range. + ///\param last The iterator to one past the final item in the range. + //************************************************************************* + template + inline iterator insert_at(size_t, TIterator, const TIterator) + { + return iterator(); + } + + //************************************************************************* + /// Insert into the array from the range. + ///\param position The position to insert at. + ///\param first The iterator to the first item in the range. + ///\param last The iterator to one past the final item in the range. + //************************************************************************* + template + iterator insert(const_iterator, TIterator, const TIterator) + { + return iterator(); + } + + //************************************************************************* + /// Erases a value from the array. + /// After erase, the last value in the array will be unmodified. + ///\param position The index of the position to erase at. + //************************************************************************* + inline iterator erase_at(size_t) + { + return iterator(); + } + + //************************************************************************* + /// Erases a value from the array. + /// After erase, the last value in the array will be unmodified. + ///\param position The iterator to the position to erase at. + //************************************************************************* + iterator erase(const_iterator) + { + return iterator(); + } + + //************************************************************************* + /// Erases a range of values from the array. + /// After erase, the last values in the array will be unmodified. + ///\param first The first item to erase. + ///\param last The one past the last item to erase. + //************************************************************************* + iterator erase_range(size_t, size_t) + { + return iterator(); + } + + //************************************************************************* + /// Erases a range of values from the array. + /// After erase, the last values in the array will be unmodified. + ///\param first The first item to erase. + ///\param last The one past the last item to erase. + //************************************************************************* + iterator erase(const_iterator, const_iterator) + { + return iterator(); + } + + //************************************************************************* + /// Erases a value from the array. + ///\param position The index of the position to erase at. + ///\param value The value to use to overwrite the last element in the array. + //************************************************************************* + inline iterator erase_at(size_t, parameter_t) + { + return iterator(); + } + + //************************************************************************* + /// Erases a value from the array. + ///\param position The iterator to the position to erase at. + ///\param value The value to use to overwrite the last element in the array. + //************************************************************************* + iterator erase(const_iterator, parameter_t) + { + return iterator(); + } + + //************************************************************************* + /// Erases a range of values from the array. + ///\param first The first item to erase. + ///\param last The one past the last item to erase. + ///\param value The value to use to overwrite the last elements in the array. + //************************************************************************* + iterator erase_range(size_t, size_t, parameter_t) + { + return iterator(); + } + + //************************************************************************* + /// Erases a range of values from the array. + ///\param position The iterator to the position to erase at. + ///\param value The value to use to overwrite the last elements in the array. + //************************************************************************* + iterator erase(const_iterator, const_iterator, parameter_t) + { + return iterator(); + } + }; + //************************************************************************* /// Template deduction guides. //************************************************************************* @@ -615,7 +1070,7 @@ namespace etl //************************************************************************* #if ETL_HAS_INITIALIZER_LIST template - constexpr auto make_array(TValues&&... values) -> etl::array + constexpr auto make_array(TValues&&... values) ETL_NOEXCEPT -> etl::array { return { etl::forward(values)... }; } diff --git a/include/etl/basic_string.h b/include/etl/basic_string.h index 1a9f0c9b6..0b0404b5c 100644 --- a/include/etl/basic_string.h +++ b/include/etl/basic_string.h @@ -38,13 +38,11 @@ SOFTWARE. #include "char_traits.h" #include "alignment.h" #include "array.h" -#include "algorithm.h" #include "type_traits.h" #include "error_handler.h" #include "integral_limits.h" #include "exception.h" #include "memory.h" -#include "exception.h" #include "binary.h" #include "flags.h" @@ -56,6 +54,10 @@ SOFTWARE. #include #endif +#if ETL_USING_STL + #include +#endif + #include "private/minmax_push.h" //***************************************************************************** @@ -243,7 +245,6 @@ namespace etl return max_size() - size(); } -#if ETL_HAS_STRING_TRUNCATION_CHECKS //************************************************************************* /// Returns whether the string was truncated by the last operation. /// Deprecated. Use is_truncated() @@ -252,7 +253,11 @@ namespace etl ETL_DEPRECATED bool truncated() const { +#if ETL_HAS_STRING_TRUNCATION_CHECKS return flags.test(); +#else + return false; +#endif } //************************************************************************* @@ -261,9 +266,14 @@ namespace etl //************************************************************************* bool is_truncated() const { +#if ETL_HAS_STRING_TRUNCATION_CHECKS return flags.test(); +#else + return false; +#endif } +#if ETL_HAS_STRING_TRUNCATION_CHECKS //************************************************************************* /// Clears the 'truncated' flag. //************************************************************************* @@ -281,15 +291,19 @@ namespace etl { flags.set(); } +#endif //************************************************************************* /// Gets the 'secure' state flag. //************************************************************************* bool is_secure() const { +#if ETL_HAS_STRING_CLEAR_AFTER_USE return flags.test(); - } +#else + return false; #endif + } protected: @@ -2964,6 +2978,23 @@ namespace etl { return !(lhs < rhs); } + + //*************************************************************************** + /// Operator overload to write to std basic_ostream + ///\param os Reference to the output stream. + ///\param str Reference to the string to write. + ///\return Reference to the output stream, for chaining write operations. + ///\ingroup string + //*************************************************************************** +#if ETL_USING_STL + template + std::basic_ostream > &operator<<(std::basic_ostream > &os, + const etl::ibasic_string& str) + { + os.write(str.data(), str.size()); + return os; + } +#endif } #include "private/minmax_pop.h" diff --git a/include/etl/bip_buffer_spsc_atomic.h b/include/etl/bip_buffer_spsc_atomic.h index f8c0eff15..14d03ca23 100644 --- a/include/etl/bip_buffer_spsc_atomic.h +++ b/include/etl/bip_buffer_spsc_atomic.h @@ -247,7 +247,7 @@ namespace etl else // read_index > write_index { // Doesn't fit - if ((write_index + *psize) >= read_index) + if (*psize >= read_index - write_index) { *psize = read_index - write_index - 1; } diff --git a/include/etl/bit_stream.h b/include/etl/bit_stream.h index 7c5b557ef..b4518a75c 100644 --- a/include/etl/bit_stream.h +++ b/include/etl/bit_stream.h @@ -236,8 +236,8 @@ namespace etl while (nbits != 0) { unsigned char mask_width = static_cast(etl::min(nbits, bits_available_in_char)); - - typedef typename etl::make_unsigned::type chunk_t; + + typedef typename etl::make_unsigned::type chunk_t; chunk_t chunk = get_chunk(mask_width); nbits -= mask_width; @@ -529,7 +529,7 @@ namespace etl typedef char value_type; typedef value_type* iterator; - typedef const value_type* const_iterator; + typedef const value_type* const_iterator; typedef etl::span callback_parameter_type; typedef etl::delegate callback_type; @@ -590,17 +590,19 @@ namespace etl { bits_available_in_char = CHAR_BIT; char_index = 0U; - bits_available = CHAR_BIT * length_chars; + bits_available = capacity_bits(); } //*************************************************************************** - /// Returns the maximum capacity in bits. + /// Returns the maximum capacity in bytes. //*************************************************************************** size_t capacity_bytes() const { return length_chars; } + //*************************************************************************** + /// Returns the maximum capacity in bits. //*************************************************************************** size_t capacity_bits() const { @@ -612,7 +614,7 @@ namespace etl //*************************************************************************** bool empty() const { - return (bits_available == length_chars); + return (available_bits() == capacity_bits()); } //*************************************************************************** @@ -620,7 +622,7 @@ namespace etl //*************************************************************************** bool full() const { - return (bits_available == 0U); + return (available_bits() == 0U); } //*************************************************************************** @@ -1082,7 +1084,7 @@ namespace etl //*************************************************************************** /// Construct from range. //*************************************************************************** - bit_stream_reader(void* begin_, void* end_, etl::endian stream_endianness_) + bit_stream_reader(const void* begin_, const void* end_, etl::endian stream_endianness_) : pdata(reinterpret_cast(begin_)) , length_chars(etl::distance(reinterpret_cast(begin_), reinterpret_cast(end_))) , stream_endianness(stream_endianness_) @@ -1093,7 +1095,7 @@ namespace etl //*************************************************************************** /// Construct from begin and length. //*************************************************************************** - bit_stream_reader(void* begin_, size_t length_, etl::endian stream_endianness_) + bit_stream_reader(const void* begin_, size_t length_, etl::endian stream_endianness_) : pdata(reinterpret_cast(begin_)) , length_chars(length_) , stream_endianness(stream_endianness_) diff --git a/include/etl/bitset.h b/include/etl/bitset.h index d827c762a..d267819a2 100644 --- a/include/etl/bitset.h +++ b/include/etl/bitset.h @@ -34,9 +34,9 @@ SOFTWARE. #include "platform.h" #if defined(ETL_USE_LEGACY_BITSET) - #include "private/bitset_legacy.h" + #include "private/bitset_legacy.h" // IWYU pragma: export #else - #include "private/bitset_new.h" + #include "private/bitset_new.h" // IWYU pragma: export #endif #endif diff --git a/include/etl/chrono.h b/include/etl/chrono.h new file mode 100644 index 000000000..533d9837a --- /dev/null +++ b/include/etl/chrono.h @@ -0,0 +1,100 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +https://www.etlcpp.com + +Copyright(c) 2023 John Wellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#ifndef ETL_CHRONO_INCLUDED +#define ETL_CHRONO_INCLUDED + +#define ETL_IN_CHRONO_H + +#include "platform.h" + +#if ETL_NOT_USING_CPP11 && !defined(ETL_IN_UNIT_TEST) + #error NOT SUPPORTED FOR C++03 OR BELOW +#endif + +#if ETL_USING_CPP11 + +#include "type_traits.h" +#include "integral_limits.h" +#include "string_view.h" +#include "hash.h" + +#include +#include + +namespace etl +{ + namespace chrono + { + template + struct treat_as_floating_point : etl::is_floating_point + { + }; + +#if ETL_USING_CPP17 + template + constexpr bool treat_as_floating_point_v = treat_as_floating_point::value; +#endif + } + + // Use the same type as defined in time.h. + using time_t = ::time_t; +} + +#include "private/chrono/last_spec.h" +#include "private/chrono/duration.h" +#include "private/chrono/time_point.h" +#include "private/chrono/clocks.h" +#include "private/chrono/day.h" +#include "private/chrono/weekday.h" +#include "private/chrono/month.h" +#include "private/chrono/month_day.h" +#include "private/chrono/month_weekday.h" +#include "private/chrono/year.h" +#include "private/chrono/year_month.h" +#include "private/chrono/year_month_day.h" +#include "private/chrono/year_month_weekday.h" +#include "private/chrono/hh_mm_ss.h" +#include "private/chrono/operators.h" +#include "private/chrono/time_zone.h" + +namespace etl +{ + namespace chrono + { + using namespace literals::chrono_literals; + } +} + +#endif + +#undef ETL_IN_CHRONO_H + +#endif diff --git a/include/etl/circular_buffer.h b/include/etl/circular_buffer.h index a6967d82b..336016125 100644 --- a/include/etl/circular_buffer.h +++ b/include/etl/circular_buffer.h @@ -990,8 +990,8 @@ namespace etl { if ETL_IF_CONSTEXPR(etl::is_trivially_destructible::value) { - in = 0U; - out = 0U; + in = 0U; + out = 0U; ETL_RESET_DEBUG_COUNT; } else @@ -1063,9 +1063,9 @@ namespace etl template static difference_type distance(const TIterator& other) { - const difference_type index = other.get_index(); - const difference_type reference_index = other.container().out; - const size_t buffer_size = other.container().buffer_size; + const difference_type index = other.get_index(); + const difference_type reference_index = static_cast(other.container().out); + const size_t buffer_size = other.container().buffer_size; if (index < reference_index) { @@ -1385,6 +1385,25 @@ namespace etl #endif } +#if ETL_USING_CPP11 + //************************************************************************* + /// Swap with another circular buffer + //************************************************************************* + void swap(circular_buffer_ext&& other) ETL_NOEXCEPT + { + using ETL_OR_STD::swap; // Allow ADL + + swap(this->in, other.in); + swap(this->out, other.out); + swap(this->pbuffer, other.pbuffer); + swap(this->buffer_size, other.buffer_size); + +#if defined(ETL_DEBUG_COUNT) + this->etl_debug_count.swap(other.etl_debug_count); +#endif + } +#endif + //************************************************************************* /// set_buffer //************************************************************************* @@ -1439,6 +1458,17 @@ namespace etl lhs.swap(rhs); } +#if ETL_USING_CPP11 + //************************************************************************* + /// Overloaded swap for etl::circular_buffer_ext + //************************************************************************* + template + void swap(etl::circular_buffer_ext& lhs, etl::circular_buffer_ext&& rhs) + { + lhs.swap(rhs); + } +#endif + //************************************************************************* /// Equality operator //************************************************************************* diff --git a/include/etl/cyclic_value.h b/include/etl/cyclic_value.h index 392c7a14e..ace57efa5 100644 --- a/include/etl/cyclic_value.h +++ b/include/etl/cyclic_value.h @@ -109,16 +109,7 @@ namespace etl //************************************************************************* void set(T value_) { - if (value_ > Last) - { - value_ = Last; - } - else if (value_ < First) - { - value_ = First; - } - - value = value_; + value = etl::clamp(value_, First, Last); } //************************************************************************* @@ -351,7 +342,7 @@ namespace etl cyclic_value(T first_, T last_) : value(first_) , first_value(first_) - , last_value(last_) + , last_value(last_) { } @@ -398,16 +389,7 @@ namespace etl //************************************************************************* void set(T value_) { - if (value_ > last_value) - { - value_ = last_value; - } - else if (value_ < first_value) - { - value_ = first_value; - } - - value = value_; + value = etl::clamp(value_, first_value, last_value); } //************************************************************************* diff --git a/include/etl/debug_count.h b/include/etl/debug_count.h index ebbfb13ef..9e15c21af 100644 --- a/include/etl/debug_count.h +++ b/include/etl/debug_count.h @@ -158,23 +158,16 @@ inline void swap(etl::debug_count& lhs, etl::debug_count& rhs) } #else - #define ETL_DECLARE_DEBUG_COUNT etl::debug_count etl_debug_count - #define ETL_SET_DEBUG_COUNT(n) ETL_DO_NOTHING - #define ETL_GET_DEBUG_COUNT ETL_DO_NOTHING - #define ETL_INCREMENT_DEBUG_COUNT ETL_DO_NOTHING - #define ETL_DECREMENT_DEBUG_COUNT ETL_DO_NOTHING - #define ETL_ADD_DEBUG_COUNT(n) ETL_DO_NOTHING - #define ETL_SUBTRACT_DEBUG_COUNT(n) ETL_DO_NOTHING - #define ETL_RESET_DEBUG_COUNT ETL_DO_NOTHING - #define ETL_OBJECT_RESET_DEBUG_COUNT(object) ETL_DO_NOTHING - #define ETL_OBJECT_GET_DEBUG_COUNT(object) ETL_DO_NOTHING - -namespace etl -{ - class debug_count - { - }; -} + #define ETL_DECLARE_DEBUG_COUNT + #define ETL_SET_DEBUG_COUNT(n) + #define ETL_GET_DEBUG_COUNT + #define ETL_INCREMENT_DEBUG_COUNT + #define ETL_DECREMENT_DEBUG_COUNT + #define ETL_ADD_DEBUG_COUNT(n) + #define ETL_SUBTRACT_DEBUG_COUNT(n) + #define ETL_RESET_DEBUG_COUNT + #define ETL_OBJECT_RESET_DEBUG_COUNT(object) + #define ETL_OBJECT_GET_DEBUG_COUNT(object) #endif // ETL_DEBUG_COUNT #endif diff --git a/include/etl/delegate.h b/include/etl/delegate.h index d03119279..76b7e1691 100644 --- a/include/etl/delegate.h +++ b/include/etl/delegate.h @@ -34,9 +34,9 @@ SOFTWARE. #include "platform.h" #if ETL_USING_CPP11 && !defined(ETL_DELEGATE_FORCE_CPP03_IMPLEMENTATION) - #include "private/delegate_cpp11.h" + #include "private/delegate_cpp11.h" // IWYU pragma: export #else - #include "private/delegate_cpp03.h" + #include "private/delegate_cpp03.h" // IWYU pragma: export #endif #endif diff --git a/include/etl/error_handler.h b/include/etl/error_handler.h index f0c60be6d..ca417ae72 100644 --- a/include/etl/error_handler.h +++ b/include/etl/error_handler.h @@ -282,7 +282,7 @@ namespace etl /// Sets the assert function. /// The argument function signature is void(*)(const etl::exception&) //*************************************************************************** - void set_assert_function(etl::private_error_handler::assert_function_ptr_t afptr) + inline void set_assert_function(etl::private_error_handler::assert_function_ptr_t afptr) { etl::private_error_handler::assert_handler<0>::assert_function_ptr = afptr; } diff --git a/include/etl/expected.h b/include/etl/expected.h index 3f1abd999..fd68ac858 100644 --- a/include/etl/expected.h +++ b/include/etl/expected.h @@ -188,7 +188,7 @@ namespace etl //******************************************* /// Get the error. - //******************************************* + //******************************************* ETL_CONSTEXPR14 TError&& error() const&& ETL_NOEXCEPT { return etl::move(error_value); @@ -500,7 +500,7 @@ namespace etl //******************************************* /// Get the value. //******************************************* - value_type& value() const + const value_type& value() const { return etl::get(storage); } @@ -660,7 +660,7 @@ namespace etl //******************************************* /// //******************************************* - error_type& error() const + const error_type& error() const { return etl::get(storage); } @@ -932,7 +932,7 @@ namespace etl /// Returns the error /// Undefined behaviour if an error has not been set. //******************************************* - error_type& error() const + const error_type& error() const { return etl::get(storage); } @@ -1107,4 +1107,3 @@ void swap(etl::unexpected& lhs, etl::unexpected& rhs) } #endif - diff --git a/include/etl/file_error_numbers.h b/include/etl/file_error_numbers.h index 64d94d573..884dc1688 100644 --- a/include/etl/file_error_numbers.h +++ b/include/etl/file_error_numbers.h @@ -105,4 +105,7 @@ SOFTWARE. #define ETL_BASE64_FILE_ID "72" #define ETL_SINGLETON_BASE_FILE_ID "73" #define ETL_UNALIGNED_TYPE_FILE_ID "74" +#define ETL_SPAN_FILE_ID "75" +#define ETL_ALGORITHM_FILE_ID "76" +#define ETL_INPLACE_FUNCTION_FILE_ID "77" #endif diff --git a/include/etl/functional.h b/include/etl/functional.h index d762506c1..7fb3e4153 100644 --- a/include/etl/functional.h +++ b/include/etl/functional.h @@ -112,6 +112,39 @@ namespace etl return reference_wrapper(t.get()); } + //*************************************************************************** + /// unwrap_reference. + //*************************************************************************** + template + struct unwrap_reference + { + typedef T type; + }; + + template + struct unwrap_reference > + { + typedef T& type; + }; + +#if ETL_USING_CPP11 + template + using unwrap_reference_t = typename unwrap_reference::type; +#endif + + //*************************************************************************** + /// unwrap_ref_decay. + //*************************************************************************** + template + struct unwrap_ref_decay : etl::unwrap_reference::type> {}; + +#if ETL_USING_CPP11 + template + using unwrap_ref_decay_t = typename unwrap_ref_decay::type; +#endif + + //*************************************************************************** + /// unary_function //*************************************************************************** template struct unary_function @@ -120,6 +153,8 @@ namespace etl typedef TResultType result_type; }; + //*************************************************************************** + /// binary_function //*************************************************************************** template struct binary_function diff --git a/include/etl/gcd.h b/include/etl/gcd.h index aea495e53..77df935c7 100644 --- a/include/etl/gcd.h +++ b/include/etl/gcd.h @@ -37,6 +37,22 @@ SOFTWARE. namespace etl { + //*************************************************************************** + // Greatest Common Divisor. + // Compile time. + //*************************************************************************** + template + struct gcd_const + { + static ETL_CONSTANT intmax_t value = gcd_const::value; + }; + + template + struct gcd_const + { + static ETL_CONSTANT intmax_t value = A; + }; + //*************************************************************************** // Greatest Common Divisor. // For unsigned types. diff --git a/include/etl/generators/largest_generator.h b/include/etl/generators/largest_generator.h index a8cb40837..20288b273 100644 --- a/include/etl/generators/largest_generator.h +++ b/include/etl/generators/largest_generator.h @@ -379,7 +379,7 @@ namespace etl ///\ingroup largest //*************************************************************************** template - struct largest + struct largest { using type = typename etl::largest_type::type; diff --git a/include/etl/generators/type_traits_generator.h b/include/etl/generators/type_traits_generator.h index e55d12217..5a1aadcc5 100644 --- a/include/etl/generators/type_traits_generator.h +++ b/include/etl/generators/type_traits_generator.h @@ -639,8 +639,8 @@ namespace etl struct is_base_of { private: - static TBase* check(TBase*) { return (TBase*)0; } + static TBase* check(TBase*) { return (TBase*)0; } static char check(...) { return 0; } public: @@ -725,7 +725,8 @@ namespace etl { // Base case template - struct is_convertible_to_int : false_type + struct is_convertible_to_int + : false_type { }; @@ -733,7 +734,7 @@ namespace etl // 2nd template argument of base case defaults to int to ensure that this partial specialization is always tried first template struct is_convertible_to_int(declval()))> - : true_type + : true_type { }; } @@ -751,7 +752,29 @@ namespace etl template inline constexpr bool is_enum_v = etl::is_enum::value; #endif +#else + namespace private_type_traits + { + // Helper to detect if a type is convertible to an integer + template + struct is_convertible_to_int + { + static char test(int); // Match if T is convertible to int + static double test(...); // Fallback for other types + static const bool value = sizeof(test(static_cast(0))) == sizeof(char); + }; + } + + // Implementation of is_enum + template + struct is_enum + { + static const bool value = private_type_traits::is_convertible_to_int::value && + !is_class::value && + !is_arithmetic::value && + !is_reference::value; + }; #endif //*************************************************************************** @@ -1334,6 +1357,79 @@ typedef integral_constant true_type; // ETL extended type traits. //*************************************************************************** +#if ETL_USING_CPP11 + //*************************************************************************** + /// conjunction +#if ETL_USING_CPP11 + template + struct conjunction : public etl::true_type + { + }; + + template + struct conjunction : public etl::conditional_t, T1> + { + }; + + template + struct conjunction : public T + { + }; +#endif + +#if ETL_USING_CPP17 + template + inline constexpr bool conjunction_v = conjunction::value; +#endif + + //*************************************************************************** + /// disjunction +#if ETL_USING_CPP11 + template + struct disjunction : public etl::false_type + { + }; + + template + struct disjunction : public etl::conditional_t> + { + }; + + template struct disjunction : public T1 + { + }; +#endif + +#if ETL_USING_CPP17 + template + inline constexpr bool disjunction_v = etl::disjunction::value; +#endif + +#endif + + //*************************************************************************** + /// exclusive_disjunction +#if ETL_USING_CPP11 + template + struct exclusive_disjunction; + + template + struct exclusive_disjunction : public etl::bool_constant + { + }; + + // Recursive case: XOR the first two values and recurse + template + struct exclusive_disjunction : public etl::exclusive_disjunction::value && !etl::conjunction::value>, TRest...> + { + }; +#endif + +#if ETL_USING_CPP17 + template + inline constexpr bool exclusive_disjunction_v = etl::exclusive_disjunction::value; +#endif + //*************************************************************************** /// conditional_integral_constant // /\ingroup type_traits @@ -1356,19 +1452,11 @@ typedef integral_constant true_type; #if ETL_USING_CPP11 //*************************************************************************** - /// Template to determine if a type is one of a specified list. + /// Template to determine if a type is a base of all types in a specified list. ///\ingroup types - template - struct is_one_of - { - static const bool value = etl::is_same::value || - etl::is_one_of::value; - }; - - template - struct is_one_of + template + struct is_one_of : etl::disjunction...> { - static const bool value = etl::is_same::value; }; #else /*[[[cog @@ -1402,20 +1490,45 @@ typedef integral_constant true_type; #endif #if ETL_USING_CPP11 - //*************************************************************************** - /// Template to determine if a type is a base of all types in a specified list. - ///\ingroup types - template - struct is_base_of_all + namespace private_type_traits + { + //*************************************************************************** + // Helper to count occurrences of a type in a list of types + template + struct count_type; + + // Base case: zero occurrences + template + struct count_type : etl::integral_constant + { + }; + + // Recursive case: increment count if head is the same as T, otherwise continue with tail + template + struct count_type : etl::integral_constant::value ? 1 : 0) + count_type::value> + { + }; + } + + template + struct has_duplicates_of + : etl::integral_constant::value > 1)> { - static const bool value = etl::is_base_of::value && - etl::is_base_of_all::value; }; +#endif + +#if ETL_USING_CPP17 + template + inline constexpr bool has_duplicates_of_v = etl::has_duplicates_of::value; +#endif - template - struct is_base_of_all +#if ETL_USING_CPP11 + //*************************************************************************** + /// Template to determine if a type is a base of all types in a specified list. + ///\ingroup types + template + struct is_base_of_all : etl::conjunction...> { - static const bool value = etl::is_base_of::value; }; #endif @@ -1428,18 +1541,11 @@ typedef integral_constant true_type; //*************************************************************************** /// Template to determine if a type is a base of any type in a specified list. ///\ingroup types - template - struct is_base_of_any + template + struct is_base_of_any : etl::disjunction...> { - static const bool value = etl::is_base_of::value || - etl::is_base_of_any::value; }; - template - struct is_base_of_any - { - static const bool value = etl::is_base_of::value; - }; #endif #if ETL_USING_CPP17 @@ -1447,6 +1553,28 @@ typedef integral_constant true_type; inline constexpr bool is_base_of_any_v = etl::is_base_of_any::value; #endif + //*************************************************************************** + /// Get the Nth base of a recursively inherited type. + /// Requires that the class has defined 'base_type'. + //*************************************************************************** + // Recursive definition of the type. + template + struct nth_base + { + typedef typename nth_base::type type; + }; + + template + struct nth_base<0, TType> + { + typedef TType type; + }; + +#if ETL_USING_CPP11 + template + using nth_base_t = typename nth_base::type; +#endif + //*************************************************************************** /// A set of templates to allow related types to be derived. ///\ingroup types @@ -1600,70 +1728,15 @@ typedef integral_constant true_type; #if ETL_USING_CPP11 //*************************************************************************** /// are_all_same - template - struct are_all_same - { - static const bool value = etl::is_same::value && - etl::are_all_same::value; - }; - - template - struct are_all_same - { - static const bool value = etl::is_same::value; - }; -#endif - -#if ETL_USING_CPP17 - template - inline constexpr bool are_all_same_v = are_all_same::value; -#endif - - //*************************************************************************** - /// conjunction -#if ETL_USING_CPP11 - template - struct conjunction : public etl::true_type - { - }; - - template - struct conjunction : public etl::conditional_t, T1> - { - }; - - template - struct conjunction : public T - { - }; -#endif - -#if ETL_USING_CPP17 - template - inline constexpr bool conjunction_v = conjunction::value; -#endif - - //*************************************************************************** - /// disjunction -#if ETL_USING_CPP11 - template - struct disjunction : public etl::false_type - { - }; - - template - struct disjunction : public etl::conditional_t> - { - }; - - template struct disjunction : public T1 + template + struct are_all_same : etl::conjunction...> { }; #endif #if ETL_USING_CPP17 - template - inline constexpr bool disjunction_v = etl::disjunction::value; + template + inline constexpr bool are_all_same_v = are_all_same::value; #endif //*************************************************************************** @@ -2207,7 +2280,8 @@ typedef integral_constant true_type; }; template - struct common_type_2_impl : decay_conditional_result + struct common_type_2_impl + : decay_conditional_result { }; @@ -2302,6 +2376,42 @@ typedef integral_constant true_type; using type_identity_t = typename type_identity::type; #endif + //********************************************* + // underlying_type +#if ETL_USING_BUILTIN_UNDERLYING_TYPE + // Primary template for etl::underlying_type + template ::value> + struct underlying_type; + + // Specialization for non-enum types (invalid case) + template + struct underlying_type + { + // Static assertion to ensure this is only used with enums + ETL_STATIC_ASSERT(etl::is_enum::value, "etl::underlying_type can only be used with enumeration types."); + }; + + template + struct underlying_type + { + typedef __underlying_type(T) type; + }; +#else + /// Primary template for etl::underlying_type + /// Users must spelialise this template for their enumerations. + template + struct underlying_type + { + ETL_STATIC_ASSERT(false, "No user defined specialisation of etl::underlying_type for this type"); + typedef char type; + }; +#endif + +#if ETL_USING_CPP11 + template + using underlying_type_t = typename underlying_type::type; +#endif + #if ETL_USING_CPP11 //********************************************* // has_duplicates @@ -2347,14 +2457,17 @@ typedef integral_constant true_type; #if ETL_USING_CPP11 //********************************************* - // has_duplicates_of - template - struct has_duplicates_of : etl::bool_constant<(etl::count_of::value > 1U)> {}; + /// is_specialization + template class Template> + struct is_specialization : etl::false_type {}; + + template