From d41bc53c165e927422f14a35fa8678b71a00000d Mon Sep 17 00:00:00 2001 From: Steve M Date: Thu, 11 Jul 2024 17:48:56 -0700 Subject: [PATCH] Add UNUSED() macro (cherry picked from commit d89fe8f034c353cc5cc5b3ac78cd8845e006de38) --- code/AssetLib/USD/USDLoader.cpp | 2 + code/AssetLib/USD/USDLoaderImplTinyusdz.cpp | 8 +++- code/AssetLib/USD/USDPreprocessor.h | 50 +++++++++++++++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 code/AssetLib/USD/USDPreprocessor.h diff --git a/code/AssetLib/USD/USDLoader.cpp b/code/AssetLib/USD/USDLoader.cpp index 135243a89..c4669f57f 100644 --- a/code/AssetLib/USD/USDLoader.cpp +++ b/code/AssetLib/USD/USDLoader.cpp @@ -62,6 +62,7 @@ Copyright (c) 2006-2024, assimp team #include "USDLoader.h" #include "USDLoaderUtil.h" +#include "USDPreprocessor.h" static constexpr aiImporterDesc desc = { "USD Object Importer", @@ -87,6 +88,7 @@ USDImporter::USDImporter() : // ------------------------------------------------------------------------------------------------ bool USDImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const { + UNUSED(checkSig); // Based on token static const uint32_t usdcTokens[] = { AI_MAKE_MAGIC("PXR-USDC") }; bool canRead = CheckMagicToken(pIOHandler, pFile, usdcTokens, AI_COUNT_OF(usdcTokens)); diff --git a/code/AssetLib/USD/USDLoaderImplTinyusdz.cpp b/code/AssetLib/USD/USDLoaderImplTinyusdz.cpp index a3551fca2..4419d3a88 100644 --- a/code/AssetLib/USD/USDLoaderImplTinyusdz.cpp +++ b/code/AssetLib/USD/USDLoaderImplTinyusdz.cpp @@ -67,6 +67,7 @@ Copyright (c) 2006-2024, assimp team #include "USDLoaderImplTinyusdzHelper.h" #include "USDLoaderImplTinyusdz.h" #include "USDLoaderUtil.h" +#include "USDPreprocessor.h" #include "../../../contrib/tinyusdz/assimp_tinyusdz_logging.inc" @@ -81,11 +82,12 @@ void USDImporterImplTinyusdz::InternReadFile( const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) { + UNUSED(pIOHandler); + UNUSED(TAG); // Ignore unused variable when -Werror enabled // Grab filename for logging purposes size_t pos = pFile.find_last_of('/'); string basePath = pFile.substr(0, pos); string nameWExt = pFile.substr(pos + 1); - (void) TAG; // Ignore unused variable when -Werror enabled stringstream ss; ss.str(""); ss << "InternReadFile(): model" << nameWExt; @@ -246,6 +248,7 @@ void USDImporterImplTinyusdz::verticesForMesh( aiScene *pScene, size_t meshIdx, const std::string &nameWExt) { + UNUSED(nameWExt); pScene->mMeshes[meshIdx]->mNumVertices = render_scene.meshes[meshIdx].points.size(); pScene->mMeshes[meshIdx]->mVertices = new aiVector3D[pScene->mMeshes[meshIdx]->mNumVertices]; for (size_t j = 0; j < pScene->mMeshes[meshIdx]->mNumVertices; ++j) { @@ -260,6 +263,7 @@ void USDImporterImplTinyusdz::facesForMesh( aiScene *pScene, size_t meshIdx, const std::string &nameWExt) { + UNUSED(nameWExt); pScene->mMeshes[meshIdx]->mNumFaces = render_scene.meshes[meshIdx].faceVertexCounts().size(); pScene->mMeshes[meshIdx]->mFaces = new aiFace[pScene->mMeshes[meshIdx]->mNumFaces](); size_t faceVertIdxOffset = 0; @@ -279,6 +283,7 @@ void USDImporterImplTinyusdz::normalsForMesh( aiScene *pScene, size_t meshIdx, const std::string &nameWExt) { + UNUSED(nameWExt); pScene->mMeshes[meshIdx]->mNormals = new aiVector3D[pScene->mMeshes[meshIdx]->mNumVertices]; const float *floatPtr = reinterpret_cast(render_scene.meshes[meshIdx].normals.get_data().data()); for (size_t vertIdx = 0, fpj = 0; vertIdx < pScene->mMeshes[meshIdx]->mNumVertices; ++vertIdx, fpj += 3) { @@ -293,6 +298,7 @@ void USDImporterImplTinyusdz::materialsForMesh( aiScene *pScene, size_t meshIdx, const std::string &nameWExt) { + UNUSED(render_scene); UNUSED(pScene); UNUSED(meshIdx); UNUSED(nameWExt); } void USDImporterImplTinyusdz::uvsForMesh( diff --git a/code/AssetLib/USD/USDPreprocessor.h b/code/AssetLib/USD/USDPreprocessor.h new file mode 100644 index 000000000..11dc79c17 --- /dev/null +++ b/code/AssetLib/USD/USDPreprocessor.h @@ -0,0 +1,50 @@ +/* +Open Asset Import Library (assimp) +---------------------------------------------------------------------- + +Copyright (c) 2006-2024, assimp team + + All rights reserved. + + Redistribution and use of this software in source and binary forms, + with or without modification, are permitted provided that the + following conditions are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the + following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the + following disclaimer in the documentation and/or other + materials provided with the distribution. + + * Neither the name of the assimp team, nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior + written permission of the assimp team. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ---------------------------------------------------------------------- + */ + +/** @file USDLoader.h + * @brief Declaration of the USD importer class. + */ +#pragma once +#ifndef AI_USDPREPROCESSOR_H_INCLUDED +#define AI_USDPREPROCESSOR_H_INCLUDED + +#define UNUSED(x) void(x) + +#endif // AI_USDPREPROCESSOR_H_INCLUDED