Skip to content

Commit

Permalink
build with C++17
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Smith committed Jul 18, 2023
1 parent 750a4f6 commit 0a8d8ad
Show file tree
Hide file tree
Showing 27 changed files with 106 additions and 37 deletions.
7 changes: 6 additions & 1 deletion UnitTest/UnitTest.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -86,11 +89,13 @@
<UseFullPaths>true</UseFullPaths>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<ControlFlowGuard>Guard</ControlFlowGuard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down
1 change: 1 addition & 0 deletions UnitTest/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#define NOMINMAX
#pragma warning(push)
#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception.
#pragma warning(disable: 5105) // macro expansion producing '...' has undefined behavior
#include <windows.h>
#pragma warning(pop)
#pragma comment(lib, "ws2_32")
Expand Down
6 changes: 6 additions & 0 deletions modules/c++/nitf-c++.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@
<TreatWarningAsError>true</TreatWarningAsError>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>
Expand Down Expand Up @@ -263,6 +266,9 @@
<WarningLevel>Level3</WarningLevel>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>
Expand Down
1 change: 1 addition & 0 deletions modules/c++/nitf/apps/show_nitf++/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#pragma warning(disable: 5204) // '...': class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly
#pragma warning(disable: 5220) // '...': a non-static data member with a volatile qualified type no longer implies
#pragma warning(disable: 4355) // '...': used in base member initializer list
#pragma warning(disable: 5105) // macro expansion producing '...' has undefined behavior

#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
Expand Down
6 changes: 6 additions & 0 deletions modules/c++/nitf/apps/show_nitf++/show_nitf++.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<TreatWarningAsError>true</TreatWarningAsError>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand All @@ -91,6 +94,9 @@
<WarningLevel>Level3</WarningLevel>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand Down
1 change: 1 addition & 0 deletions modules/c++/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ CODA_OSS_disable_warning_pop
#define NOMINMAX
#pragma warning(push)
#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception.
#pragma warning(disable: 5105) // macro expansion producing '...' has undefined behavior
#include <windows.h>
#pragma warning(pop)

Expand Down
3 changes: 3 additions & 0 deletions modules/c/j2k/J2KCompress.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<TreatWarningAsError>true</TreatWarningAsError>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>
Expand Down
3 changes: 3 additions & 0 deletions modules/c/j2k/J2KDecompress.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<TreatWarningAsError>true</TreatWarningAsError>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>
Expand Down
13 changes: 2 additions & 11 deletions modules/c/j2k/shared/J2KCompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,14 @@
*
*/

#include <import/nitf.h>

#ifdef HAVE_J2K_H

#if _MSC_VER
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#endif
#pragma warning(push)
#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to '...'
#include <windows.h>
#pragma warning(pop)
#undef min
#undef max

#pragma warning(disable: 5045) // Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
#endif // _MSC_VER

#include <import/nitf.h>
#include <import/j2k.h>

NITF_CXX_GUARD
Expand Down
13 changes: 2 additions & 11 deletions modules/c/j2k/shared/J2KDecompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,14 @@
*
*/

#include <import/nitf.h>

#ifdef HAVE_J2K_H

#if _MSC_VER
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#endif
#pragma warning(push)
#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to '...'
#include <windows.h>
#pragma warning(pop)
#undef min
#undef max

#pragma warning(disable: 5045) // Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
#endif // _MSC_VER

#include <import/nitf.h>
#include <import/j2k.h>

