Skip to content

Commit 436e4a7

Browse files
paveldyakovipl_ci
authored andcommitted
[SB][Build] Enabling wall for gcc and clang (#882)
1 parent 510ec47 commit 436e4a7

19 files changed

Lines changed: 169 additions & 123 deletions

sources/cmake/linux/Clang9.0.0.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -falign-functions=32")
6363
# Format string vulnerabilities, enable specific format-security warning and precisely convert it to error
6464
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat -Wformat-security")
6565
# Enabling additional warnings
66-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wimplicit-fallthrough -Wextra")
66+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-unused-function -Wimplicit-fallthrough -Wextra")
6767

6868
#Diagnostic flags
6969
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wdouble-promotion -Wshadow -Wunreachable-code -Wpointer-arith -Wuninitialized -Wconversion")

sources/cmake/linux/GNU8.2.0.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -falign-functions=32 -falign-loops=32")
6363
# Format string vulnerabilities, enable specific format-security warning and precisely convert it to error
6464
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat -Wformat-security")
6565
# Enabling additional warnings
66-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wimplicit-fallthrough -Wextra")
66+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-unused-function -Wimplicit-fallthrough -Wextra")
6767

6868
# Enable Intel® Control-Flow Enforcement Technology (Intel® CET) protection
6969
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcf-protection=full")

sources/include/owndefs.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,26 @@ extern double __intel_castu64_f64(unsigned __int64 val);
609609
#endif
610610
#endif
611611

612+
#if !defined(IPPCP_GCC_IGNORE_PUSH) && !defined(IPPCP_GCC_IGNORE_POP)
613+
#if defined(__GNUC__) && !defined(__clang__)
614+
615+
#define IPPCP_PRAGMA(name) _Pragma(#name)
616+
617+
#define IPPCP_GCC_IGNORE_PUSH(type) \
618+
IPPCP_PRAGMA(GCC diagnostic push) \
619+
IPPCP_PRAGMA(GCC diagnostic ignored type)
620+
621+
#define IPPCP_GCC_IGNORE_POP IPPCP_PRAGMA(GCC diagnostic pop)
622+
623+
#else
624+
#define IPPCP_GCC_IGNORE_PUSH(type) \
625+
do { \
626+
} while (0);
627+
#define IPPCP_GCC_IGNORE_POP \
628+
do { \
629+
} while (0);
630+
#endif
631+
#endif
612632

613633
#if defined(__cplusplus)
614634
}

sources/ippcp/gsmod_montfactor.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
* limitations under the License.
1515
*************************************************************************/
1616

17-
/*
18-
//
17+
/*
18+
//
1919
// Purpose:
2020
// Cryptography Primitive. Modular Arithmetic Engine. General Functionality
21-
//
21+
//
2222
// Contents:
2323
// gsMontFactor()
2424
//
@@ -42,8 +42,8 @@ IPP_OWN_DEFN(BNU_CHUNK_T, gsMontFactor, (BNU_CHUNK_T m0))
4242

4343
int i;
4444
for (i = 2; i <= BNU_CHUNK_BITS; i++, x <<= 1) {
45-
BNU_CHUNK_T rH, rL;
46-
MUL_AB(rH, rL, m0, y);
45+
BNU_CHUNK_T rL;
46+
MUL_AB_LOW(rL, m0, y);
4747
if (x < (rL & mask)) /* x < ((m0*y) mod (2*x)) */
4848
y += x;
4949
mask += mask + 1;

sources/ippcp/hash/pcphash_digest.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
* limitations under the License.
1515
*************************************************************************/
1616

