Skip to content

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

Closed
esyr wants to merge 10 commits into
openssl:openssl-3.3from
esyr:esyr/clang-format-updates-3.3
Closed

esyr wants to merge 10 commits into
openssl:openssl-3.3from
esyr:esyr/clang-format-updates-3.3

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.3 Applies to openssl-3.3 (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
@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

@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 61 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 previously approved these changes Mar 31, 2026
@t8m
t8m requested a review from a team March 31, 2026 18:35
@esyr
esyr force-pushed the esyr/clang-format-updates-3.3 branch from 4898ca3 to 32fe4ad Compare April 1, 2026 08:37
bob-beck and others added 10 commits April 1, 2026 10:57
This one is pretty special, we should ponder simplifying some of
the clever preprocessor stuff here, but for now..

Original-PR: openssl#29359
Original-Commit: ba4970a "Add static_ASN1_SEQUENCE_END to the list of statment macros"
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.
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".
util/mkerr.pl produced lines like these:

    {ERR_PACK(ERR_LIB_EVP, 0, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE),
    "operation not supported for this keytype"},

According to our coding style, they should look like this:

    {ERR_PACK(ERR_LIB_EVP, 0, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE),
     "operation not supported for this keytype"},

This nit was correctly picked up by util/check-format.pl

Original-PR: openssl#24902
Original-Commit: 772481c "fix: Have util/mkerr.pl comply better with our coding style"
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.3 branch from 32fe4ad to 90e8ca1 Compare April 1, 2026 08:59
@esyr esyr moved this to Waiting Review in Development Board Apr 1, 2026
@openssl-machine openssl-machine added the approval: done This pull request has the required number of approvals label Apr 2, 2026
@openssl-machine openssl-machine removed the approval: review pending This pull request needs review by a committer label 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.3 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
This one is pretty special, we should ponder simplifying some of
the clever preprocessor stuff here, but for now..

Original-PR: #29359
Original-Commit: ba4970a "Add static_ASN1_SEQUENCE_END to the list of statment macros"

Reviewed-by: Nikola Pajkovsky <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Fri Apr  3 14:51:53 2026
(Merged from #29824)
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:51:54 2026
(Merged from #29824)
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:51:56 2026
(Merged from #29824)
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:51:57 2026
(Merged from #29824)
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:51:58 2026
(Merged from #29824)
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:52:00 2026
(Merged from #29824)
openssl-machine pushed a commit that referenced this pull request Apr 3, 2026
util/mkerr.pl produced lines like these:

    {ERR_PACK(ERR_LIB_EVP, 0, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE),
    "operation not supported for this keytype"},

According to our coding style, they should look like this:

    {ERR_PACK(ERR_LIB_EVP, 0, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE),
     "operation not supported for this keytype"},

This nit was correctly picked up by util/check-format.pl

Original-PR: #24902
Original-Commit: 772481c "fix: Have util/mkerr.pl comply better with our coding style"

Reviewed-by: Nikola Pajkovsky <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
MergeDate: Fri Apr  3 14:52:01 2026
(Merged from #29824)
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:52:02 2026
(Merged from #29824)
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:52:03 2026
(Merged from #29824)
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:52:06 2026
(Merged from #29824)
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.3 Applies to openssl-3.3 (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.

7 participants