NITF_CXX_GUARD
Expand Down
6 changes: 6 additions & 0 deletions modules/c/nitf-c.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
<TreatWarningAsError>true</TreatWarningAsError>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>
Expand Down Expand Up @@ -96,6 +99,9 @@
<CompileAs>CompileAsCpp</CompileAs>
<ExceptionHandling>false</ExceptionHandling>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>
Expand Down
3 changes: 3 additions & 0 deletions modules/c/nitf/ACCHZB.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<TreatWarningAsError>true</TreatWarningAsError>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>
Expand Down
3 changes: 3 additions & 0 deletions modules/c/nitf/ACCPOB.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<TreatWarningAsError>true</TreatWarningAsError>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>
Expand Down
3 changes: 3 additions & 0 deletions modules/c/nitf/ACFTA.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<TreatWarningAsError>true</TreatWarningAsError>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>
Expand Down
3 changes: 3 additions & 0 deletions modules/c/nitf/AIMIDB.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<TreatWarningAsError>true</TreatWarningAsError>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>
Expand Down
3 changes: 3 additions & 0 deletions modules/c/nitf/CSCRNA.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<TreatWarningAsError>true</TreatWarningAsError>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>
Expand Down
3 changes: 3 additions & 0 deletions modules/c/nitf/CSEXRB.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<TreatWarningAsError>true</TreatWarningAsError>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>
Expand Down
3 changes: 3 additions & 0 deletions modules/c/nitf/ENGRDA.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<TreatWarningAsError>true</TreatWarningAsError>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>
Expand Down
3 changes: 3 additions & 0 deletions modules/c/nitf/HISTOA.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<TreatWarningAsError>true</TreatWarningAsError>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>
Expand Down
3 changes: 3 additions & 0 deletions modules/c/nitf/JITCID.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<TreatWarningAsError>true</TreatWarningAsError>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>
Expand Down
3 changes: 3 additions & 0 deletions modules/c/nitf/PTPRAA.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<TreatWarningAsError>true</TreatWarningAsError>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>
Expand Down
3 changes: 3 additions & 0 deletions modules/c/nitf/RPFHDR.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<TreatWarningAsError>true</TreatWarningAsError>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>
Expand Down
6 changes: 6 additions & 0 deletions modules/c/nitf/XML_DATA_CONTENT.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@
<TreatWarningAsError>true</TreatWarningAsError>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>
Expand All @@ -100,6 +103,9 @@
<EnforceTypeConversionRules>true</EnforceTypeConversionRules>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<UseStandardPreprocessor>true</UseStandardPreprocessor>
</ClCompile>
<Link>
<SubSystem>
Expand Down
30 changes: 28 additions & 2 deletions modules/c/nitf/include/import/nitf.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,30 @@
*
*/

#ifndef __IMPORT_NITF_H__
#define __IMPORT_NITF_H__
#pragma once
#ifndef NITRO_nitf_import_nitf_h_INCLUDED_
#define NITRO_nitf_import_nitf_h_INCLUDED_

#if _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4820) // '...' : '...' bytes padding added after data member '...'
#pragma warning(disable: 4668) // '...' is not defined as a preprocessor macro, replacing with '...' for '...'
#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to '...' function under -EHc. Undefined behavior may occur if this function throws an exception.
#pragma warning(disable: 5105) // macro expansion producing '...' has undefined behavior
#pragma warning(disable: 5045) // Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to '...'
#pragma warning(disable: 5105) // macro expansion producing '...' has undefined behavior
#endif

#if _MSC_VER
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#endif
#define NOMINMAX
#include <windows.h>
#undef min
#undef max
#endif

#include "nitf/BandInfo.h"
#include "nitf/BandSource.h"
Expand Down Expand Up @@ -67,4 +89,8 @@
#include "nitf/DirectBlockSource.h"
#include "nitf/WriterOptions.h"

#if _MSC_VER
#pragma warning(pop)
#endif

#endif // NITRO_nitf_import_nitf_h_INCLUDED_
6 changes: 0 additions & 6 deletions modules/c/nitf/shared/ACCHZB.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@
*
*/

#if _MSC_VER
#pragma warning(disable: 4820) // '...' : '...' bytes padding added after data member '...'
#pragma warning(disable: 4668) // '...' is not defined as a preprocessor macro, replacing with '...' for '...'
#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to '...' function under -EHc. Undefined behavior may occur if this function throws an exception.
#endif

#include <import/nitf.h>

NITF_CXX_GUARD
Expand Down
7 changes: 1 addition & 6 deletions modules/c/nitf/shared/JITCID.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@
*
*/

#if _MSC_VER
#pragma warning(disable: 4820) // '...' : '...' bytes padding added after data member '...'
#pragma warning(disable: 4668) // '...' is not defined as a preprocessor macro, replacing with '...' for '...'
#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to '...' function under -EHc. Undefined behavior may occur if this function throws an exception.
#endif

#include <import/nitf.h>
#include <nitf/TREUtils.h>
#include <nitf/Record.h>

Expand Down
1 change: 1 addition & 0 deletions modules/c/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#pragma warning(push)
#pragma warning(disable: 4820) // '...': '...' bytes padding added after data member '...'
#pragma warning(disable: 5105) // macro expansion producing '...' has undefined behavior

#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
Expand Down

0 comments on commit 0a8d8ad

Please sign in to comment.