17-
/*
18-
//
17+
/*
18+
//
1919
// Purpose:
2020
// Cryptography Primitive.
2121
// Security Hash Standard
2222
// General Functionality
23-
//
23+
//
2424
// Contents:
2525
// cpComputeDigest()
2626
//
@@ -108,6 +108,9 @@ IPP_OWN_DEFN(void, cpComputeDigest, (Ipp8u * pHashTag, int hashTagLen, const Ipp
108108
hash[6] = ENDIANNESS64(hash[6]);
109109
hash[7] = ENDIANNESS64(hash[7]);
110110
} else if (ippHashAlg_MD5 != HASH_ALG_ID(pCtx)) {
111+
112+
IPPCP_GCC_IGNORE_PUSH("-Wstrict-aliasing")
113+
111114
((Ipp32u*)hash)[0] = ENDIANNESS32(((Ipp32u*)hash)[0]);
112115
((Ipp32u*)hash)[1] = ENDIANNESS32(((Ipp32u*)hash)[1]);
113116
((Ipp32u*)hash)[2] = ENDIANNESS32(((Ipp32u*)hash)[2]);
@@ -118,6 +121,8 @@ IPP_OWN_DEFN(void, cpComputeDigest, (Ipp8u * pHashTag, int hashTagLen, const Ipp
118121
((Ipp32u*)hash)[6] = ENDIANNESS32(((Ipp32u*)hash)[6]);
119122
((Ipp32u*)hash)[7] = ENDIANNESS32(((Ipp32u*)hash)[7]);
120123
}
124+
125+
IPPCP_GCC_IGNORE_POP
121126
}
122127
CopyBlock(hash, pHashTag, hashTagLen);
123128
}

sources/ippcp/hash/pcphashmessage.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ IPPFUN(IppStatus, ippsHashMessage, (const Ipp8u* pMsg, int len, Ipp8u* pMD, IppH
128128
hash[6] = ENDIANNESS64(hash[6]);
129129
hash[7] = ENDIANNESS64(hash[7]);
130130
} else if (ippHashAlg_MD5 != hashAlg) {
131+
132+
IPPCP_GCC_IGNORE_PUSH("-Wstrict-aliasing")
133+
131134
/* ippHashAlg_SHA1, ippHashAlg_SHA224, ippHashAlg_SHA256 and ippHashAlg_SM3 */
132135
((Ipp32u*)hash)[0] = ENDIANNESS32(((Ipp32u*)hash)[0]);
133136
((Ipp32u*)hash)[1] = ENDIANNESS32(((Ipp32u*)hash)[1]);
@@ -137,6 +140,8 @@ IPPFUN(IppStatus, ippsHashMessage, (const Ipp8u* pMsg, int len, Ipp8u* pMD, IppH
137140
((Ipp32u*)hash)[5] = ENDIANNESS32(((Ipp32u*)hash)[5]);
138141
((Ipp32u*)hash)[6] = ENDIANNESS32(((Ipp32u*)hash)[6]);
139142
((Ipp32u*)hash)[7] = ENDIANNESS32(((Ipp32u*)hash)[7]);
143+
144+
IPPCP_GCC_IGNORE_POP
140145
}
141146
CopyBlock(hash, pMD, hashSize);
142147

sources/ippcp/ml_kem/internal/k_pke/kernels.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,7 @@ IPPCP_INLINE Ipp16s cp_divAndRoundToNearestInt(Ipp32s x, Ipp32s divisor)
4848
*/
4949
IPPCP_INLINE void cp_bitsToBytes(const Ipp8u* pInp, Ipp8u* pOut, const Ipp32u numElmBitArr)
5050
{
51-
#if defined(__GNUC__) && !defined(__clang__)
52-
#pragma GCC diagnostic push
53-
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
54-
#endif
55-
51+
IPPCP_GCC_IGNORE_PUSH("-Wmaybe-uninitialized")
5652
Ipp32u numElmByteArr = BITS2WORD8_SIZE(numElmBitArr);
5753
for (Ipp32u i = 0; i < numElmByteArr; i++) {
5854
Ipp8u B = 0;
@@ -61,10 +57,7 @@ IPPCP_INLINE void cp_bitsToBytes(const Ipp8u* pInp, Ipp8u* pOut, const Ipp32u nu
6157
}
6258
pOut[i] = B;
6359
}
64-
65-
#if defined(__GNUC__) && !defined(__clang__)
66-
#pragma GCC diagnostic pop
67-
#endif
60+
IPPCP_GCC_IGNORE_POP
6861
}
6962

7063
/*

sources/ippcp/pcpaes_s2v_cmac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ IPPFUN(IppStatus, ippsAES_S2V_CMAC, (const Ipp8u* pKey,
6666
const Ipp8u* pAD[],
6767
const int pADlen[],
6868
int numAD,
69-
Ipp8u V[MBS_RIJ128]))
69+
Ipp8u* V))
7070
/* clang-format on */
7171
{
7272
/* test output vector */

sources/ippcp/pcpaesgcmtbl2kca.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
/*
3838
// authenticates n*BLOCK_SIZE bytes
3939
*/
40-
//#if !((_IPP==_IPP_V8) || (_IPP==_IPP_P8) || \
41-
// (_IPP==_IPP_S8) || (_IPP>=_IPP_G9) || \
42-
// (_IPP32E==_IPP32E_U8) || (_IPP32E==_IPP32E_Y8) || \
40+
//#if !((_IPP==_IPP_V8) || (_IPP==_IPP_P8) ||
41+
// (_IPP==_IPP_S8) || (_IPP>=_IPP_G9) ||
42+
// (_IPP32E==_IPP32E_U8) || (_IPP32E==_IPP32E_Y8) ||
4343
// (_IPP32E==_IPP32E_N8) || (_IPP32E>=_IPP32E_E9))
4444
#if 0
4545
IPP_OWN_DEFN (void, AesGcmAuth_table2K, (Ipp8u* pHash, const Ipp8u* pSrc, int len, const Ipp8u* pHKey, const void* pParam))

sources/ippcp/pcpaesm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#define VALID_AES_ID(ctx) ((((ctx)->idCtx) ^ (Ipp32u)IPP_UINT_PTR((ctx))) == (Ipp32u)idCtxRijndael)
4040

4141
/* number of rounds (use [NK] for access) */
42-
static int rij128nRounds[3] = { NR128_128, NR128_192, NR128_256 };
42+
static const int rij128nRounds[3] = { NR128_128, NR128_192, NR128_256 };
4343

4444
/*
4545
// number of keys (estimation only!) (use [NK] for access)
@@ -59,7 +59,7 @@ static int rij128nRounds[3] = { NR128_128, NR128_192, NR128_256 };
5959
// nKeys - accurate number of keys
6060
// is more convenient when calculates key extension
6161
*/
62-
static int rij128nKeys[3] = { 44, 52, 60 };
62+
static const int rij128nKeys[3] = { 44, 52, 60 };
6363

6464
/*
6565
// helper for nRounds[] and estnKeys[] access

0 commit comments

Comments
 (0)