Skip to content

Commit e708b98

Browse files
author
J. Daniel Smith
authored
reduce compiler warnings/code-analysis diagnostics (#461)
* update externals (#388) * update "nitro" * update coda-oss and fix compiler errors * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * update "nitro" to get SegmentMemorySource overloads * latest from "nitro" * match nitro -> nitf change * make_span() * latest from "coda-oss" * more filesystem from coda-oss * latest from "nitro" * std::endian * latest from "nitro" * latest from "nitro" and "coda-oss" * reduce use of toString() (#389) * put common #includes for PCH in a single file * build check_valid_six * use EXIT_* rather than 0/1 * getting rid of std::auto_ptr<> because it's gone in C++17 * build all projects with C++17 * use <filesystem> to remove hard-coded paths * in Visual Studio, run check_valid_six with a pre-defined path * tweak plugin dir * can't have "check_valid_six" as a directory for *ix build * build crop_sicd * turn on /Wall, fix some warnings * C++17 generates more warnings that I don't want to fix right now * removed some compiler warnings from third-party code * comment-out use of C++17's <filesystem> * tweak project settings for consistency * unit-test for createFakeComplexData() * turn on compiler warnings * crank-up warning level * enable "Warnings as errors" * turn on all warnings (many #pragma'd away) * get rid of more warnings * adjust more #pragma's * update "nitro" * update coda-oss and fix compiler errors * update "nitro" * update coda-oss and fix compiler errors * use "externals" from top-level "install" * use int64_t, etc. instead of sys::Int64_T * mem::SharedPtr -> std::shared_ptr * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * update "nitro" to get SegmentMemorySource overloads * use std::unique_ptr<[]> instead of mem::ScopedArray * use int32_t et. al. instead of sys::Int32_T * use std::byte (not quite working yet, but need to move code to a faster machine) * build with std::byte * build with simplified "externals" scheme * latest from "nitro" * match nitro -> nitf change * make_span() * use std::thread::hardware_concurrency() instead of sys::OS().getNumCPUs() * sys::Off_T -> ptrdiff_t * fix compiler errors from previous merge; mostly #include <thread> * Revert "sys::Off_T -> ptrdiff_t" This reverts commit aa22a37. * sys::Off_T -> int64_t; sys::SSize_T -> ptrdiff_t * latest from "coda-oss" * use filesystem::path and std::endian * more filesystem from coda-oss * less use of sys:: * NULL -> nullptr * use .data() rather than &d[0] * mem::BufferView -> std::span * const std::span<>& doesn't make much sense * need make_span() overload for pointer+size * latest from "nitro" * std::endian * coda-oss now gives us std::endian * sys::Filesystem -> std::filesystem * don't need to explicitly call fs::path::string() in most cases * sys::Filesystem -> std::filesystem * fix build errors when using C++17 * simplify access to some ImageSubheader values * newReadControl() returns a std::unique_ptr<> rather than a raw pointer * a singleton is much easier in C++11 * don't need to do manual locking in C++11 * use a template and some macros to dramatically simplify Enums * adjust macros for GCC, provide operators for SWIG * got the map entries wrong * make getIndices() a bit more robust * store a std::unique_ptr<> instead of a raw poniter * throw exceptions in getIndices() rather than assuming * use Enum<T>.toString() where possible rather than duplicating code * remove duplicate code converting from a string to Enum<T> * don't explicilty check for "SIDD" as that's already part of getDataType() * use std::string instead of char[] * reduce use of "delete[]" * less use of "SICD" and "SIDD", use six::DataType instead * simplify Region buffer management * reduce some explicit use of std::shared_ptr<> with std::make_shared and/or auto * more reduction in explicit use of std::shared_ptr * latest from "nitro" * simplify use of six::Region * reduce use of explicit .toString() * further reduction in explicit use of toString() * template specialiaton can't be inline with G++ * simplify cphd enum creation * reduce use of toString() with setAttribute() * latest from "nitro" and "coda-oss" * don't need catch(excep::Exception) ex.toString() as std::exception::what() now does the same thing * really only have two calls to setAttribute(): std::string and size_t * use macros to generate SIDD Enums * add operator<< for Enum<T> to avoid some explicit .toString() calls * add operator==(std::string) overload to redue need for .toString() * add operator<<() to redue need for .toString() * don't implmeent a bunch of six::toString() routines; they sholdn't be called anymore * further reduction in use of toString() * eliminate six::toString() template; just provide a few overloads instead * createSixString() which calls six::toString(t) instead of t.toString() * createSixString() overload with URI parameter * allow different strings (e.g., "1" and "+1") to map to the same value * put "Enum" support code in a separate file * there is now just one NOT_SET_VALUE * latest from coda-oss (#390) * update "nitro" * update coda-oss and fix compiler errors * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * update "nitro" to get SegmentMemorySource overloads * latest from "nitro" * match nitro -> nitf change * make_span() * latest from "coda-oss" * more filesystem from coda-oss * latest from "nitro" * std::endian * latest from "nitro" * latest from "nitro" and "coda-oss" * latest from coda-oss * lost toString<nullptr>() * latest from coda-oss/main * want "std" augmented in this repo * latest from coda-oss and nitro (#391) * update "nitro" * update coda-oss and fix compiler errors * update coda-oss and nitro with less use of sys:: * unit-test paths are wrong for "externals" * update "nitro" to get SegmentMemorySource overloads * latest from "nitro" * match nitro -> nitf change * make_span() * latest from "coda-oss" * more filesystem from coda-oss * latest from "nitro" * std::endian * latest from "nitro" * latest from "nitro" and "coda-oss" * latest from coda-oss * lost toString<nullptr>() * latest from coda-oss/main * want "std" augmented in this repo * partial update from coda-oss/main * latest from coda-oss/main * update coda-oss with latest from https://github.com/mdaus/coda-oss * update externals/nitro/docs * latest from "nitro" * Revert "latest from "nitro"" This reverts commit 0b99300. * latest from nitro/master * ignore build/ directory * Revert "latest from nitro/master" This reverts commit e89da71. * update externals/nitro/docs * update "c", "java", "mex", and "python" directories -- but not "c++" * update other nitro top-level files ... everything except modules/c++ * VCXPROJ files from nitro * several changes from nitro/c++ ... hoping this builds. * fix build error on Linux * more changes from nitro/modules/c++ * fix IOStreamWriter ctor * more changes from nitro/modules/c++ * paths are wrong when in "externals" * remove externals/nitro/docs * slam in "main" * latest from coda-oss/main * adjust coda-oss for our usage * latest from nitro/main * std::span removed from "nitro" * need to redo C++17 * fix missing #include file * remove "nitro" files not needed in externals/nitro * paths are wrong in "externals" * Revert "remove "nitro" files not needed in externals/nitro" This reverts commit da30b96. * Revert "Revert "remove "nitro" files not needed in externals/nitro"" This reverts commit e69391b. * slam in externals as merging creates too many conflicts * merge brought back a deleted #include * add back "java" and "mex" * lates from coda-oss/main * latest from "nitro" * paths are wrong in "externals" * need to redo C++17 support * std::span -> gsl::span * Revert "std::span -> gsl::span" This reverts commit c10f233. * latest from coda-oss and nitro * these are the correct files from "master" * gsl::span -> std::span * get #includes right for PCH * didn't want this change * trigger build on GitHub * remove files that shouldn't have been committed * latest from coda-oss:master * latest from nitro::master * adjust to API changes in coda-oss/xml.lite * latest from coda-oss * latest from coda-oss * std::filesystem::path doesn't implicitly convert to std::string * more place where an explicit std::filesystem::path::string() call is needed * latest from "coda-oss" and "nitro" * latest from coda-oss * one more change from coda-oss * "nitro" changes to build with C90 instead of C99 * old C++11 compilers don't like template<template> * new TREs from "nitro" * std::shared_ptr<> doesn't have [] versions, only std::unique_ptr * build with older compilers * latest coda-oss changes * Update .gitignore from "nitro" * SWIG doesn't like "final" * SWIG doesn't like "final" * latest from coda_oss * latest from "nitro" * add a version number to externals/coda-oss * add a version number to externals/nitro * restore "build" and "cmake" * Gsl_.h got lost ... ? * update CMS to 3.0.3.3 (#433) * remove version numbers (for now); we've went a very long time w/o them * finish rename * version number is in too many places ... * missing .cmake files * missing "build" files * latest from coda-oss * latest from "master" on coda-oss * latest from "master" at nitro * remove CA diagnostics from coda-oss * CODA_OSS_AUGMENT_std_namespace got clobbered again * update coda-oss and nitro * be sure coda-oss "std" files are copied * use new coda-oss "std" headers * more coda-oss changes * updates from coda-oss and nitro * latest from coda-oss * fix coda-oss unittest dependencies * WAF dependencies for "scene" * sys/Filesystem.h -> std/filesystem * build using C++17 features * account for removed coda-oss overloads * add back coda_oss;;filesystem::path * forgot to add new "coda_oss" directory * latest from "coda-oss" and "nitro" * tweaks to python wrappers from coda-oss * prepare for removing some code-analysis diagnostics * "const" and "constexpr" as directed by code-analsysi * be sure variables are initialized -- per code-analysis * prepare code-analysis for SIX * "const" or "constexpr" per code-analysis * get rid of most reinterpret_cast<>s * get rid of C-style casts * XML parsing routines can be "const" * initialize per code-analysis * turn on a few more code-analysis diagnostics * assert() that various pointers aren't NULL * make copy/move explicit, usually =delete * enable more compiler-warnings & code-analysis diagnostics * updates from coda-oss to remove compiler warnings * Xerces generates a bunch of warnings * there are a lot of code-analysis diagnostics from Xerces * another update to coda-oss to get rid of code-analysis diagnostics * latest from coda-oss * enable more compiler warnings and code-analysis diagnostics * coda-oss updates to reduce compiler warnings/code-analysis diagnostics * turn on more code-analysis diagnostics * latest from coda-oss to reduce compiler warnings * fix more code-analysis diagnistics * more code-analysis diagnostics fixes from coda-oss * more code-analysis cleanup * remove several more compiler warnings * Multithreaded DEBUG DLL is the default * latest from coda-oss * updates from "nitro" * lost sys/Conf.h #include * use =default for more default constructors * tweak code-analysis * gsl::narrow<> * get rid of size & signed/unsigned warnings * more =default for default constructors * use std::make_unique instead of explicit new * latest from coda-oss and nitro * latest from nitro * assert() that some pointers can't be NULL * latest from coda-oss * updates from "nitro" * latest from "nitro" to support nitf-c++ as a DLL/shared-library * build w/o errors when nitf-c++ is a DLL * explicitly list SegmentMemorySource() overloads * Merge branch 'master' into develop/update_externals * get rid of more compiler warnings/code-analysis diagnostics * latest from coda-oss to get rid of more compiler warnings/code-analysis diagnostics * be sure NITRO validation changes don't break SIX unittests * allow six.ruleset to be used in other projects * fix a bunch of compiler warnings * get rid of the errors that were #pragma'd away in the previous submission * PlanarCoordinateMesh can be moved constructed (i.e., return value) * fix compiler warnings in six.sidd * reduce the use of "static_cast" in client code * build NITRO @ /W4 * CODA-OSS eliminates the need for /Zc:__cplusplus * reduce some code-analysis diagnostics from six.sicd * utilities to reduce code duplication * fix more code-analysis diagnostics * get rid of a bunch of "unreferenced parameter" warnings * utility routines to reduce use of static_cast<> * use template magic to reduce static_cast<>s when calling createInt() * more reduction of static_cast<> * "const XMLElem" -> "const xml::lite::Element*" * parseOptionalInt() * use parseOptional*() routines to reduce noisy code * latest from "nitro" and "coda-oss" * simplify code with parseOptional*() * more use of parseOptional*() * Revert "more use of parseOptional*()" This reverts commit 4b54417. * Revert "simplify code with parseOptional*()" This reverts commit c62fce9. * Revert "use parseOptional*() routines to reduce noisy code" This reverts commit 8a497df. * reduce use of getOptional() * Revert "Revert "use parseOptional*() routines to reduce noisy code"" This reverts commit c6d2313. * simplify Wideband::read() * fix /W4 warnings in six.convert * fix code-analysis diagnostics from six.sicd * remove a bunch of code-analysis diagnostics * removed more code-analysis diagnostics * reduce .c_str() * reduce use of .c_str() in "nitro" * write() takes a std::string parameter * simplify calling XMLControlRegistry::addCreator() * reduce code-analysis diagnostics * reduce use of vector::size() * use range for() to reduce use of .size() * cast not needed * changes from coda-oss to reduce code-analysis diagnostics * compile with C++20 * tweaks for VS2019 16.10 * latest from nitro and coda-oss
1 parent 8774471 commit e708b98

9 files changed

Lines changed: 19 additions & 14 deletions

File tree

six/modules/c++/cphd/unittests/test_compressed_signal_block_round.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <string>
2828
#include <memory>
2929
#include <thread>
30+
#include <std/span>
3031

3132
#include <nitf/coda-oss.hpp>
3233
#include <types/RowCol.h>
@@ -98,7 +99,7 @@ std::vector<std::byte> checkCompressedData(const std::string& pathname,
9899
const cphd::Wideband& wideband = reader.getWideband();
99100
std::vector<std::byte> readData(dims.area());
100101

101-
auto data = gsl::make_span(readData.data(), readData.size());
102+
std::span<std::byte> data(readData.data(), readData.size());
102103
for (size_t ii = 0; ii < reader.getMetadata().data.getNumChannels(); ++ii)
103104
{
104105
wideband.read(ii, data);

six/modules/c++/cphd/unittests/test_signal_block_round.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ std::vector<std::complex<float> > checkData(const std::string& pathname,
112112
std::vector<std::complex<float> > readData(dims.area());
113113

114114
size_t sizeInBytes = readData.size() * sizeof(readData[0]);
115-
std::unique_ptr<std::byte[]> scratchData(new std::byte[sizeInBytes]);
116-
auto scratch = gsl::make_span(scratchData.get(), sizeInBytes);
117-
auto data = gsl::make_span(readData.data(), readData.size());
115+
std::vector<std::byte> scratchData(sizeInBytes);
116+
std::span<std::byte> scratch(scratchData.data(), scratchData.size());
117+
std::span<std::complex<float>> data(readData.data(), readData.size());
118118

119119
wideband.read(0, 0, cphd::Wideband::ALL, 0, cphd::Wideband::ALL,
120120
scaleFactors, numThreads, scratch, data);

six/modules/c++/cphd03/unittests/test_cphd_read_unscaled_int.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <string>
2828
#include <memory>
2929
#include <thread>
30+
#include <std/span>
3031

3132
#include <cphd03/CPHDReader.h>
3233
#include <cphd03/CPHDWriter.h>
@@ -156,9 +157,9 @@ std::vector<std::complex<float> > checkData(const std::string& pathname,
156157
std::vector<std::complex<float> > readData(dims.area());
157158

158159
size_t sizeInBytes = readData.size() * sizeof(readData[0]);
159-
std::unique_ptr<std::byte[]> scratchData(new std::byte[sizeInBytes]);
160-
auto scratch = gsl::make_span(scratchData.get(), sizeInBytes);
161-
auto data = gsl::make_span(readData.data(), readData.size());
160+
std::vector<std::byte> scratchData(sizeInBytes);
161+
std::span<std::byte> scratch(scratchData.data(), scratchData.size());
162+
std::span<std::complex<float>> data(readData.data(), readData.size());
162163

163164
wideband.read(0, 0, cphd::Wideband::ALL, 0, cphd::Wideband::ALL,
164165
scaleFactors, numThreads, scratch, data);

six/modules/c++/nitro_pch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#pragma warning(disable: 26447) // The function is declared '...' but calls function '..' which may throw exceptions (f.6).
1616
#pragma warning(disable: 26812) // The enum type '...' is unscoped. Prefer '...' over '...' (Enum.3).
1717
#pragma warning(disable: 26455) // Default constructor may not throw.Declare it 'noexcept' (f.6).
18+
#pragma warning(disable: 26458) // Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4).
1819

1920
#include <import/str.h>
2021
#include <import/sys.h>
@@ -79,6 +80,7 @@
7980
#pragma warning(disable: 26409) // Avoid calling new and delete explicitly, use std::make_unique<T> instead (r.11).
8081
#pragma warning(disable: 26429) // Symbol '...' is never tested for nullness, it can be marked as not_null(f.23).
8182
#pragma warning(disable: 26400) // Do not assign the result of an allocation or a function call with an owner<T> return value to a raw pointer, use owner<T> instead(i.11).
83+
#pragma warning(disable: 26467) // Converting from floating point to unsigned integral types results in non-portable code if the double/float has a negative value. Use gsl::narrow_cast or gsl::narrow instead to guard against undefined behavior and potential data loss (es.46).
8284
#include <import/xml/lite.h>
8385

8486
#pragma warning(pop)

six/modules/c++/scene/framework.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
#pragma warning(disable: 26432) // If you define or delete any default operation in the type '...', define or delete them all(c.21).
1919
#pragma warning(disable: 26456) // Operator '...' hides a non - virtual operator '...' (c.128).
2020
#pragma warning(disable: 26481) // Don't use pointer arithmetic. Use span instead (bounds.1).
21-
//#pragma warning(disable: 26429) // Symbol '...' is never tested for nullness, it can be marked as not_null(f.23).
2221
#pragma warning(disable: 26446) // Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4).
2322
#pragma warning(disable: 26487) // Don't return a pointer '...' that may be invalid (lifetime.4).
2423
#pragma warning(disable: 26401) // Do not delete a raw pointer that is not an owner<T>(i.11).
2524
#pragma warning(disable: 26482) // Only index into arrays using constant expressions(bounds.2).
2625
#pragma warning(disable: 26434) // Function '...' hides a non-virtual function '...' (c.128).
2726
#pragma warning(disable: 26409) // Avoid calling new and delete explicitly, use std::make_unique<T> instead (r.11).
27+
#pragma warning(disable: 26458) // Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4).
2828

2929
#pragma warning(push)
3030
#pragma warning(disable: 4464) // relative include path contains '..'

six/modules/c++/scene/include/scene/ProjectionModel.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,14 +355,14 @@ class ProjectionModel
355355
Vector3& velCOA) const;
356356

357357
protected:
358-
Vector3 mSlantPlaneNormal;
359-
Vector3 mImagePlaneNormal;
360-
Vector3 mSCP;
358+
Vector3 mSlantPlaneNormal{};
359+
Vector3 mImagePlaneNormal{};
360+
Vector3 mSCP{};
361361
double mScaleFactor = 0.0;
362362
math::poly::OneD<Vector3> mARPPoly;
363363
math::poly::OneD<Vector3> mARPVelPoly;
364364
math::poly::TwoD<double> mTimeCOAPoly;
365-
int mLookDir;
365+
int mLookDir = 0;
366366

367367
AdjustableParams mAdjustableParams;
368368
Errors mErrors;

six/modules/c++/six.sicd/framework.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#pragma warning(disable: 26482) // Only index into arrays using constant expressions(bounds.2).
3636
#pragma warning(disable: 6262) // Function uses '...' bytes of stack : exceeds analyze : stacksize '...'.Consider moving some data to heap.
3737
#pragma warning(disable: 26432) // If you define or delete any default operation in the type '...', define or delete them all(c.21).
38-
38+
#pragma warning(disable: 26458) // Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4).
3939

4040
// too hard to get write with older C++11 compilers
4141
#pragma warning(disable: 26497) // The function '...' could be marked constexpr if compile-time evaluation is desired(f.4).

six/modules/c++/six.sidd/framework.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#pragma warning(disable: 26482) // Only index into arrays using constant expressions(bounds.2).
3636
#pragma warning(disable: 6262) // Function uses '...' bytes of stack : exceeds analyze : stacksize '...'.Consider moving some data to heap.
3737
#pragma warning(disable: 26432) // If you define or delete any default operation in the type '...', define or delete them all(c.21).
38+
#pragma warning(disable: 26458) // Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4).
3839

3940

4041
// too hard to get write with older C++11 compilers

six/modules/c++/six/framework.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#pragma warning(disable: 26482) // Only index into arrays using constant expressions(bounds.2).
3636
#pragma warning(disable: 6262) // Function uses '...' bytes of stack : exceeds analyze : stacksize '...'.Consider moving some data to heap.
3737
#pragma warning(disable: 26432) // If you define or delete any default operation in the type '...', define or delete them all(c.21).
38-
38+
#pragma warning(disable: 26458) // Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4).
3939

4040
// too hard to get write with older C++11 compilers
4141
#pragma warning(disable: 26497) // The function '...' could be marked constexpr if compile-time evaluation is desired(f.4).

0 commit comments

Comments
 (0)