Skip to content

Commit

Permalink
feat: initial changes for clang-tidy recommendations, clang-format, a…
Browse files Browse the repository at this point in the history
…nd use of safe_ functions

A lot of initial changes to implement a clang-format and clang-tidy files and the recommended changes to reduce possibility of bugs and improve memory safety.

Signed-off-by: Tyler Erickson <[email protected]>
  • Loading branch information
vonericsen committed Nov 8, 2024
1 parent 607e985 commit 2805734
Show file tree
Hide file tree
Showing 45 changed files with 12,524 additions and 9,229 deletions.
20 changes: 20 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use the Microsoft coding style
# This is the style our code already mostly followed-TJE
BasedOnStyle: Microsoft

# Additional Customizations
PointerAlignment: Left
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignTrailingComments: true
AlignConsecutiveMacros: true
AlignAfterOpenBracket: true
BinPackParameters: false
AllowAllParametersOfDeclarationOnNextLine: false
AlignConsecutiveMacros: 'AcrossEmptyLines'
BraceWrapping:
AfterControlStatement: true
AllowShortBlocksOnASingleLine: Never
AllowShortIfStatementsOnASingleLine: Never
IndentPPDirectives: AfterHash
BreakBeforeBraces: Allman
10 changes: 10 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Checks: '-*,modernize-*,cert-*,bugprone-*,-bugprone-easily-swappable-parameters'
#other available checks: clang-analyzer-*, performance-*, readability-*, misc-*
#Disabled checks:
# -bugprone-easily-swappable-parameters - warns a LOT. Sometimes on functions meant to look like standardized C11 annex k functions
# While a overall useful thing to consider, it's too noisy right now and it may make the API
# harder to use to resolve all of these.
WarningsAsErrors: ''
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
FormatStyle: 'file'
40 changes: 26 additions & 14 deletions docs/man/man8/openSeaChest_Basics.8
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH OPENSEACHEST_BASICS "1" "August 2024" "openSeaChest_Basics ==========================================================================================" "User Commands"
.TH OPENSEACHEST_BASICS "1" "October 2024" "openSeaChest_Basics ==========================================================================================" "User Commands"
.SH NAME
openSeaChest_Basics \- manual page for openSeaChest_Basics ==========================================================================================
.SH DESCRIPTION
==========================================================================================
.IP
openSeaChest_Basics \- openSeaChest drive utilities \- NVMe Enabled
Copyright (c) 2014\-2024 Seagate Technology LLC and/or its Affiliates, All Rights Reserved
openSeaChest_Basics Version: 3.6.2\-8_0_0 X86_64
Build Date: Aug 26 2024
Today: 20240828T143604 User: current user
openSeaChest_Basics Version: 3.6.2\-8_0_1 X86_64
Build Date: Oct 29 2024
Today: 20241030T162217 User: current user
.PP
==========================================================================================
Usage
Expand Down Expand Up @@ -574,25 +574,37 @@ with the \fB\-\-trim\fR/\-\-unmapRange option.
.IP
openSeaChest_Basics \- openSeaChest drive utilities \- NVMe Enabled
Copyright (c) 2014\-2024 Seagate Technology LLC and/or its Affiliates, All Rights Reserved
openSeaChest_Basics Version: 3.6.2\-8_0_0 X86_64
Build Date: Aug 26 2024
Today: 20240828T143604 User: current user
openSeaChest_Basics Version: 3.6.2\-8_0_1 X86_64
Build Date: Oct 29 2024
Today: 20241030T162217 User: current user
.PP
==========================================================================================
Version Info for openSeaChest_Basics:
.IP
Utility Version: 3.6.2
opensea\-common Version: 4.0.0
opensea\-transport Version: 8.0.0
opensea\-operations Version: 8.0.0
Build Date: Aug 26 2024
opensea\-common Version: 5.0.0
opensea\-transport Version: 8.0.1
opensea\-operations Version: 8.0.2
Build Date: Oct 29 2024
Compiled Architecture: X86_64
Detected Endianness: Little Endian
Compiler Used: GCC
Compiler Version: 11.4.0
Compiler Used: Clang
Compiler Version: 14.0.0
Operating System Type: Linux
Operating System Version: 5.15.153\-1
Operating System Name: Ubuntu 22.04.4 LTS
Operating System Name: Ubuntu 22.04.4 LTS"
.PP
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms\-and\-policies/privacy\-policy"
UBUNTU_CODENAME=jammy
.SH "SEE ALSO"
The full documentation for
.B openSeaChest_Basics
Expand Down
40 changes: 26 additions & 14 deletions docs/man/man8/openSeaChest_Configure.8
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH OPENSEACHEST_CONFIGURE "1" "August 2024" "openSeaChest_Configure ==========================================================================================" "User Commands"
.TH OPENSEACHEST_CONFIGURE "1" "October 2024" "openSeaChest_Configure ==========================================================================================" "User Commands"
.SH NAME
openSeaChest_Configure \- manual page for openSeaChest_Configure ==========================================================================================
.SH DESCRIPTION
==========================================================================================
.IP
openSeaChest_Configure \- openSeaChest drive utilities \- NVMe Enabled
Copyright (c) 2014\-2024 Seagate Technology LLC and/or its Affiliates, All Rights Reserved
openSeaChest_Configure Version: 2.7.1\-8_0_0 X86_64
Build Date: Aug 26 2024
Today: 20240828T143604 User: current user
openSeaChest_Configure Version: 2.7.1\-8_0_1 X86_64
Build Date: Oct 29 2024
Today: 20241030T162217 User: current user
.PP
==========================================================================================
Usage
Expand Down Expand Up @@ -803,25 +803,37 @@ using a TRIM/UNMAP command.
.IP
openSeaChest_Configure \- openSeaChest drive utilities \- NVMe Enabled
Copyright (c) 2014\-2024 Seagate Technology LLC and/or its Affiliates, All Rights Reserved
openSeaChest_Configure Version: 2.7.1\-8_0_0 X86_64
Build Date: Aug 26 2024
Today: 20240828T143604 User: current user
openSeaChest_Configure Version: 2.7.1\-8_0_1 X86_64
Build Date: Oct 29 2024
Today: 20241030T162217 User: current user
.PP
==========================================================================================
Version Info for openSeaChest_Configure:
.IP
Utility Version: 2.7.1
opensea\-common Version: 4.0.0
opensea\-transport Version: 8.0.0
opensea\-operations Version: 8.0.0
Build Date: Aug 26 2024
opensea\-common Version: 5.0.0
opensea\-transport Version: 8.0.1
opensea\-operations Version: 8.0.2
Build Date: Oct 29 2024
Compiled Architecture: X86_64
Detected Endianness: Little Endian
Compiler Used: GCC
Compiler Version: 11.4.0
Compiler Used: Clang
Compiler Version: 14.0.0
Operating System Type: Linux
Operating System Version: 5.15.153\-1
Operating System Name: Ubuntu 22.04.4 LTS
Operating System Name: Ubuntu 22.04.4 LTS"
.PP
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms\-and\-policies/privacy\-policy"
UBUNTU_CODENAME=jammy
.SH "SEE ALSO"
The full documentation for
.B openSeaChest_Configure
Expand Down
40 changes: 26 additions & 14 deletions docs/man/man8/openSeaChest_Defect.8
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH OPENSEACHEST_DEFECT "1" "August 2024" "openSeaChest_Defect ==========================================================================================" "User Commands"
.TH OPENSEACHEST_DEFECT "1" "October 2024" "openSeaChest_Defect ==========================================================================================" "User Commands"
.SH NAME
openSeaChest_Defect \- manual page for openSeaChest_Defect ==========================================================================================
.SH DESCRIPTION
==========================================================================================
.IP
openSeaChest_Defect \- openSeaChest drive utilities \- NVMe Enabled
Copyright (c) 2014\-2024 Seagate Technology LLC and/or its Affiliates, All Rights Reserved
openSeaChest_Defect Version: 0.9.0\-8_0_0 X86_64
Build Date: Aug 26 2024
Today: 20240828T143604 User: current user
openSeaChest_Defect Version: 0.9.0\-8_0_1 X86_64
Build Date: Oct 29 2024
Today: 20241030T162217 User: current user
.PP
==========================================================================================
Usage
Expand Down Expand Up @@ -371,25 +371,37 @@ starting LBA is specified.
.IP
openSeaChest_Defect \- openSeaChest drive utilities \- NVMe Enabled
Copyright (c) 2014\-2024 Seagate Technology LLC and/or its Affiliates, All Rights Reserved
openSeaChest_Defect Version: 0.9.0\-8_0_0 X86_64
Build Date: Aug 26 2024
Today: 20240828T143604 User: current user
openSeaChest_Defect Version: 0.9.0\-8_0_1 X86_64
Build Date: Oct 29 2024
Today: 20241030T162217 User: current user
.PP
==========================================================================================
Version Info for openSeaChest_Defect:
.IP
Utility Version: 0.9.0
opensea\-common Version: 4.0.0
opensea\-transport Version: 8.0.0
opensea\-operations Version: 8.0.0
Build Date: Aug 26 2024
opensea\-common Version: 5.0.0
opensea\-transport Version: 8.0.1
opensea\-operations Version: 8.0.2
Build Date: Oct 29 2024
Compiled Architecture: X86_64
Detected Endianness: Little Endian
Compiler Used: GCC
Compiler Version: 11.4.0
Compiler Used: Clang
Compiler Version: 14.0.0
Operating System Type: Linux
Operating System Version: 5.15.153\-1
Operating System Name: Ubuntu 22.04.4 LTS
Operating System Name: Ubuntu 22.04.4 LTS"
.PP
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms\-and\-policies/privacy\-policy"
UBUNTU_CODENAME=jammy
.SH "SEE ALSO"
The full documentation for
.B openSeaChest_Defect
Expand Down
40 changes: 26 additions & 14 deletions docs/man/man8/openSeaChest_Erase.8
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH OPENSEACHEST_ERASE "1" "August 2024" "openSeaChest_Erase ==========================================================================================" "User Commands"
.TH OPENSEACHEST_ERASE "1" "October 2024" "openSeaChest_Erase ==========================================================================================" "User Commands"
.SH NAME
openSeaChest_Erase \- manual page for openSeaChest_Erase ==========================================================================================
.SH DESCRIPTION
==========================================================================================
.IP
openSeaChest_Erase \- openSeaChest drive utilities \- NVMe Enabled
Copyright (c) 2014\-2024 Seagate Technology LLC and/or its Affiliates, All Rights Reserved
openSeaChest_Erase Version: 4.6.0\-8_0_0 X86_64
Build Date: Aug 26 2024
Today: 20240828T143604 User: current user
openSeaChest_Erase Version: 4.6.0\-8_0_1 X86_64
Build Date: Oct 29 2024
Today: 20241030T162217 User: current user
.PP
==========================================================================================
Usage
Expand Down Expand Up @@ -850,25 +850,37 @@ for performance instead.
.IP
openSeaChest_Erase \- openSeaChest drive utilities \- NVMe Enabled
Copyright (c) 2014\-2024 Seagate Technology LLC and/or its Affiliates, All Rights Reserved
openSeaChest_Erase Version: 4.6.0\-8_0_0 X86_64
Build Date: Aug 26 2024
Today: 20240828T143604 User: current user
openSeaChest_Erase Version: 4.6.0\-8_0_1 X86_64
Build Date: Oct 29 2024
Today: 20241030T162217 User: current user
.PP
==========================================================================================
Version Info for openSeaChest_Erase:
.IP
Utility Version: 4.6.0
opensea\-common Version: 4.0.0
opensea\-transport Version: 8.0.0
opensea\-operations Version: 8.0.0
Build Date: Aug 26 2024
opensea\-common Version: 5.0.0
opensea\-transport Version: 8.0.1
opensea\-operations Version: 8.0.2
Build Date: Oct 29 2024
Compiled Architecture: X86_64
Detected Endianness: Little Endian
Compiler Used: GCC
Compiler Version: 11.4.0
Compiler Used: Clang
Compiler Version: 14.0.0
Operating System Type: Linux
Operating System Version: 5.15.153\-1
Operating System Name: Ubuntu 22.04.4 LTS
Operating System Name: Ubuntu 22.04.4 LTS"
.PP
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms\-and\-policies/privacy\-policy"
UBUNTU_CODENAME=jammy
.SH "SEE ALSO"
The full documentation for
.B openSeaChest_Erase
Expand Down
40 changes: 26 additions & 14 deletions docs/man/man8/openSeaChest_Firmware.8
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH OPENSEACHEST_FIRMWARE "1" "August 2024" "openSeaChest_Firmware ==========================================================================================" "User Commands"
.TH OPENSEACHEST_FIRMWARE "1" "October 2024" "openSeaChest_Firmware ==========================================================================================" "User Commands"
.SH NAME
openSeaChest_Firmware \- manual page for openSeaChest_Firmware ==========================================================================================
.SH DESCRIPTION
==========================================================================================
.IP
openSeaChest_Firmware \- openSeaChest drive utilities \- NVMe Enabled
Copyright (c) 2014\-2024 Seagate Technology LLC and/or its Affiliates, All Rights Reserved
openSeaChest_Firmware Version: 4.2.0\-8_0_0 X86_64
Build Date: Aug 26 2024
Today: 20240828T143605 User: current user
openSeaChest_Firmware Version: 4.2.0\-8_0_1 X86_64
Build Date: Oct 29 2024
Today: 20241030T162218 User: current user
.PP
==========================================================================================
Usage
Expand Down Expand Up @@ -354,25 +354,37 @@ with multiple logical units or namespaces.
.IP
openSeaChest_Firmware \- openSeaChest drive utilities \- NVMe Enabled
Copyright (c) 2014\-2024 Seagate Technology LLC and/or its Affiliates, All Rights Reserved
openSeaChest_Firmware Version: 4.2.0\-8_0_0 X86_64
Build Date: Aug 26 2024
Today: 20240828T143605 User: current user
openSeaChest_Firmware Version: 4.2.0\-8_0_1 X86_64
Build Date: Oct 29 2024
Today: 20241030T162218 User: current user
.PP
==========================================================================================
Version Info for openSeaChest_Firmware:
.IP
Utility Version: 4.2.0
opensea\-common Version: 4.0.0
opensea\-transport Version: 8.0.0
opensea\-operations Version: 8.0.0
Build Date: Aug 26 2024
opensea\-common Version: 5.0.0
opensea\-transport Version: 8.0.1
opensea\-operations Version: 8.0.2
Build Date: Oct 29 2024
Compiled Architecture: X86_64
Detected Endianness: Little Endian
Compiler Used: GCC
Compiler Version: 11.4.0
Compiler Used: Clang
Compiler Version: 14.0.0
Operating System Type: Linux
Operating System Version: 5.15.153\-1
Operating System Name: Ubuntu 22.04.4 LTS
Operating System Name: Ubuntu 22.04.4 LTS"
.PP
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms\-and\-policies/privacy\-policy"
UBUNTU_CODENAME=jammy
.SH "SEE ALSO"
The full documentation for
.B openSeaChest_Firmware
Expand Down
Loading

0 comments on commit 2805734

Please sign in to comment.