Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang formatting changes #731

Merged
merged 8 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions .github/workflows/clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ permissions:

jobs:
check-formatting:
runs-on: windows-latest

name: Formatting Check
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit

- name: clang-format (w/ diff)
uses: egor-tensin/clang-format@5ee263e007725df60d02ef2e6fd3d0dd92f048a0 # v1.0.1
with:
# :-separated list of excluded files and directories
exclude: include:mapistub
- uses: actions/checkout@v4
- name: Run clang-format style check for C/C++ programs.
uses: jidicula/[email protected]
with:
clang-format-version: '17'
exclude-regex: 'mapistub/*'
fallback-style: 'Microsoft'
2 changes: 1 addition & 1 deletion StdAfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
// A bug in annotations in shobjidl.h forces us to disable 6387 to include afxwin.h
#pragma warning(push)
#pragma warning( \
disable : 6387) // Warning C6387 'argument' may be 'value': this does not adhere to the specification for the function 'function name': Lines: x, y
disable : 6387) // Warning C6387 'argument' may be 'value': this does not adhere to the specification for the function 'function name': Lines: x, y
#include <afxwin.h> // MFC core and standard components
#pragma warning(pop)
#include <afxcmn.h> // MFC support for Windows Common Controls
Expand Down
2 changes: 1 addition & 1 deletion UI/Controls/SortList/ContentsTableListCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace controls::sortlistctrl
BEGIN_MESSAGE_MAP(CContentsTableListCtrl, CSortListCtrl)
#pragma warning(push)
#pragma warning( \
disable : 26454) // Warning C26454 Arithmetic overflow: 'operator' operation produces a negative unsigned result at compile time
disable : 26454) // Warning C26454 Arithmetic overflow: 'operator' operation produces a negative unsigned result at compile time
ON_NOTIFY_REFLECT(LVN_ITEMCHANGED, OnItemChanged)
#pragma warning(pop)
ON_WM_KEYDOWN()
Expand Down
2 changes: 1 addition & 1 deletion UI/Controls/SortList/SingleMAPIPropListCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace controls::sortlistctrl
BEGIN_MESSAGE_MAP(CSingleMAPIPropListCtrl, CSortListCtrl)
#pragma warning(push)
#pragma warning( \
disable : 26454) // Warning C26454 Arithmetic overflow: 'operator' operation produces a negative unsigned result at compile time
disable : 26454) // Warning C26454 Arithmetic overflow: 'operator' operation produces a negative unsigned result at compile time
ON_NOTIFY_REFLECT(NM_DBLCLK, OnDblclk)
#pragma warning(pop)
ON_WM_KEYDOWN()
Expand Down
2 changes: 1 addition & 1 deletion UI/Controls/SortList/SortHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace controls::sortlistctrl
ON_MESSAGE(WM_MFCMAPI_SAVECOLUMNORDERHEADER, msgOnSaveColumnOrder)
#pragma warning(push)
#pragma warning( \
disable : 26454) // Warning C26454 Arithmetic overflow: 'operator' operation produces a negative unsigned result at compile time
disable : 26454) // Warning C26454 Arithmetic overflow: 'operator' operation produces a negative unsigned result at compile time
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw)
#pragma warning(pop)
END_MESSAGE_MAP()
Expand Down
2 changes: 1 addition & 1 deletion UI/Controls/SortList/SortListCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace controls::sortlistctrl
ON_WM_DRAWITEM()
#pragma warning(push)
#pragma warning( \
disable : 26454) // Warning C26454 Arithmetic overflow: 'operator' operation produces a negative unsigned result at compile time
disable : 26454) // Warning C26454 Arithmetic overflow: 'operator' operation produces a negative unsigned result at compile time
ON_NOTIFY_REFLECT(LVN_DELETEALLITEMS, OnDeleteAllItems)
ON_NOTIFY_REFLECT(LVN_DELETEITEM, OnDeleteItem)
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw)
Expand Down
2 changes: 1 addition & 1 deletion UI/Controls/StyleTree/StyleTreeCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace controls
BEGIN_MESSAGE_MAP(StyleTreeCtrl, CTreeCtrl)
#pragma warning(push)
#pragma warning( \
disable : 26454) // Warning C26454 Arithmetic overflow: 'operator' operation produces a negative unsigned result at compile time
disable : 26454) // Warning C26454 Arithmetic overflow: 'operator' operation produces a negative unsigned result at compile time
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw)
ON_NOTIFY_REFLECT(NM_RCLICK, OnRightClick)
ON_NOTIFY_REFLECT(TVN_GETDISPINFO, OnGetDispInfo)
Expand Down
4 changes: 2 additions & 2 deletions core/mapi/mapiFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ namespace file
LPITNEF lpTNEF = nullptr;
#pragma warning(push)
#pragma warning( \
disable : 28159) // Warning C28159 Consider using *function_name_1* instead of *function_name_2*. Reason: reason
disable : 28159) // Warning C28159 Consider using *function_name_1* instead of *function_name_2*. Reason: reason
//GetTickCount is OK for what we're doing
static auto wKeyVal = static_cast<WORD>(GetTickCount() + 1);
#pragma warning(pop)
Expand Down Expand Up @@ -583,7 +583,7 @@ namespace file

#pragma warning(push)
#pragma warning( \
disable : 28159) // Warning C28159 Consider using *function_name_1* instead of *function_name_2*. Reason: reason
disable : 28159) // Warning C28159 Consider using *function_name_1* instead of *function_name_2*. Reason: reason
//GetTickCount is OK for what we're doing
static auto wKeyVal = static_cast<WORD>(GetTickCount() + 1);
#pragma warning(pop)
Expand Down
2 changes: 1 addition & 1 deletion core/mapi/mapiFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ namespace mapi

#pragma warning(push)
#pragma warning( \
disable : 26476) // Warning C26476 Expression/symbol '' uses a naked union '' with multiple type pointers: Use variant instead (type.7).
disable : 26476) // Warning C26476 Expression/symbol '' uses a naked union '' with multiple type pointers: Use variant instead (type.7).
inline const SBinary& getBin(_In_ const _SPropValue* prop) noexcept
{
if (!prop) assert(false);
Expand Down
2 changes: 1 addition & 1 deletion mapistub
10 changes: 6 additions & 4 deletions scripts/clang.ps1
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
$vsRoot = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath
$vcInstallDir = Join-Path $vsRoot "VC"
$clangdir = Join-Path $vcInstallDir "Tools\Llvm\bin\clang-format.exe"
$clang = Join-Path $vcInstallDir "Tools\Llvm\bin\clang-format.exe"

# Check if VC install directory was found
if ($null -eq $vcInstallDir) {
Write-Host "Visual C++ installation directory not found."
}

if ($null -eq $clangdir) {
if ($null -eq $clang) {
Write-Host "clang not found."
}
Write-Host "clang-format found at $clang"
& $clang --version

Push-Location ..

Write-Host "Formatting C++ headers"
Get-ChildItem -Recurse -Filter *.h | Where-Object { $_.DirectoryName -notlike "*include*" } | ForEach-Object {
& $clangdir -i $_.FullName
& $clang -i $_.FullName
}

Write-Host "Formatting C++ sources"
Get-ChildItem -Recurse -Filter *.cpp | ForEach-Object {
& $clangdir -i $_.FullName
& $clang -i $_.FullName
}

Pop-Location