Skip to content

Commit

Permalink
Merge branch 'main' into fix-uselesscast-warning
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 authored Jul 30, 2024
2 parents a05291a + 0a98aa0 commit a02e7f0
Show file tree
Hide file tree
Showing 144 changed files with 9,632 additions and 1,074 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
Checks: 'clang-diagnostic-*,clang-analyzer-*,readability-*,modernize-*,bugprone-*,misc-*,google-runtime-int,llvm-header-guard,fuchsia-restrict-system-includes,-clang-analyzer-valist.Uninitialized,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-alpha.*,-readability-magic-numbers,-readability-non-const-parameter,-readability-avoid-const-params-in-decls,-readability-else-after-return,-readability-isolate-declaration,-readability-uppercase-literal-suffix,-bugprone-sizeof-expression,-bugprone-easily-swappable-parameters,-readability-identifier-length,-misc-no-recursion,-readability-function-cognitive-complexity,-readability-magic-numbers'
WarningsAsErrors: '*'
HeaderFilterRegex: '.*\.[h|inl]$'
HeaderFilterRegex: '^(?!.*external).*\.[h|inl]$'
FormatStyle: 'file'
CheckOptions:
- key: readability-braces-around-statements.ShortStatementLines
Expand Down
27 changes: 18 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'main'

env:
BUILDER_VERSION: v0.9.49
BUILDER_VERSION: v0.9.62
BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
BUILDER_SOURCE: releases
PACKAGE_NAME: aws-c-common
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:
python builder.pyz build -p ${{ env.PACKAGE_NAME }} --target windows-${{ matrix.arch }} --compiler msvc-16
windows-vc15:
runs-on: windows-2022 # latest
runs-on: windows-2019 # windows-2019 is last env with Visual Studio 2017 (v15.0)
strategy:
matrix:
arch: [x86, x64]
Expand Down Expand Up @@ -174,17 +174,26 @@ jobs:
echo "Starting to run AppVerifier on all tests found by CTest"
python .\aws-c-common\scripts\appverifier_ctest.py --build_directory .\aws-c-common\build\aws-c-common
osx:
runs-on: macos-12 # latest
macos-x64:
runs-on: macos-14-large # latest
steps:
- name: Build ${{ env.PACKAGE_NAME }} + consumers
run: |
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')"
chmod a+x builder
./builder build -p ${{ env.PACKAGE_NAME }}
macos:
runs-on: macos-14 # latest
steps:
- name: Build ${{ env.PACKAGE_NAME }} + consumers
run: |
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')"
chmod a+x builder
./builder build -p ${{ env.PACKAGE_NAME }}
osx-no-cpu-extensions:
runs-on: macos-12 # latest
macos-no-cpu-extensions:
runs-on: macos-14 # latest
steps:
- name: Build ${{ env.PACKAGE_NAME }} + consumers
run: |
Expand Down Expand Up @@ -220,7 +229,7 @@ jobs:
operating_system: freebsd
version: '13.2'
run: |
sudo pkg install -y python3 py39-urllib3 py39-pip cmake
sudo pkg install -y python3 devel/py-pip net/py-urllib3 cmake
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz', 'builder')"
chmod a+x builder
./builder build -p ${{ env.PACKAGE_NAME }}
Expand Down Expand Up @@ -255,8 +264,8 @@ jobs:
python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
python builder.pyz build -p ${{ env.PACKAGE_NAME }} --config Debug
osx-debug:
runs-on: macos-12 # latest
macos-debug:
runs-on: macos-14 # latest
steps:
- name: Build ${{ env.PACKAGE_NAME }} + consumers
run: |
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ on: [push]
jobs:
clang-format:

runs-on: ubuntu-20.04 # latest
runs-on: ubuntu-24.04 # latest

steps:
- name: Checkout Sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: clang-format lint
uses: DoozyX/[email protected]
with:
# List of extensions to check
extensions: c,h,inl
source: 'source include tests verification'
run: |
./format-check.py
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:

env:
BUILDER_VERSION: v0.9.37
BUILDER_VERSION: v0.9.55
BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
BUILDER_SOURCE: releases
PACKAGE_NAME: aws-c-common
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/proof_ci_resources/config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
cadical-tag: latest
cbmc-version: latest
cbmc-viewer-version: latest
kissat-tag: latest
litani-version: latest
# Use exact versions (instead of "latest") so we're not broken by surprise upgrades.
cadical-tag: "rel-2.0.0" # tag of latest release: https://github.com/arminbiere/cadical/releases
cbmc-version: "6.1.0" # semver of latest release: https://github.com/diffblue/cbmc/releases
cbmc-viewer-version: "3.9" # semver of latest release: https://github.com/model-checking/cbmc-viewer/releases
kissat-tag: "rel-3.1.1" # tag of latest release: https://github.com/arminbiere/kissat/releases
litani-version: "1.29.0" # semver of latest release: https://github.com/awslabs/aws-build-accumulator/releases
proofs-dir: verification/cbmc/proofs
run-cbmc-proofs-command: ./run-cbmc-proofs.py
35 changes: 22 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ file(GLOB AWS_COMMON_HEADERS
"include/aws/common/*.inl"
)

file (GLOB AWS_COMMON_EXTERNAL_HEADERS
"include/aws/common/external/*.h")

file (GLOB AWS_COMMON_EXTERNAL_INSTALLED_HEADERS
"include/aws/common/external/ittnotify.h")

Expand All @@ -56,12 +53,17 @@ file(GLOB AWS_COMMON_SRC
)

file (GLOB AWS_COMMON_EXTERNAL_SRC
"source/external/*.c")
"source/external/*.c"
"source/external/libcbor/*.c"
"source/external/libcbor/cbor/*.c"
"source/external/libcbor/cbor/internal/*.c"
)


option(AWS_NUM_CPU_CORES "Number of CPU cores of the target machine. Useful when cross-compiling." 0)

if (WIN32)
set(WINDOWS_KERNEL_LIB "Kernel32" CACHE STRING "The name of the kernel library to link against (default: Kernel32)")
set(WINDOWS_KERNEL_LIB "kernel32" CACHE STRING "The name of the kernel library to link against (default: kernel32)")

file(GLOB AWS_COMMON_OS_HEADERS
"include/aws/common/windows/*"
Expand All @@ -82,9 +84,9 @@ if (WIN32)

list(APPEND PLATFORM_DEFINES WINDOWS_KERNEL_LIB=${WINDOWS_KERNEL_LIB})
# PSAPI_VERSION=1 is needed to support GetProcessMemoryInfo on both pre and
# post Win7 OS's.
# post Win7 OS's.
list(APPEND PLATFORM_DEFINES PSAPI_VERSION=1)
list(APPEND PLATFORM_LIBS BCrypt ${WINDOWS_KERNEL_LIB} Ws2_32 Shlwapi Psapi)
list(APPEND PLATFORM_LIBS bcrypt ${WINDOWS_KERNEL_LIB} ws2_32 shlwapi psapi)
else ()
file(GLOB AWS_COMMON_OS_HEADERS
"include/aws/common/posix/*"
Expand Down Expand Up @@ -155,13 +157,17 @@ if (USE_CPU_EXTENSIONS)
)
endif()
elseif (AWS_ARCH_ARM64 OR AWS_ARCH_ARM32)
if (MSVC)
if (WIN32)
file(GLOB AWS_COMMON_ARCH_SRC
"source/arch/arm/msvc/*.c"
"source/arch/arm/windows/*.c"
)
elseif (AWS_HAVE_AUXV)
elseif(APPLE)
file(GLOB AWS_COMMON_ARCH_SRC
"source/arch/arm/darwin/*.c"
)
else()
file(GLOB AWS_COMMON_ARCH_SRC
"source/arch/arm/asm/*.c"
"source/arch/arm/auxv/*.c"
)
endif()
endif()
Expand All @@ -173,7 +179,6 @@ file(GLOB COMMON_HEADERS
${AWS_COMMON_HEADERS}
${AWS_COMMON_OS_HEADERS}
${AWS_COMMON_PRIV_HEADERS}
${AWS_COMMON_EXTERNAL_HEADERS}
${AWS_TEST_HEADERS}
)

Expand Down Expand Up @@ -213,6 +218,10 @@ endif()
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION 1.0.0)
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION 1)

# libcbor files do includes like: #include "cbor/cbor_export.h"
# To make these paths work, add the location we're storing them as a search path.
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/source/external/libcbor)
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
Expand All @@ -225,7 +234,7 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE -DCJSON_HIDE_SYMBOLS)

