Skip to content

Commit

Permalink
Fix build with -pedantic
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed May 28, 2024
1 parent 92bf532 commit a849701
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 20 deletions.
54 changes: 45 additions & 9 deletions .github/workflows/actions-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,49 @@ jobs:
- name: Run tests
run: cmake --build ./build --target run_tests

gcc-13-pedantic:
if: github.repository_owner == 'aws'
needs: [ sanity-test-run ]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- name: Setup CMake
uses: threeal/[email protected]
with:
generator: Ninja
c-compiler: gcc-13
cxx-compiler: g++-13
options: CMAKE_BUILD_TYPE=Release CMAKE_C_FLAGS=-pedantic CMAKE_CXX_FLAGS=-pedantic
- name: Build Crypto
run: cmake --build ./build --target crypto
- name: Build SSL
run: cmake --build ./build --target ssl

clang-18-pedantic:
if: github.repository_owner == 'aws'
needs: [ sanity-test-run ]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- name: Setup CMake
uses: threeal/[email protected]
with:
generator: Ninja
c-compiler: clang-18
cxx-compiler: clang++-18
options: CMAKE_BUILD_TYPE=Release CMAKE_C_FLAGS=-pedantic CMAKE_CXX_FLAGS=-pedantic
- name: Build Crypto
run: cmake --build ./build --target crypto
- name: Build SSL
run: cmake --build ./build --target ssl

clang-ubuntu-2004-sanity:
if: github.repository_owner == 'aws'
needs: [sanity-test-run]
strategy:
fail-fast: false
matrix:
gccversion:
clangversion:
- "10"
- "11"
- "12"
Expand All @@ -282,8 +318,8 @@ jobs:
uses: threeal/[email protected]
with:
generator: Ninja
c-compiler: clang-${{ matrix.gccversion }}
cxx-compiler: clang++-${{ matrix.gccversion }}
c-compiler: clang-${{ matrix.clangversion }}
cxx-compiler: clang++-${{ matrix.clangversion }}
options: FIPS=${{ matrix.fips }} CMAKE_BUILD_TYPE=Release
- name: Build Project
run: cmake --build ./build --target all
Expand All @@ -296,7 +332,7 @@ jobs:
strategy:
fail-fast: false
matrix:
gccversion:
clangversion:
- "13"
- "14"
- "15"
Expand All @@ -313,8 +349,8 @@ jobs:
uses: threeal/[email protected]
with:
generator: Ninja
c-compiler: clang-${{ matrix.gccversion }}
cxx-compiler: clang++-${{ matrix.gccversion }}
c-compiler: clang-${{ matrix.clangversion }}
cxx-compiler: clang++-${{ matrix.clangversion }}
options: FIPS=${{ matrix.fips }} CMAKE_BUILD_TYPE=Release
- name: Build Project
run: cmake --build ./build --target all
Expand All @@ -327,7 +363,7 @@ jobs:
strategy:
fail-fast: false
matrix:
gccversion:
clangversion:
- "16"
- "17"
- "18"
Expand All @@ -344,8 +380,8 @@ jobs:
uses: threeal/[email protected]
with:
generator: Ninja
c-compiler: clang-${{ matrix.gccversion }}
cxx-compiler: clang++-${{ matrix.gccversion }}
c-compiler: clang-${{ matrix.clangversion }}
cxx-compiler: clang++-${{ matrix.clangversion }}
options: FIPS=${{ matrix.fips }} CMAKE_BUILD_TYPE=Release
- name: Build Project
run: cmake --build ./build --target all
Expand Down
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,9 @@ if(GCC OR CLANG)
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wall -fvisibility=hidden -fno-common")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wwrite-strings -Wformat-security -Wunused-result")
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wvla -Wtype-limits -Wno-unused-parameter")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wwrite-strings -Wformat-security -Wunused-result -Wno-overlength-strings")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wno-newline-eof")
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-c11-extensions -Wvla -Wtype-limits -Wno-unused-parameter")
endif()
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Werror -Wformat=2 -Wsign-compare -Wmissing-field-initializers -Wwrite-strings")

Expand Down
16 changes: 8 additions & 8 deletions crypto/fipsmodule/hmac/hmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ struct hmac_methods_st {
// The maximum number of HMAC implementations
#define HMAC_METHOD_MAX 8

MD_TRAMPOLINES_EXPLICIT(MD5, MD5_CTX, MD5_CBLOCK);
MD_TRAMPOLINES_EXPLICIT(SHA1, SHA_CTX, SHA_CBLOCK);
MD_TRAMPOLINES_EXPLICIT(SHA224, SHA256_CTX, SHA256_CBLOCK);
MD_TRAMPOLINES_EXPLICIT(SHA256, SHA256_CTX, SHA256_CBLOCK);
MD_TRAMPOLINES_EXPLICIT(SHA384, SHA512_CTX, SHA512_CBLOCK);
MD_TRAMPOLINES_EXPLICIT(SHA512, SHA512_CTX, SHA512_CBLOCK);
MD_TRAMPOLINES_EXPLICIT(SHA512_224, SHA512_CTX, SHA512_CBLOCK);
MD_TRAMPOLINES_EXPLICIT(SHA512_256, SHA512_CTX, SHA512_CBLOCK);
MD_TRAMPOLINES_EXPLICIT(MD5, MD5_CTX, MD5_CBLOCK)
MD_TRAMPOLINES_EXPLICIT(SHA1, SHA_CTX, SHA_CBLOCK)
MD_TRAMPOLINES_EXPLICIT(SHA224, SHA256_CTX, SHA256_CBLOCK)
MD_TRAMPOLINES_EXPLICIT(SHA256, SHA256_CTX, SHA256_CBLOCK)
MD_TRAMPOLINES_EXPLICIT(SHA384, SHA512_CTX, SHA512_CBLOCK)
MD_TRAMPOLINES_EXPLICIT(SHA512, SHA512_CTX, SHA512_CBLOCK)
MD_TRAMPOLINES_EXPLICIT(SHA512_224, SHA512_CTX, SHA512_CBLOCK)
MD_TRAMPOLINES_EXPLICIT(SHA512_256, SHA512_CTX, SHA512_CBLOCK)

struct hmac_method_array_st {
HmacMethods methods[HMAC_METHOD_MAX];
Expand Down
2 changes: 1 addition & 1 deletion crypto/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static void __asan_unpoison_memory_region(const void *addr, size_t size) {}
// implementation is statically linked with BoringSSL. So, if |sdallocx| is
// provided in, say, libc.so, we still won't use it because that's dynamically
// linked. This isn't an ideal result, but its helps in some cases.
WEAK_SYMBOL_FUNC(void, sdallocx, (void *ptr, size_t size, int flags));
WEAK_SYMBOL_FUNC(void, sdallocx, (void *ptr, size_t size, int flags))

// The following four functions can be defined to override default heap
// allocation and freeing. If defined, it is the responsibility of
Expand Down

0 comments on commit a849701

Please sign in to comment.