Skip to content

[3.6] Sync up .clang-format with master, re-format the files again - #29821

Closed
esyr wants to merge 8 commits into
openssl:openssl-3.6from
esyr:esyr/clang-format-updates-3.6
Closed

esyr wants to merge 8 commits into
openssl:openssl-3.6from
esyr:esyr/clang-format-updates-3.6

Conversation

@esyr

@esyr esyr commented Jan 28, 2026

Copy link
Copy Markdown
Member

As revealed during the release process, not every file conforms to the current .clang-format configuration, which is combination of different configurations in different branches and some files not being re-formatted during commits. Try to address both of these issues.

@esyr esyr added approval: review pending This pull request needs review by a committer triaged: cleanup The issue/pr deals with cleanup of comments/docs not altering code significantly branch: 3.6 Applies to openssl-3.6 (EOL) labels Jan 28, 2026
@github-actions github-actions Bot added the severity: fips change The pull request changes FIPS provider sources label Jan 28, 2026
@slontis

slontis commented Jan 29, 2026

Copy link
Copy Markdown
Member

If we are using clang format in all branches do you need PR #29599 and PR #29631 also?
(In #29599 just the .pre-commit-config.yaml bit is needed)

@esyr

esyr commented Jan 29, 2026

Copy link
Copy Markdown
Member Author

Good catch, let me include these.

@openssl-machine

Copy link
Copy Markdown
Collaborator

This PR is in a state where it requires action by @openssl/committers but the last update was 30 days ago

@t8m t8m added triaged: bug The issue/pr is/fixes a bug tests: exempted The PR is exempt from requirements for testing labels Mar 31, 2026
@t8m

t8m commented Mar 31, 2026

Copy link
Copy Markdown
Member

@esyr Is comment from @slontis above still relevant?

It is cherry-picked from commit 1afb05b "Add serialization for SHA-2
digest contexts" to ensure that .clang-format configuration are in sync
between branches.
@esyr
esyr force-pushed the esyr/clang-format-updates-3.6 branch from 3a850ca to 0eb5b72 Compare April 1, 2026 08:23
@esyr

esyr commented Apr 1, 2026

Copy link
Copy Markdown
Member Author

@esyr Is comment from @slontis above still relevant?

Yes, updated.

levitte and others added 7 commits April 1, 2026 11:04
This resulted in an adjustment of reformatting that is a bit less trippy
in some places.

Original-PR: openssl#29383
Original-Commit: 821b265 "Add a few more ASN.1 related StatementMacros"
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

Original-PR: openssl#29383
Original-Commit: aa9defa "Dump all known typedefs into .clang-format"
Original-PR: openssl#29383
Original-Commit: 16fa01b "Add a couple of DH related StatementMacros, and adjust"
Cherry-picked from commits d4c1efc "Remove dead EVP_aes_*() code"
and 32eaa74 "Cleanup block cipher macros in include/crypto/evp.h".
Anytime a new error code is added it generates error related files.
These are generated using a perl script which used readable indenting.
The indenting has been removed.

Original-PR: openssl#29631
Original-Commit: 8424f565dcbb "Make OpenSSL generated error files use the current clang-format."
…bjects.

Original-PR: openssl#29599
Original-Commit: a62d247 "Add clang-format file exclusions for generated files related to OBJ"
Original-Merge-Date: Tue Jan 13 10:13:37 2026
Ensure that all the source files are formatted with the current
.clang-format configuration, to avoid spurious clang-format checker
errors when arbitrary files are touched.

Signed-off-by: Eugene Syromiatnikov <[email protected]>
@esyr
esyr force-pushed the esyr/clang-format-updates-3.6 branch from 0eb5b72 to 39a0940 Compare April 1, 2026 09:05
@esyr esyr moved this to Waiting Review in Development Board Apr 1, 2026
@openssl-machine openssl-machine added approval: done This pull request has the required number of approvals and removed approval: review pending This pull request needs review by a committer labels Apr 2, 2026
@github-project-automation github-project-automation Bot moved this from Waiting Review to Waiting Merge in Development Board Apr 2, 2026
@openssl-machine openssl-machine added approval: ready to merge The 24 hour grace period has passed, ready to merge and removed approval: done This pull request has the required number of approvals labels Apr 3, 2026
@openssl-machine

Copy link
Copy Markdown
Collaborator

This pull request is ready to merge

@t8m

t8m commented Apr 3, 2026

Copy link
Copy Markdown
Member

Merged to the 3.6 branch. Thank you.

@t8m t8m closed this Apr 3, 2026
@github-project-automation github-project-automation Bot moved this from Waiting Merge to Done in Development Board Apr 3, 2026
openssl-machine pushed a commit that referenced this pull request Apr 3, 2026
It is cherry-picked from commit 1afb05b "Add serialization for SHA-2
digest contexts" to ensure that .clang-format configuration are in sync
between branches.

Reviewed-by: Nikola Pajkovsky <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Fri Apr  3 14:47:50 2026
(Merged from #29821)
openssl-machine pushed a commit that referenced this pull request Apr 3, 2026
This resulted in an adjustment of reformatting that is a bit less trippy
in some places.

Original-PR: #29383
Original-Commit: 821b265 "Add a few more ASN.1 related StatementMacros"

Reviewed-by: Nikola Pajkovsky <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Fri Apr  3 14:47:51 2026
(Merged from #29821)
openssl-machine pushed a commit that referenced this pull request Apr 3, 2026
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

Original-PR: #29383
Original-Commit: aa9defa "Dump all known typedefs into .clang-format"

Reviewed-by: Nikola Pajkovsky <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Fri Apr  3 14:47:52 2026
(Merged from #29821)
openssl-machine pushed a commit that referenced this pull request Apr 3, 2026
Original-PR: #29383
Original-Commit: 16fa01b "Add a couple of DH related StatementMacros, and adjust"

Reviewed-by: Nikola Pajkovsky <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Fri Apr  3 14:47:53 2026
(Merged from #29821)
openssl-machine pushed a commit that referenced this pull request Apr 3, 2026
Cherry-picked from commits d4c1efc "Remove dead EVP_aes_*() code"
and 32eaa74 "Cleanup block cipher macros in include/crypto/evp.h".

Reviewed-by: Nikola Pajkovsky <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Fri Apr  3 14:47:54 2026
(Merged from #29821)
openssl-machine pushed a commit that referenced this pull request Apr 3, 2026
Anytime a new error code is added it generates error related files.
These are generated using a perl script which used readable indenting.
The indenting has been removed.

Original-PR: #29631
Original-Commit: 8424f565dcbb "Make OpenSSL generated error files use the current clang-format."

Reviewed-by: Nikola Pajkovsky <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Fri Apr  3 14:47:55 2026
(Merged from #29821)
openssl-machine pushed a commit that referenced this pull request Apr 3, 2026
…bjects.

Original-PR: #29599
Original-Commit: a62d247 "Add clang-format file exclusions for generated files related to OBJ"
Original-Merge-Date: Tue Jan 13 10:13:37 2026

Reviewed-by: Nikola Pajkovsky <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Fri Apr  3 14:47:56 2026
(Merged from #29821)
openssl-machine pushed a commit that referenced this pull request Apr 3, 2026
Ensure that all the source files are formatted with the current
.clang-format configuration, to avoid spurious clang-format checker
errors when arbitrary files are touched.

Signed-off-by: Eugene Syromiatnikov <[email protected]>

Reviewed-by: Nikola Pajkovsky <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Fri Apr  3 14:47:57 2026
(Merged from #29821)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval: ready to merge The 24 hour grace period has passed, ready to merge branch: 3.6 Applies to openssl-3.6 (EOL) severity: fips change The pull request changes FIPS provider sources tests: exempted The PR is exempt from requirements for testing triaged: bug The issue/pr is/fixes a bug triaged: cleanup The issue/pr deals with cleanup of comments/docs not altering code significantly

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants