Skip to content

Commit

Permalink
Address compiler warnings at code granularity rather than binary-wide (
Browse files Browse the repository at this point in the history
…#28)

* Re-enable warning 4996

* Fix 4634

* Newline

* Remove GLTFSDK Schema.h from includes as it is not used and results in multiply defined errors
  • Loading branch information
benbuzbee authored and robertos committed May 29, 2018
1 parent ee37a89 commit 21dd0d0
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 47 deletions.
4 changes: 1 addition & 3 deletions glTF-Toolkit/glTF-Toolkit.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
<AdditionalOptions>/permissive- %(AdditionalOptions)</AdditionalOptions>
<TreatWarningAsError>true</TreatWarningAsError>
<GenerateXMLDocumentationFiles>true</GenerateXMLDocumentationFiles>
<DisableSpecificWarnings>4634;4996</DisableSpecificWarnings>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<Optimization>MaxSpeed</Optimization>
Expand All @@ -124,13 +123,11 @@
<RuntimeLibrary Condition="'$(Configuration)'=='Debug Static Runtime'">MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
</ItemDefinitionGroup>

<ItemDefinitionGroup Condition="'$(Platform)'=='x86'">
<ClCompile>
<PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>

<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
Expand All @@ -139,6 +136,7 @@
<ClInclude Include="inc\DeviceResources.h" />
<ClInclude Include="inc\GLBtoGLTF.h" />
<ClInclude Include="inc\GLTFLODUtils.h" />
<ClInclude Include="inc\GLTFSDK.h" />
<ClInclude Include="inc\GLTFTextureCompressionUtils.h" />
<ClInclude Include="inc\GLTFTextureLoadingUtils.h" />
<ClInclude Include="inc\GLTFTexturePackingUtils.h" />
Expand Down
3 changes: 3 additions & 0 deletions glTF-Toolkit/glTF-Toolkit.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
<ClInclude Include="inc\AccessorUtils.h">
<Filter>inc</Filter>
</ClInclude>
<ClInclude Include="inc\GLTFSDK.h">
<Filter>inc</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\DeviceResources.cpp">
Expand Down
15 changes: 6 additions & 9 deletions glTF-Toolkit/inc/AccessorUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#pragma once

#include <GLTFSDK/GLTFDocument.h>
#include "GLTFSDK.h"
#include <functional>
#include <vector>

Expand All @@ -15,14 +15,11 @@ namespace Microsoft::glTF::Toolkit
class AccessorUtils
{
public:
/// <summary>
/// Calculates the min and max values for an accessor according to the glTF 2.0 specification.
/// <param name="accessor">The accessor definition for which the min and max values will be calculated.</param>
/// <param name="accessorContents">The raw data contained in the accessor.</param>
/// <returns>
/// A pair containing the min and max vectors for the accessor, in that order.
/// </returns>
/// </summary>
// Note: XML Documentation cannot be applied to templated types per https://docs.microsoft.com/en-us/cpp/ide/xml-documentation-visual-cpp
// Calculates the min and max values for an accessor according to the glTF 2.0 specification.
// accessor is: The accessor definition for which the min and max values will be calculated.</param>
// accessorContents is: The raw data contained in the accessor.
// returns: A pair containing the min and max vectors for the accessor, in that order.
template <typename T>
static std::pair<std::vector<float>, std::vector<float>> CalculateMinMax(const Accessor& accessor, const std::vector<T>& accessorContents)
{
Expand Down
5 changes: 1 addition & 4 deletions glTF-Toolkit/inc/GLBtoGLTF.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@

#pragma once

#include <GLTFSDK/Deserialize.h>
#include <GLTFSDK/Serialize.h>
#include <GLTFSDK/GLTFResourceWriter.h>
#include <GLTFSDK/GLBResourceReader.h>
#include "GLTFSDK.h"

namespace Microsoft::glTF::Toolkit
{
Expand Down
2 changes: 1 addition & 1 deletion glTF-Toolkit/inc/GLTFLODUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#pragma once

#include <GLTFSDK/GLTFDocument.h>
#include "GLTFSDK.h"

namespace Microsoft::glTF::Toolkit
{
Expand Down
22 changes: 22 additions & 0 deletions glTF-Toolkit/inc/GLTFSDK.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

#pragma once

#pragma warning(push)
#pragma warning(disable : 4634)
#pragma warning(disable : 4996)

#include <GLTFSDK/GLTFDocument.h>
#include <GLTFSDK/Deserialize.h>
#include <GLTFSDK/Serialize.h>
#include <GLTFSDK/GLTFResourceWriter.h>
#include <GLTFSDK/GLBResourceReader.h>
#include <GLTFSDK/GLTFResourceReader.h>
#include <GLTFSDK/IStreamReader.h>
#include <GLTFSDK/IStreamFactory.h>
#include <GLTFSDK/RapidJsonUtils.h>
#include <GLTFSDK/GLTF.h>
#include <GLTFSDK/GLTFConstants.h>

#pragma warning(pop)
3 changes: 1 addition & 2 deletions glTF-Toolkit/inc/GLTFTextureCompressionUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

#pragma once

#include <GLTFSDK/GLTFDocument.h>
#include <GLTFSDK/IStreamReader.h>
#include "GLTFSDK.h"

namespace DirectX
{
Expand Down
3 changes: 1 addition & 2 deletions glTF-Toolkit/inc/GLTFTextureLoadingUtils.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.#pragma once

#include <GLTFSDK/GLTFDocument.h>
#include <GLTFSDK/IStreamReader.h>
#include "GLTFSDK.h"
#include <DirectXTex.h>

namespace Microsoft::glTF::Toolkit
Expand Down
3 changes: 1 addition & 2 deletions glTF-Toolkit/inc/GLTFTexturePackingUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

#pragma once

#include <GLTFSDK/GLTFDocument.h>
#include <GLTFSDK/IStreamReader.h>
#include "GLTFSDK.h"

namespace Microsoft::glTF::Toolkit
{
Expand Down
7 changes: 2 additions & 5 deletions glTF-Toolkit/inc/SerializeBinary.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.#pragma once

#include <GLTFSDK/GLTFDocument.h>
#include <GLTFSDK/GLTFResourceReader.h>
#include <GLTFSDK/IStreamFactory.h>
#include <GLTFSDK/IStreamReader.h>
#include <GLTFSDK/RapidJsonUtils.h>
#include "GLTFSDK.h"

#include <functional>
#include <memory>
#include <vector>
Expand Down
13 changes: 9 additions & 4 deletions glTF-Toolkit/inc/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,19 @@
#include <DirectXMath.h>
#include <DirectXColors.h>

// Silence C4996 for CodeCVT deprecations. CodeCVT is still used for UTF8 conversions in GLTFLODUtils.cpp
// TODO: Remove
#define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
#include <string>
#undef _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING

#include <algorithm>
#include <exception>
#include <memory>
#include <stdexcept>
#include <fstream>
#include <iostream>
#include <sstream>
#include <memory>
#include <set>
#include <string>
#include <sstream>
#include <stdexcept>

#include <stdio.h>
6 changes: 0 additions & 6 deletions glTF-Toolkit/src/GLTFTextureCompressionUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@
#include "GLTFTextureCompressionUtils.h"
#include "DeviceResources.h"

#include <GLTFSDK/GLTF.h>
#include <GLTFSDK/GLTFConstants.h>
#include <GLTFSDK/Deserialize.h>
#include <GLTFSDK/RapidJsonUtils.h>
#include <GLTFSDK/Schema.h>

// Usings for ComPtr
using namespace ABI::Windows::Foundation;
using namespace Microsoft::WRL;
Expand Down
3 changes: 0 additions & 3 deletions glTF-Toolkit/src/GLTFTextureLoadingUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

#include "pch.h"

#include <GLTFSDK/GLTF.h>
#include <GLTFSDK/GLTFResourceReader.h>

#include "GLTFTextureLoadingUtils.h"

using namespace Microsoft::glTF;
Expand Down
6 changes: 0 additions & 6 deletions glTF-Toolkit/src/GLTFTexturePackingUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@

#include <DirectXTex.h>

#include <GLTFSDK/GLTF.h>
#include <GLTFSDK/GLTFConstants.h>
#include <GLTFSDK/GLTFResourceReader.h>
#include <GLTFSDK/IStreamReader.h>
#include <GLTFSDK/RapidJsonUtils.h>

#include "GLTFTextureLoadingUtils.h"
#include "GLTFTexturePackingUtils.h"

Expand Down

0 comments on commit 21dd0d0

Please sign in to comment.