if (AWS_HAVE_AVX2_INTRINSICS)
target_compile_definitions(${PROJECT_NAME} PRIVATE -DUSE_SIMD_ENCODING)
simd_add_source_avx(${PROJECT_NAME} "source/arch/intel/encoding_avx2.c")
simd_append_source_and_features(${PROJECT_NAME} "source/arch/intel/encoding_avx2.c" ${AWS_AVX2_FLAG})
message(STATUS "Building SIMD base64 decoder")
endif()

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ have pre-slotted log subjects & error codes for each library. The currently allo
| [0x3400, 0x3800) | aws-c-iot |
| [0x3800, 0x3C00) | aws-c-s3 |
| [0x3C00, 0x4000) | aws-c-sdkutils |
| [0x4000, 0x4400) | (reserved for future project) |
| [0x4000, 0x4400) | aws-crt-kotlin |
| [0x4400, 0x4800) | (reserved for future project) |

Each library should begin its error and log subject values at the beginning of its range and follow in sequence (don't skip codes). Upon
Expand Down
26 changes: 26 additions & 0 deletions THIRD-PARTY-LICENSES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,29 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

------

** libcbor; version 0.11.0 -- https://github.com/PJK/libcbor
Copyright (c) 2014-2017 Pavel Kalvoda

MIT License

Copyright (c) 2014-2017 Pavel Kalvoda

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
14 changes: 14 additions & 0 deletions bin/system_info/print_system_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <aws/common/byte_buf.h>
#include <aws/common/logging.h>
#include <aws/common/system_info.h>
#include <aws/common/cpuid.h>

int main(void) {
struct aws_allocator *allocator = aws_default_allocator();
Expand Down Expand Up @@ -39,6 +40,19 @@ int main(void) {
fprintf(stdout, " 'numa architecture': 'false'\n");
}

fprintf(stdout, " 'cpu_capabilities': {\n");
fprintf(stdout, " 'arm_crc': %s,\n", aws_cpu_has_feature(AWS_CPU_FEATURE_ARM_CRC) ? "true" : "false");
fprintf(stdout, " 'arm_pmull': %s,\n", aws_cpu_has_feature(AWS_CPU_FEATURE_ARM_PMULL) ? "true" : "false");
fprintf(stdout, " 'arm_crypto': %s,\n", aws_cpu_has_feature(AWS_CPU_FEATURE_ARM_CRYPTO) ? "true" : "false");
fprintf(stdout, " 'amd_sse4_1': %s,\n", aws_cpu_has_feature(AWS_CPU_FEATURE_SSE_4_1) ? "true" : "false");
fprintf(stdout, " 'amd_sse4_2': %s,\n", aws_cpu_has_feature(AWS_CPU_FEATURE_SSE_4_2) ? "true" : "false");
fprintf(stdout, " 'amd_clmul': %s,\n", aws_cpu_has_feature(AWS_CPU_FEATURE_CLMUL) ? "true" : "false");
fprintf(stdout, " 'amd_vpclmulqdq': %s,\n", aws_cpu_has_feature(AWS_CPU_FEATURE_VPCLMULQDQ) ? "true" : "false");
fprintf(stdout, " 'amd_avx2': %s,\n", aws_cpu_has_feature(AWS_CPU_FEATURE_AVX2) ? "true" : "false");
fprintf(stdout, " 'amd_avx512': %s,\n", aws_cpu_has_feature(AWS_CPU_FEATURE_AVX512) ? "true" : "false");
fprintf(stdout, " 'amd_bmi2': %s\n", aws_cpu_has_feature(AWS_CPU_FEATURE_BMI2) ? "true" : "false");
fprintf(stdout, " }\n");

fprintf(stdout, "}\n");
aws_system_environment_release(env);
aws_logger_clean_up(&logger);
Expand Down
15 changes: 14 additions & 1 deletion cmake/AwsFeatureTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ if(MINGW)
set(USE_CPU_EXTENSIONS OFF)
endif()

if (USE_CPU_EXTENSIONS)
set(AWS_USE_CPU_EXTENSIONS ON)
endif()

if(NOT CMAKE_CROSSCOMPILING)
check_c_source_runs("
#include <stdbool.h>
Expand All @@ -35,7 +39,7 @@ if(NOT CMAKE_CROSSCOMPILING)
endif()

check_c_source_compiles("
#include <Windows.h>
#include <windows.h>
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
int main() {
return 0;
Expand All @@ -54,6 +58,15 @@ check_c_source_compiles("
}
" AWS_ARCH_INTEL)

check_c_source_compiles("
int main() {
#if !(defined(__x86_64__) || defined(_M_X64))
# error \"not intel\"
#endif
return 0;
}
" AWS_ARCH_INTEL_X64)

check_c_source_compiles("
int main() {
#if !(defined(__aarch64__) || defined(_M_ARM64))
Expand Down
Loading

0 comments on commit a02e7f0

Please sign in to comment.