Skip to content

Commit

Permalink
enable warnings as errors
Browse files Browse the repository at this point in the history
  • Loading branch information
HifiExperiments committed Jan 20, 2025
1 parent a7805e7 commit 6ff5e17
Show file tree
Hide file tree
Showing 37 changed files with 89 additions and 85 deletions.
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ if(NOT DEFINED OVERTE_WARNINGS_ALLOWLIST)
endif()

if(NOT DEFINED OVERTE_WARNINGS_AS_ERRORS)
set(OVERTE_WARNINGS_AS_ERRORS false CACHE BOOL "Count warnings as errors")
set(OVERTE_WARNINGS_AS_ERRORS true CACHE BOOL "Count warnings as errors")
endif()

if(OVERTE_WARNINGS_ALLOWLIST)
Expand Down Expand Up @@ -188,8 +188,10 @@ if(OVERTE_WARNINGS_AS_ERRORS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
set(CMAKE_CFLAGS "${CMAKE_CFLAGS} /WX")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
set(CMAKE_CFLAGS "${CMAKE_CFLAGS} -Werror")
# Silence multichar to work around an issue in crashpad
# Silence stringop-overflow to work around an issue in tbb
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-multichar -Wno-stringop-overflow")
set(CMAKE_CFLAGS "${CMAKE_CFLAGS} -Werror -Wno-multichar -Wno-stringop-overflow")
endif()
endif()

Expand Down
3 changes: 2 additions & 1 deletion assignment-client/src/audio/AudioMixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,8 @@ void updateAudioZone(EntityItem* entity, std::unordered_map<QString, AudioMixer:
audioZone.listeners.push_back(listener.toString());
}

audioZone.coefficients = audioSettings.getListenerAttenuationCoefficients().toStdVector();
const auto& listenerAttenuationCoefficients = audioSettings.getListenerAttenuationCoefficients();
audioZone.coefficients = std::vector<float>(listenerAttenuationCoefficients.begin(), listenerAttenuationCoefficients.end());

/*qCDebug(audio) << "Updated audio zone:" << entity->getID().toString() << "(position:" << t.getTranslation()
<< ", dimensions:" << t.getScale() << ")";*/
Expand Down
6 changes: 1 addition & 5 deletions assignment-client/src/audio/AudioMixerClientData.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,13 @@

#include <queue>

#if !defined(Q_MOC_RUN)
// Work around https://bugreports.qt.io/browse/QTBUG-80990
#include <tbb/concurrent_vector.h>
#endif

#include <QtCore/QJsonObject>
#include <QtCore/QSharedPointer>

#include <AABox.h>
#include <AudioHRTF.h>
#include <AudioLimiter.h>
#include <TBBHelpers.h>
#include <UUIDHasher.h>

#include <plugins/Forward.h>
Expand Down
2 changes: 1 addition & 1 deletion assignment-client/src/audio/AudioMixerWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ float computeGain(float primaryAvatarGain,
float attenuationPerDoublingInDistance = AudioMixer::getAttenuationPerDoublingInDistance();

float bestZonesVolume = FLT_MAX;
float bestZonesCoefficient;
float bestZonesCoefficient = attenuationPerDoublingInDistance;
for (const auto& sourceZone : audioZones) {
if (sourceZone.second.listeners.size() > 0 && sourceZone.second.listeners.size() == sourceZone.second.coefficients.size()) {
vec4 localSourcePosition = sourceZone.second.inverseTransform * vec4(streamToAdd.getPosition(), 1.0f);
Expand Down
6 changes: 1 addition & 5 deletions assignment-client/src/audio/AudioMixerWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,14 @@
#ifndef hifi_AudioMixerWorker_h
#define hifi_AudioMixerWorker_h

#if !defined(Q_MOC_RUN)
// Work around https://bugreports.qt.io/browse/QTBUG-80990
#include <tbb/concurrent_vector.h>
#endif

#include <AABox.h>
#include <AudioHRTF.h>
#include <AudioRingBuffer.h>
#include <ThreadedAssignment.h>
#include <UUIDHasher.h>
#include <NodeList.h>
#include <PositionalAudioStream.h>
#include <TBBHelpers.h>

#include "AudioMixerClientData.h"
#include "AudioMixerStats.h"
Expand Down
2 changes: 2 additions & 0 deletions cmake/compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ if (WIN32)
# always produce symbols as PDB files
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG /OPT:REF /OPT:ICF")
# Enable unwind semantics for C++ exception handlers
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fno-strict-aliasing -Wno-unused-parameter")
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
Expand Down
2 changes: 1 addition & 1 deletion domain-server/src/DomainGatekeeper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ bool DomainGatekeeper::verifyUserSignature(const QString& username,
RSA_free(rsaPublicKey);
}

OVERTE_IGNORE_DEPRECATED_END
OVERTE_IGNORE_WARNING_END

} else {

Expand Down
3 changes: 2 additions & 1 deletion domain-server/src/DomainServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3806,8 +3806,9 @@ void DomainServer::handleOctreeFileReplacementRequest(QSharedPointer<ReceivedMes
}

void DomainServer::processAvatarZonePresencePacket(QSharedPointer<ReceivedMessage> message) {
// FIXME: this, and PacketType::AvatarZonePresence in general, appear to be unused/unimplemented
QUuid avatarID = QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID));
QUuid zoneID = QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID));
//QUuid zoneID = QUuid::fromRfc4122(message->readWithoutCopy(NUM_BYTES_RFC4122_UUID));

if (avatarID.isNull()) {
qCWarning(domain_server) << "Ignoring null avatar presence";
Expand Down
2 changes: 1 addition & 1 deletion domain-server/src/DomainServerNodeData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void DomainServerNodeData::updateJSONStats(QByteArray statsByteArray) {
auto document = QJsonDocument::fromBinaryData(statsByteArray);
Q_ASSERT(document.isObject());
_statsJSONObject = overrideValuesIfNeeded(document.object());
OVERTE_IGNORE_DEPRECATED_END
OVERTE_IGNORE_WARNING_END
}

QJsonObject DomainServerNodeData::overrideValuesIfNeeded(const QJsonObject& newStats) {
Expand Down
4 changes: 2 additions & 2 deletions ice-server/src/IceServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ bool IceServer::isVerifiedHeartbeat(const QUuid& domainID, const QByteArray& pla
signature.size(),
rsaPublicKey);

OVERTE_IGNORE_DEPRECATED_END
OVERTE_IGNORE_WARNING_END
if (verificationResult == 1) {
// this is the only success case - we return true here to indicate that the heartbeat is verified
return true;
Expand Down Expand Up @@ -328,7 +328,7 @@ void IceServer::publicKeyReplyFinished(QNetworkReply* reply) {
qWarning() << "Could not convert in-memory public key for" << domainID << "to usable RSA public key.";
qWarning() << "Public key will be re-requested on next heartbeat.";
}
OVERTE_IGNORE_DEPRECATED_END
OVERTE_IGNORE_WARNING_END

} else {
qWarning() << "There was no public key present in response for domain with ID" << domainID;
Expand Down
2 changes: 1 addition & 1 deletion interface/src/AvatarBookmarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void AvatarBookmarks::updateAvatarEntities(const QVariantList &avatarEntities) {
OVERTE_IGNORE_DEPRECATED_BEGIN
// We're not transitioning to CBOR yet, since it'd break the protocol.
myAvatar->updateAvatarEntity(id, QJsonDocument::fromVariant(propertiesItr.value()).toBinaryData());
OVERTE_IGNORE_DEPRECATED_END
OVERTE_IGNORE_WARNING_END
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion interface/src/avatar/AvatarPackager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ AvatarPackager::AvatarPackager() {

qmlRegisterType<FST>();

OVERTE_IGNORE_DEPRECATED_END
OVERTE_IGNORE_WARNING_END

qRegisterMetaType<AvatarPackager*>();
qRegisterMetaType<AvatarProject*>();
Expand Down
2 changes: 1 addition & 1 deletion interface/src/avatar/MyAvatar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2041,7 +2041,7 @@ void MyAvatar::updateAvatarEntity(const QUuid& entityID, const QByteArray& entit
OVERTE_IGNORE_DEPRECATED_BEGIN
// We're not transitioning to CBOR yet, since it'd break the protocol.
auto data = QJsonDocument::fromBinaryData(entityData);
OVERTE_IGNORE_DEPRECATED_END
OVERTE_IGNORE_WARNING_END
if (data.isEmpty() || data.isNull() || !data.isObject() || data.object().isEmpty()) {
qDebug() << "ERROR! Trying to update with invalid avatar entity data. Skipping." << data;
} else {
Expand Down
2 changes: 1 addition & 1 deletion interface/src/raypick/PickScriptingInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ std::shared_ptr<PickQuery> PickScriptingInterface::buildRayPick(const QVariantMa
if (propMap["delay"].isValid()) {
// We want to be within 0.1% of the target in <delay> seconds
// https://twitter.com/FreyaHolmer/status/1757836988495847568
delayHalf = -std::max(propMap["delay"].toFloat(), 0.0f) / log2(0.001);
delayHalf = -std::max(propMap["delay"].toFloat(), 0.0f) / log2(0.001f);
}

auto rayPick = std::make_shared<RayPick>(position, direction, filter, maxDistance, delayHalf, enabled);
Expand Down
2 changes: 1 addition & 1 deletion interface/src/raypick/RayPick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void RayPick::setDelay(float delay) {
withWriteLock([&] {
// We want to be within 0.1% of the target in <delay> seconds
// https://twitter.com/FreyaHolmer/status/1757836988495847568
_delayHalf = -std::max(delay, 0.0f) / log2(0.001);
_delayHalf = -std::max(delay, 0.0f) / log2(0.001f);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void AssetMappingsScriptingInterface::getAllMappings(QJSValue callback) {
OVERTE_IGNORE_DEPRECATED_BEGIN
// Still using QScriptEngine
auto map = callback.engine()->newObject();
OVERTE_IGNORE_DEPRECATED_END
OVERTE_IGNORE_WARNING_END

for (auto& kv : mappings ) {
map.setProperty(kv.first, kv.second.hash);
Expand Down
6 changes: 3 additions & 3 deletions interface/src/scripting/TTSScriptingInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "avatar/AvatarManager.h"

TTSScriptingInterface::TTSScriptingInterface() {
#ifdef WIN32
#ifdef _WIN32
//
// Create text to speech engine
//
Expand Down Expand Up @@ -46,7 +46,7 @@ TTSScriptingInterface::TTSScriptingInterface() {
TTSScriptingInterface::~TTSScriptingInterface() {
}

#ifdef WIN32
#ifdef _WIN32
class ReleaseOnExit {
public:
ReleaseOnExit(IUnknown* p) : m_p(p) {}
Expand All @@ -72,7 +72,7 @@ void TTSScriptingInterface::updateLastSoundAudioInjector() {
}

void TTSScriptingInterface::speakText(const QString& textToSpeak) {
#ifdef WIN32
#ifdef _WIN32
WAVEFORMATEX fmt;
fmt.wFormatTag = WAVE_FORMAT_PCM;
fmt.nSamplesPerSec = AudioConstants::SAMPLE_RATE;
Expand Down
4 changes: 2 additions & 2 deletions interface/src/scripting/TTSScriptingInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <QtCore/QObject>
#include <QTimer>
#include <DependencyManager.h>
#ifdef WIN32
#ifdef _WIN32
#pragma warning(disable : 4996)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
Expand All @@ -36,7 +36,7 @@ class TTSScriptingInterface : public QObject, public Dependency {
Q_INVOKABLE void stopLastSpeech();

private:
#ifdef WIN32
#ifdef _WIN32
class CComAutoInit {
public:
// Initializes COM using CoInitialize.
Expand Down
8 changes: 4 additions & 4 deletions libraries/avatars/src/AvatarData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2651,14 +2651,14 @@ QByteArray AvatarData::toFrame(const AvatarData& avatar) {
OVERTE_IGNORE_DEPRECATED_BEGIN
// Can't use CBOR yet, would break the protocol
return QJsonDocument(root).toBinaryData();
OVERTE_IGNORE_DEPRECATED_END
OVERTE_IGNORE_WARNING_END
}


void AvatarData::fromFrame(const QByteArray& frameData, AvatarData& result, bool useFrameSkeleton) {
OVERTE_IGNORE_DEPRECATED_BEGIN
QJsonDocument doc = QJsonDocument::fromBinaryData(frameData);
OVERTE_IGNORE_DEPRECATED_END
OVERTE_IGNORE_WARNING_END

#ifdef WANT_JSON_DEBUG
{
Expand Down Expand Up @@ -2920,7 +2920,7 @@ ScriptValue AvatarEntityMapToScriptValue(ScriptEngine* engine, const AvatarEntit
QByteArray entityProperties = value.value(entityID);
OVERTE_IGNORE_DEPRECATED_BEGIN
QJsonDocument jsonEntityProperties = QJsonDocument::fromBinaryData(entityProperties);
OVERTE_IGNORE_DEPRECATED_END
OVERTE_IGNORE_WARNING_END
if (!jsonEntityProperties.isObject()) {
qCDebug(avatars) << "bad AvatarEntityData in AvatarEntityMap" << QString(entityProperties.toHex());
}
Expand All @@ -2946,7 +2946,7 @@ bool AvatarEntityMapFromScriptValue(const ScriptValue& object, AvatarEntityMap&
QJsonDocument jsonEntityProperties = QJsonDocument::fromVariant(variantEntityProperties);
OVERTE_IGNORE_DEPRECATED_BEGIN
QByteArray binaryEntityProperties = jsonEntityProperties.toBinaryData();
OVERTE_IGNORE_DEPRECATED_END
OVERTE_IGNORE_WARNING_END
value[EntityID] = binaryEntityProperties;
}
return true;
Expand Down
4 changes: 2 additions & 2 deletions libraries/entities/src/EntityItemProperties.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ bool EntityItemProperties::blobToProperties(ScriptEngine& scriptEngine, const QB
// begin recipe for converting unfortunately-formatted-binary-blob to EntityItemProperties
OVERTE_IGNORE_DEPRECATED_BEGIN
QJsonDocument jsonProperties = QJsonDocument::fromBinaryData(blob);
OVERTE_IGNORE_DEPRECATED_END
OVERTE_IGNORE_WARNING_END
if (jsonProperties.isEmpty() || jsonProperties.isNull() || !jsonProperties.isObject() || jsonProperties.object().isEmpty()) {
qCDebug(entities) << "bad avatarEntityData json" << QString(blob.toHex());
return false;
Expand Down Expand Up @@ -1434,7 +1434,7 @@ void EntityItemProperties::propertiesToBlob(ScriptEngine& scriptEngine, const QU
jsonProperties = QJsonDocument(jsonObject);
OVERTE_IGNORE_DEPRECATED_BEGIN
blob = jsonProperties.toBinaryData();
OVERTE_IGNORE_DEPRECATED_END
OVERTE_IGNORE_WARNING_END
// end recipe
}

Expand Down
8 changes: 4 additions & 4 deletions libraries/entities/src/ModelEntityItem.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,16 @@ protected:
ReadWriteLockable _jointDataLock;

bool _jointRotationsExplicitlySet { false }; // were the joints set as a property or just side effect of animations
bool _jointTranslationsExplicitlySet{ false }; // were the joints set as a property or just side effect of animations
bool _jointTranslationsExplicitlySet { false }; // were the joints set as a property or just side effect of animations

QVariantMap _blendshapeCoefficientsMap;

private:
uint64_t _lastAnimated { 0 };
float _currentFrame { -1.0f };

QVector<float> _blendshapeCoefficientsVector;
bool _blendshapesChanged { false };

uint64_t _lastAnimated { 0 };
float _currentFrame { -1.0f };
};

#endif // hifi_ModelEntityItem_h
2 changes: 1 addition & 1 deletion libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ void GLBackend::do_setContextMirrorViewCorrection(const Batch& batch, size_t par
bool prevMirrorViewCorrection = _transform._mirrorViewCorrection;
_transform._mirrorViewCorrection = batch._params[paramOffset]._uint != 0;

if (_transform._correction.correction != glm::mat4()) {
if (prevMirrorViewCorrection != _transform._mirrorViewCorrection && _transform._correction.correction != glm::mat4()) {
setCameraCorrection(_transform._mirrorViewCorrection ? _transform._flippedCorrection : _transform._unflippedCorrection, _transform._correction.prevView, false);
_transform._invalidView = true;
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/networking/src/DataServerAccountInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ QByteArray DataServerAccountInfo::signPlaintext(const QByteArray& plaintext) {
}
}
return QByteArray();
OVERTE_IGNORE_DEPRECATED_END
OVERTE_IGNORE_WARNING_END
}

QDataStream& operator<<(QDataStream &out, const DataServerAccountInfo& info) {
Expand Down
2 changes: 1 addition & 1 deletion libraries/networking/src/HMACAuth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,5 @@ bool HMACAuth::calculateHash(HMACHash& hashResult, const char* data, int dataLen
return true;
}

OVERTE_IGNORE_DEPRECATED_END
OVERTE_IGNORE_WARNING_END

2 changes: 1 addition & 1 deletion libraries/networking/src/NodeList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ qint64 NodeList::sendStats(QJsonObject statsObject, SockAddr destination) {
OVERTE_IGNORE_DEPRECATED_BEGIN
// Can't use CBOR yet, will break protocol.
statsPacketList->write(jsonDocument.toBinaryData());
OVERTE_IGNORE_DEPRECATED_END
OVERTE_IGNORE_WARNING_END

sendPacketList(std::move(statsPacketList), destination);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion libraries/networking/src/RSAKeypairGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,5 @@ void RSAKeypairGenerator::generateKeypair() {
emit generatedKeypair(_publicKey, _privateKey);
}

OVERTE_IGNORE_DEPRECATED_END
OVERTE_IGNORE_WARNING_END

2 changes: 1 addition & 1 deletion libraries/networking/src/SockAddr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include "NetworkLogging.h"

#ifdef WIN32
#ifdef _WIN32
#include <winsock2.h>
#include <WS2tcpip.h>
#else
Expand Down
Loading

0 comments on commit 6ff5e17

Please sign in to comment.