Skip to content

Commit

Permalink
MMDevice/MMCore: Suppress GCC warnings for throw()
Browse files Browse the repository at this point in the history
There is no way to suppress just for exception specifications, but limit
the suppression to within the headers.

Also make suppression of MSVC C4290 consistent with GCC.
  • Loading branch information
marktsuchida committed Dec 14, 2023
1 parent 03df42e commit 5a665ce
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 2 deletions.
8 changes: 8 additions & 0 deletions MMCore/CircularBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@
#include <memory>
#include <string>

#ifdef _MSC_VER
#pragma warning(disable: 4290) // 'C++ exception specification ignored'
#endif

#if defined(__GNUC__) && !defined(__clang__)
// 'dynamic exception specifications are deprecated in C++11 [-Wdeprecated]'
#pragma GCC diagnostic ignored "-Wdeprecated"
#endif

const long long bytesInMB = 1 << 20;
const long adjustThreshold = LONG_MAX / 2;
Expand Down
9 changes: 9 additions & 0 deletions MMCore/CircularBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
#pragma warning(disable: 4290) // 'C++ exception specification ignored'
#endif

#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
// 'dynamic exception specifications are deprecated in C++11 [-Wdeprecated]'
#pragma GCC diagnostic ignored "-Wdeprecated"
#endif

class ThreadPool;
class TaskSet_CopyMemory;
Expand Down Expand Up @@ -101,6 +106,10 @@ class CircularBuffer
std::shared_ptr<TaskSet_CopyMemory> tasksMemCopy_;
};

#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif

#ifdef _MSC_VER
#pragma warning(pop)
#endif
19 changes: 19 additions & 0 deletions MMCore/ConfigGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@

#pragma once

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4290) // 'C++ exception specification ignored'
#endif

#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
// 'dynamic exception specifications are deprecated in C++11 [-Wdeprecated]'
#pragma GCC diagnostic ignored "-Wdeprecated"
#endif

#include "Configuration.h"
#include "Error.h"
#include <string>
Expand Down Expand Up @@ -436,3 +447,11 @@ class PixelSizeConfigGroup : public ConfigGroupBase<PixelSizeConfiguration>
}
}
};

#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif

#ifdef _MSC_VER
#pragma warning(pop)
#endif
9 changes: 9 additions & 0 deletions MMCore/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@
#include <sstream>
#include <string>

#ifdef _MSC_VER
#pragma warning(disable: 4290) // 'C++ exception specification ignored'
#endif

#if defined(__GNUC__) && !defined(__clang__)
// 'dynamic exception specifications are deprecated in C++11 [-Wdeprecated]'
#pragma GCC diagnostic ignored "-Wdeprecated"
#endif

std::string PropertySetting::generateKey(const char* device, const char* prop)
{
std::string key(device);
Expand Down
10 changes: 10 additions & 0 deletions MMCore/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
#pragma warning(disable: 4290) // 'C++ exception specification ignored'
#endif

#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
// 'dynamic exception specifications are deprecated in C++11 [-Wdeprecated]'
#pragma GCC diagnostic ignored "-Wdeprecated"
#endif

#include <string>
#include <vector>
#include <map>
Expand Down Expand Up @@ -119,6 +125,10 @@ class Configuration
std::map<std::string, int> index_;
};

#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif

#ifdef _MSC_VER
#pragma warning(pop)
#endif
10 changes: 9 additions & 1 deletion MMCore/MMCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
// because all public methods will most likely appear in other
// programming environments (Java or Python).


#include "../MMDevice/DeviceThreads.h"
#include "../MMDevice/DeviceUtils.h"
#include "../MMDevice/ImageMetadata.h"
Expand Down Expand Up @@ -65,6 +64,15 @@
#include <sstream>
#include <vector>

#ifdef _MSC_VER
#pragma warning(disable: 4290) // 'C++ exception specification ignored'
#endif

#if defined(__GNUC__) && !defined(__clang__)
// 'dynamic exception specifications are deprecated in C++11 [-Wdeprecated]'
#pragma GCC diagnostic ignored "-Wdeprecated"
#endif

/*
* Important! Read this before changing this file:
*
Expand Down
10 changes: 10 additions & 0 deletions MMCore/MMCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@
#pragma warning(disable: 4290) // 'C++ exception specification ignored'
#endif

#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
// 'dynamic exception specifications are deprecated in C++11 [-Wdeprecated]'
#pragma GCC diagnostic ignored "-Wdeprecated"
#endif

#include "../MMDevice/DeviceThreads.h"
#include "../MMDevice/MMDevice.h"
#include "../MMDevice/MMDeviceConstants.h"
Expand Down Expand Up @@ -693,6 +699,10 @@ class CMMCore
void loadSystemConfigurationImpl(const char* fileName) throw (CMMError);
};

#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif

#ifdef _MSC_VER
#pragma warning(pop)
#endif
12 changes: 11 additions & 1 deletion MMDevice/ImageMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
#pragma warning(disable: 4290) // 'C++ exception specification ignored'
#endif

#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
// 'dynamic exception specifications are deprecated in C++11 [-Wdeprecated]'
#pragma GCC diagnostic ignored "-Wdeprecated"
#endif

#include "MMDeviceConstants.h"

#include <string>
Expand Down Expand Up @@ -319,7 +325,7 @@ class Metadata
else
return false;
}

MetadataSingleTag GetSingleTag(const char* key) const throw (MetadataKeyError)
{
MetadataTag* tag = FindTag(key);
Expand Down Expand Up @@ -494,6 +500,10 @@ class Metadata
typedef std::map<std::string, MetadataTag*>::const_iterator TagConstIter;
};

#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif

#ifdef _MSC_VER
#pragma warning(pop)
#endif

0 comments on commit 5a665ce

Please sign in to comment.