Skip to content

Commit 29c99f1

Browse files
committed
[compiler] Add -Wshorten-64-to-32 compiler flag for is_clang
1 parent 2c9cd92 commit 29c99f1

File tree

19 files changed

+92
-36
lines changed

19 files changed

+92
-36
lines changed

build/config/compiler/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ config("strict_warnings") {
256256
cflags += [
257257
"-Wimplicit-fallthrough",
258258
"-Wheader-hygiene",
259+
"-Wshorten-64-to-32",
259260
"-Wformat-type-confusion",
260261
]
261262
}

examples/common/tracing/TraceDecoder.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ CHIP_ERROR TraceDecoder::ReadString(const char * str)
130130

131131
CHIP_ERROR TraceDecoder::LogJSON(Json::Value & json)
132132
{
133-
uint32_t protocol = json[kProtocolIdKey].asLargestUInt();
133+
auto protocol = json[kProtocolIdKey].asLargestUInt();
134134
uint16_t vendorId = protocol >> 16;
135135
uint16_t protocolId = protocol & 0xFFFF;
136136
if (!mOptions.IsProtocolEnabled(chip::Protocols::Id(chip::VendorId(vendorId), protocolId)))

examples/darwin-framework-tool/commands/provider/OTASoftwareUpdateInteractive.mm

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ static bool ParseJsonFileAndPopulateCandidates(
7878

7979
auto vendorId = [NSNumber numberWithUnsignedInt:iter.get("vendorId", 1).asUInt()];
8080
auto productId = [NSNumber numberWithUnsignedInt:iter.get("productId", 1).asUInt()];
81-
auto softwareVersion = [NSNumber numberWithUnsignedLong:iter.get("softwareVersion", 10).asUInt64()];
81+
auto softwareVersion = [NSNumber numberWithUnsignedLongLong:iter.get("softwareVersion", 10).asUInt64()];
8282
auto softwareVersionString = [NSString stringWithUTF8String:iter.get("softwareVersionString", "1.0.0").asCString()];
8383
auto cDVersionNumber = [NSNumber numberWithUnsignedInt:iter.get("cDVersionNumber", 0).asUInt()];
8484
auto softwareVersionValid = iter.get("softwareVersionValid", true).asBool() ? YES : NO;
8585
auto minApplicableSoftwareVersion =
86-
[NSNumber numberWithUnsignedLong:iter.get("minApplicableSoftwareVersion", 0).asUInt64()];
86+
[NSNumber numberWithUnsignedLongLong:iter.get("minApplicableSoftwareVersion", 0).asUInt64()];
8787
auto maxApplicableSoftwareVersion =
88-
[NSNumber numberWithUnsignedLong:iter.get("maxApplicableSoftwareVersion", 1000).asUInt64()];
88+
[NSNumber numberWithUnsignedLongLong:iter.get("maxApplicableSoftwareVersion", 1000).asUInt64()];
8989
auto otaURL = [NSString stringWithUTF8String:iter.get("otaURL", "https://test.com").asCString()];
9090

9191
candidate.deviceModelData.vendorId = vendorId;

examples/platform/linux/Options.cpp

+5-9
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <lib/core/CHIPError.h>
2929
#include <lib/support/Base64.h>
3030
#include <lib/support/BytesToHex.h>
31+
#include <lib/support/SafeInt.h>
3132

3233
#include <credentials/examples/DeviceAttestationCredsExample.h>
3334

@@ -233,16 +234,11 @@ bool Base64ArgToVector(const char * arg, size_t maxSize, std::vector<uint8_t> &
233234
outVector.resize(maxSize);
234235

235236
size_t argLen = strlen(arg);
236-
if (argLen > maxBase64Size)
237-
{
238-
return false;
239-
}
237+
VerifyOrReturnValue(argLen <= maxBase64Size, false);
238+
VerifyOrReturnValue(chip::CanCastTo<uint32_t>(argLen), false);
240239

241-
size_t decodedLen = chip::Base64Decode32(arg, argLen, reinterpret_cast<uint8_t *>(outVector.data()));
242-
if (decodedLen == 0)
243-
{
244-
return false;
245-
}
240+
size_t decodedLen = chip::Base64Decode32(arg, static_cast<uint32_t>(argLen), reinterpret_cast<uint8_t *>(outVector.data()));
241+
VerifyOrReturnValue(decodedLen != 0, false);
246242

247243
outVector.resize(decodedLen);
248244
return true;

examples/providers/DeviceInfoProviderImpl.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <lib/support/CHIPMemString.h>
2121
#include <lib/support/CodeUtils.h>
2222
#include <lib/support/DefaultStorageKeyAllocator.h>
23+
#include <lib/support/SafeInt.h>
2324
#include <platform/internal/CHIPDeviceLayerInternal.h>
2425

2526
#include <stdlib.h>
@@ -134,6 +135,8 @@ CHIP_ERROR DeviceInfoProviderImpl::GetUserLabelLength(EndpointId endpoint, size_
134135

135136
CHIP_ERROR DeviceInfoProviderImpl::SetUserLabelAt(EndpointId endpoint, size_t index, const UserLabelType & userLabel)
136137
{
138+
VerifyOrReturnError(CanCastTo<uint32_t>(index), CHIP_ERROR_INVALID_ARGUMENT);
139+
137140
DefaultStorageKeyAllocator keyAlloc;
138141
uint8_t buf[UserLabelTLVMaxSize()];
139142
TLV::TLVWriter writer;
@@ -145,15 +148,15 @@ CHIP_ERROR DeviceInfoProviderImpl::SetUserLabelAt(EndpointId endpoint, size_t in
145148
ReturnErrorOnFailure(writer.PutString(kLabelValueTag, userLabel.value));
146149
ReturnErrorOnFailure(writer.EndContainer(outerType));
147150

148-
return mStorage->SyncSetKeyValue(keyAlloc.UserLabelIndexKey(endpoint, index), buf,
151+
return mStorage->SyncSetKeyValue(keyAlloc.UserLabelIndexKey(endpoint, static_cast<uint32_t>(index)), buf,
149152
static_cast<uint16_t>(writer.GetLengthWritten()));
150153
}
151154

152155
CHIP_ERROR DeviceInfoProviderImpl::DeleteUserLabelAt(EndpointId endpoint, size_t index)
153156
{
154157
DefaultStorageKeyAllocator keyAlloc;
155158

156-
return mStorage->SyncDeleteKeyValue(keyAlloc.UserLabelIndexKey(endpoint, index));
159+
return mStorage->SyncDeleteKeyValue(keyAlloc.UserLabelIndexKey(endpoint, static_cast<uint32_t>(index)));
157160
}
158161

159162
DeviceInfoProvider::UserLabelIterator * DeviceInfoProviderImpl::IterateUserLabel(EndpointId endpoint)
@@ -176,12 +179,13 @@ bool DeviceInfoProviderImpl::UserLabelIteratorImpl::Next(UserLabelType & output)
176179
CHIP_ERROR err = CHIP_NO_ERROR;
177180

178181
VerifyOrReturnError(mIndex < mTotal, false);
182+
VerifyOrReturnError(CanCastTo<uint32_t>(mIndex), false);
179183

180184
DefaultStorageKeyAllocator keyAlloc;
181185
uint8_t buf[UserLabelTLVMaxSize()];
182186
uint16_t len = static_cast<uint16_t>(sizeof(buf));
183187

184-
err = mProvider.mStorage->SyncGetKeyValue(keyAlloc.UserLabelIndexKey(mEndpoint, mIndex), buf, len);
188+
err = mProvider.mStorage->SyncGetKeyValue(keyAlloc.UserLabelIndexKey(mEndpoint, static_cast<uint32_t>(mIndex)), buf, len);
185189
VerifyOrReturnError(err == CHIP_NO_ERROR, false);
186190

187191
TLV::ContiguousBufferTLVReader reader;

src/controller/tests/data_model/TestRead.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ CHIP_ERROR ReadSingleClusterData(const Access::SubjectDescriptor & aSubjectDescr
102102
{
103103
ConcreteAttributePath path(aPath);
104104
// Use an incorrect attribute id for some of the responses.
105-
path.mAttributeId = path.mAttributeId + (i / 2) + (responseDirective == kSendManyDataResponsesWrongPath);
105+
path.mAttributeId =
106+
static_cast<AttributeId>(path.mAttributeId + (i / 2) + (responseDirective == kSendManyDataResponsesWrongPath));
106107
AttributeValueEncoder::AttributeEncodeState state =
107108
(apEncoderState == nullptr ? AttributeValueEncoder::AttributeEncodeState() : *apEncoderState);
108109
AttributeValueEncoder valueEncoder(aAttributeReports, aSubjectDescriptor.fabricIndex, path,

src/include/platform/internal/GenericConfigurationManagerImpl.ipp

+10-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include <lib/support/BytesToHex.h>
3636
#include <lib/support/CHIPMem.h>
3737
#include <lib/support/CodeUtils.h>
38+
#include <lib/support/SafeInt.h>
3839
#include <lib/support/ScopedBuffer.h>
3940
#include <platform/BuildTime.h>
4041
#include <platform/CommissionableDataProvider.h>
@@ -182,7 +183,10 @@ CHIP_ERROR LegacyTemporaryCommissionableDataProvider<ConfigClass>::GetSpake2pSal
182183
#endif // defined(CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_SALT)
183184

184185
ReturnErrorOnFailure(err);
185-
size_t saltLen = chip::Base64Decode32(saltB64, saltB64Len, reinterpret_cast<uint8_t *>(saltB64));
186+
187+
VerifyOrReturnError(chip::CanCastTo<uint32_t>(saltB64Len), CHIP_ERROR_INTERNAL);
188+
189+
size_t saltLen = chip::Base64Decode32(saltB64, static_cast<uint32_t>(saltB64Len), reinterpret_cast<uint8_t *>(saltB64));
186190

187191
ReturnErrorCodeIf(saltLen > saltBuf.size(), CHIP_ERROR_BUFFER_TOO_SMALL);
188192
memcpy(saltBuf.data(), saltB64, saltLen);
@@ -216,7 +220,11 @@ CHIP_ERROR LegacyTemporaryCommissionableDataProvider<ConfigClass>::GetSpake2pVer
216220
#endif // defined(CHIP_DEVICE_CONFIG_USE_TEST_SPAKE2P_VERIFIER)
217221

218222
ReturnErrorOnFailure(err);
219-
verifierLen = chip::Base64Decode32(verifierB64, verifierB64Len, reinterpret_cast<uint8_t *>(verifierB64));
223+
224+
VerifyOrReturnError(chip::CanCastTo<uint32_t>(verifierB64Len), CHIP_ERROR_INTERNAL);
225+
verifierLen =
226+
chip::Base64Decode32(verifierB64, static_cast<uint32_t>(verifierB64Len), reinterpret_cast<uint8_t *>(verifierB64));
227+
220228
ReturnErrorCodeIf(verifierLen > verifierBuf.size(), CHIP_ERROR_BUFFER_TOO_SMALL);
221229
memcpy(verifierBuf.data(), verifierB64, verifierLen);
222230
verifierBuf.reduce_size(verifierLen);

src/lib/shell/commands/Base64.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <lib/support/Base64.h>
3030
#include <lib/support/CHIPArgParser.hpp>
3131
#include <lib/support/CodeUtils.h>
32+
#include <lib/support/SafeInt.h>
3233

3334
chip::Shell::Engine sShellBase64Commands;
3435

@@ -63,7 +64,11 @@ static CHIP_ERROR Base64EncodeHandler(int argc, char ** argv)
6364
uint32_t binarySize, base64Size;
6465

6566
VerifyOrReturnError(argc > 0, CHIP_ERROR_INVALID_ARGUMENT);
66-
ArgParser::ParseHexString(argv[0], strlen(argv[0]), binary, sizeof(binary), binarySize);
67+
68+
size_t argLen = strlen(argv[0]);
69+
VerifyOrReturnError(CanCastTo<uint32_t>(argLen), CHIP_ERROR_INVALID_ARGUMENT);
70+
71+
ArgParser::ParseHexString(argv[0], static_cast<uint32_t>(argLen), binary, sizeof(binary), binarySize);
6772
base64Size = Base64Encode(binary, binarySize, base64);
6873
streamer_printf(sout, "%.*s\r\n", base64Size, base64);
6974
return CHIP_NO_ERROR;

src/platform/Darwin/SystemTimeSupport.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ CHIP_ERROR ClockImpl::SetClock_RealTime(Microseconds64 aNewCurTime)
8383
{
8484
struct timeval tv;
8585
tv.tv_sec = static_cast<time_t>(aNewCurTime.count() / UINT64_C(1000000));
86-
tv.tv_usec = static_cast<long>(aNewCurTime.count() % UINT64_C(1000000));
86+
tv.tv_usec = static_cast<__darwin_suseconds_t>(aNewCurTime.count() % UINT64_C(1000000));
8787
if (settimeofday(&tv, nullptr) != 0)
8888
{
8989
return (errno == EPERM) ? CHIP_ERROR_ACCESS_DENIED : CHIP_ERROR_POSIX(errno);

src/platform/android/AndroidConfig.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <lib/support/CHIPMemString.h>
3535
#include <lib/support/CodeUtils.h>
3636
#include <lib/support/JniTypeWrappers.h>
37+
#include <lib/support/SafeInt.h>
3738
#include <platform/android/AndroidConfig.h>
3839

3940
namespace chip {
@@ -372,13 +373,14 @@ CHIP_ERROR AndroidConfig::WriteConfigValueBin(Key key, const uint8_t * data, siz
372373
chip::DeviceLayer::StackUnlock unlock;
373374
ReturnErrorCodeIf(gAndroidConfigObject == nullptr, CHIP_ERROR_INCORRECT_STATE);
374375
ReturnErrorCodeIf(gWriteConfigValueBinMethod == nullptr, CHIP_ERROR_INCORRECT_STATE);
376+
VerifyOrReturnError(chip::CanCastTo<uint32_t>(dataLen), CHIP_ERROR_INVALID_ARGUMENT);
375377

376378
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
377379
ReturnErrorCodeIf(env == nullptr, CHIP_ERROR_INTERNAL);
378380

379381
UtfString space(env, key.Namespace);
380382
UtfString name(env, key.Name);
381-
ByteArray jval(env, reinterpret_cast<const jbyte *>(data), dataLen);
383+
ByteArray jval(env, reinterpret_cast<const jbyte *>(data), static_cast<uint32_t>(dataLen));
382384

383385
env->CallVoidMethod(gAndroidConfigObject, gWriteConfigValueBinMethod, space.jniValue(), name.jniValue(), jval.jniValue());
384386
if (env->ExceptionCheck())

src/platform/android/CHIPP256KeypairBridge.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "lib/support/CHIPJNIError.h"
2121
#include "lib/support/JniReferences.h"
2222
#include "lib/support/JniTypeWrappers.h"
23+
#include "lib/support/SafeInt.h"
2324

2425
#include <array>
2526
#include <cstdint>
@@ -115,12 +116,14 @@ CHIP_ERROR CHIPP256KeypairBridge::ECDSA_sign_msg(const uint8_t * msg, size_t msg
115116
return CHIP_ERROR_INCORRECT_STATE;
116117
}
117118

119+
VerifyOrReturnError(CanCastTo<uint32_t>(msg_length), CHIP_ERROR_INVALID_ARGUMENT);
120+
118121
CHIP_ERROR err = CHIP_NO_ERROR;
119122
jbyteArray jniMsg;
120123
jobject signedResult = nullptr;
121124
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
122125
VerifyOrReturnError(env != nullptr, err = CHIP_JNI_ERROR_NO_ENV);
123-
err = JniReferences::GetInstance().N2J_ByteArray(env, msg, msg_length, jniMsg);
126+
err = JniReferences::GetInstance().N2J_ByteArray(env, msg, static_cast<uint32_t>(msg_length), jniMsg);
124127
VerifyOrReturnError(err == CHIP_NO_ERROR, err);
125128
VerifyOrReturnError(jniMsg != nullptr, err);
126129

src/platform/android/CommissionableDataProviderImpl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ CHIP_ERROR CommissionableDataProviderImpl::Update(JNIEnv * env, jstring spake2pV
151151
mPaseIterationCount = spake2pIterationCount;
152152
if (havePasscode)
153153
{
154-
mSetupPasscode.SetValue(setupPasscode);
154+
mSetupPasscode.SetValue(static_cast<uint32_t>(setupPasscode));
155155
}
156156

157157
// Set to global CommissionableDataProvider once success first time

src/platform/android/DiagnosticDataProviderImpl.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface **
163163
{
164164
size_t len = env->GetArrayLength(jHardwareAddressObj);
165165
len = (len > kMaxHardwareAddrSize) ? kMaxHardwareAddrSize : len;
166-
env->GetByteArrayRegion(jHardwareAddressObj, 0, len, reinterpret_cast<jbyte *>(ifp->MacAddress));
166+
env->GetByteArrayRegion(jHardwareAddressObj, 0, static_cast<uint32_t>(len),
167+
reinterpret_cast<jbyte *>(ifp->MacAddress));
167168
ifp->hardwareAddress = ByteSpan(ifp->MacAddress, 6);
168169
}
169170

src/platform/android/DnssdImpl.cpp

+17-10
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ CHIP_ERROR ChipDnssdPublishService(const DnssdService * service, DnssdPublishCal
8888
{
8989
VerifyOrReturnError(service != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
9090
VerifyOrReturnError(sResolverObject != nullptr && sPublishMethod != nullptr, CHIP_ERROR_INCORRECT_STATE);
91+
VerifyOrReturnError(CanCastTo<uint32_t>(service->mTextEntrySize), CHIP_ERROR_INVALID_ARGUMENT);
92+
VerifyOrReturnError(CanCastTo<uint32_t>(service->mSubTypeSize), CHIP_ERROR_INVALID_ARGUMENT);
9193

9294
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
9395
UtfString jniName(env, service->mName);
@@ -98,23 +100,28 @@ CHIP_ERROR ChipDnssdPublishService(const DnssdService * service, DnssdPublishCal
98100
serviceType += (service->mProtocol == DnssdServiceProtocol::kDnssdProtocolUdp ? "_udp" : "_tcp");
99101
UtfString jniServiceType(env, serviceType.c_str());
100102

103+
auto textEntrySize = static_cast<uint32_t>(service->mTextEntrySize);
104+
101105
jclass stringClass = env->FindClass("java/lang/String");
102-
jobjectArray keys = env->NewObjectArray(service->mTextEntrySize, stringClass, nullptr);
106+
jobjectArray keys = env->NewObjectArray(textEntrySize, stringClass, nullptr);
103107

104108
jclass arrayElemType = env->FindClass("[B");
105-
jobjectArray datas = env->NewObjectArray(service->mTextEntrySize, arrayElemType, nullptr);
109+
jobjectArray datas = env->NewObjectArray(textEntrySize, arrayElemType, nullptr);
106110

107-
for (size_t i = 0; i < service->mTextEntrySize; i++)
111+
for (uint32_t i = 0; i < textEntrySize; i++)
108112
{
109113
UtfString jniKey(env, service->mTextEntries[i].mKey);
110114
env->SetObjectArrayElement(keys, i, jniKey.jniValue());
111115

112-
ByteArray jniData(env, (const jbyte *) service->mTextEntries[i].mData, service->mTextEntries[i].mDataSize);
116+
VerifyOrReturnError(CanCastTo<uint32_t>(service->mTextEntries[i].mDataSize), CHIP_ERROR_INVALID_ARGUMENT);
117+
auto dataSize = static_cast<uint32_t>(service->mTextEntries[i].mDataSize);
118+
ByteArray jniData(env, (const jbyte *) service->mTextEntries[i].mData, dataSize);
113119
env->SetObjectArrayElement(datas, i, jniData.jniValue());
114120
}
115121

116-
jobjectArray subTypes = env->NewObjectArray(service->mSubTypeSize, stringClass, nullptr);
117-
for (size_t i = 0; i < service->mSubTypeSize; i++)
122+
auto subTypeSize = static_cast<uint32_t>(service->mSubTypeSize);
123+
jobjectArray subTypes = env->NewObjectArray(subTypeSize, stringClass, nullptr);
124+
for (uint32_t i = 0; i < subTypeSize; i++)
118125
{
119126
UtfString jniSubType(env, service->mSubTypes[i]);
120127
env->SetObjectArrayElement(subTypes, i, jniSubType.jniValue());
@@ -316,13 +323,13 @@ void HandleResolve(jstring instanceName, jstring serviceType, jstring hostName,
316323
if (textEntries != nullptr)
317324
{
318325
jobjectArray keys = (jobjectArray) env->CallObjectMethod(sMdnsCallbackObject, sGetTextEntryKeysMethod, textEntries);
319-
size_t size = env->GetArrayLength(keys);
326+
auto size = env->GetArrayLength(keys);
320327
TextEntry * entries = new (std::nothrow) TextEntry[size];
321328
VerifyOrExit(entries != nullptr, ChipLogError(Discovery, "entries alloc failure"));
322329
memset(entries, 0, sizeof(entries[0]) * size);
323330

324331
service.mTextEntries = entries;
325-
for (size_t i = 0; i < size; i++)
332+
for (decltype(size) i = 0; i < size; i++)
326333
{
327334
jstring jniKeyObject = (jstring) env->GetObjectArrayElement(keys, i);
328335
JniUtfString key(env, jniKeyObject);
@@ -391,9 +398,9 @@ void HandleBrowse(jobjectArray instanceName, jstring serviceType, jlong callback
391398

392399
VerifyOrReturn(strlen(jniServiceType.c_str()) <= kDnssdTypeAndProtocolMaxSize, dispatch(CHIP_ERROR_INVALID_ARGUMENT));
393400

394-
size_t size = env->GetArrayLength(instanceName);
401+
auto size = env->GetArrayLength(instanceName);
395402
DnssdService * service = new DnssdService[size];
396-
for (size_t i = 0; i < size; i++)
403+
for (decltype(size) i = 0; i < size; i++)
397404
{
398405
JniUtfString jniInstanceName(env, (jstring) env->GetObjectArrayElement(instanceName, i));
399406
VerifyOrReturn(strlen(jniInstanceName.c_str()) <= Operational::kInstanceNameMaxLength,

src/setup_payload/java/SetupPayloadParser-JNI.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ void TransformSetupPayloadFromJobject(JNIEnv * env, jobject jPayload, SetupPaylo
288288
payload.productID = env->GetIntField(jPayload, productId);
289289
payload.commissioningFlow = static_cast<CommissioningFlow>(env->GetIntField(jPayload, commissioningFlow));
290290
payload.discriminator.SetLongValue(env->GetIntField(jPayload, discriminator));
291-
payload.setUpPINCode = env->GetLongField(jPayload, setUpPinCode);
291+
payload.setUpPINCode = static_cast<uint32_t>(env->GetLongField(jPayload, setUpPinCode));
292292

293293
jobject discoveryCapabilitiesObj = env->GetObjectField(jPayload, discoveryCapabilities);
294294
CreateCapabilitiesFromHashSet(env, discoveryCapabilitiesObj,

third_party/boringssl/repo/BUILD.gn

+7
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,20 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import("//build_overrides/build.gni")
16+
import("${build_root}/config/compiler/compiler.gni")
17+
1518
import("BUILD.generated.gni")
1619

1720
config("boringssl_config") {
1821
include_dirs = [ "src/include" ]
1922

2023
cflags = [ "-Wno-unused-variable" ]
2124

25+
if (is_clang) {
26+
cflags += [ "-Wno-shorten-64-to-32" ]
27+
}
28+
2229
# We want the basic crypto impl with no asm primitives until we hook-up platform-based
2330
# support to the build later.
2431
defines = [ "OPENSSL_NO_ASM=1" ]

third_party/editline/BUILD.gn

+7
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,15 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import("//build_overrides/build.gni")
16+
import("${build_root}/config/compiler/compiler.gni")
17+
1518
config("editline_config") {
1619
include_dirs = [ "repo/include" ]
20+
21+
if (is_clang) {
22+
cflags = [ "-Wno-shorten-64-to-32" ]
23+
}
1724
}
1825

1926
static_library("editline") {

third_party/mbedtls/mbedtls.gni

+7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
import("//build_overrides/mbedtls.gni")
1616

17+
import("//build_overrides/build.gni")
18+
import("${build_root}/config/compiler/compiler.gni")
19+
1720
template("mbedtls_target") {
1821
mbedtls_target_name = target_name
1922

@@ -26,6 +29,10 @@ template("mbedtls_target") {
2629
"-Wno-unused-but-set-parameter",
2730
"-Wno-format-nonliteral", # Because of mbedtls_debug_print_msg
2831
]
32+
33+
if (is_clang) {
34+
cflags += [ "-Wno-shorten-64-to-32" ]
35+
}
2936
}
3037

3138
config("${mbedtls_target_name}_config") {

0 commit comments

Comments
 (0)