]> git.ipfire.org Git - thirdparty/openssl.git/commit
Dump all known typedefs into .clang-format
authorRichard Levitte <levitte@openssl.org>
Fri, 12 Dec 2025 15:11:06 +0000 (16:11 +0100)
committerNeil Horman <nhorman@openssl.org>
Wed, 17 Dec 2025 15:19:43 +0000 (10:19 -0500)
commitaa9defaa1fc4247ce8988606a8dca171fe717760
tree381a2bf04a627dbf00e223460461bb68538de7ca
parenta999136e01215faabf19119ba75ccf89037d36e7
Dump all known typedefs into .clang-format

This was done by calling a script I made on the spot:

    bash add-types-to-clang-format > .clang-format.new && mv .clang-format.new .clang-format

This is what that script looked like:

    #! /bin/bash

    sed -ne '1,/^CommentPragmas:/p' < .clang-format

    cat <<_____
    # OpenSSL uses typedefs extensively. Tell clang-format about them.
    TypeNames:
    _____

    include_re=$(yq -r '.repos.[].hooks.[] | select(.id == "clang-format") | .files' < .pre-commit-config.yaml)
    include_dirs=( apps crypto include providers ssl )
    git ls-files "${include_dirs[@]}" \
        | grep -E $include_re \
        | xargs ctags -f - \
        | awk -F "\t" -- '$2 ~ /\.h/ && $4 == "t" { printf "  - \"%s\"\n", $1 }' \
        | sort \
        | uniq

    cat <<_____
      # The following types are macros, and need to remain that way, unfortunately
      - "HASH_CTX"
      - "HASH_LONG"
      - "MD32_REG_T"
    _____

    sed -ne '/^# OpenSSL uses macros extensively/,$p' < .clang-format

Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29383)
.clang-format