diff --git a/src/sst/core/baseComponent.h b/src/sst/core/baseComponent.h index cecfcea9b..8421d1082 100644 --- a/src/sst/core/baseComponent.h +++ b/src/sst/core/baseComponent.h @@ -478,7 +478,6 @@ class BaseComponent : public SST::Core::Serialization::serializable_base else { fatal(__LINE__, __FILE__, "createStatistic", 1, "failed to cast created statistic '%s' to expected type", name.c_str()); - return nullptr; // avoid compiler warnings } } @@ -531,7 +530,6 @@ class BaseComponent : public SST::Core::Serialization::serializable_base // not a valid stat and I won't be able to share my parent's statistic fatal(__LINE__, __FILE__, "registerStatistic", 1, "attempting to register unknown statistic '%s'", statName.c_str()); - return nullptr; // get rid of warning } } diff --git a/src/sst/core/event.cc b/src/sst/core/event.cc index 508de11da..87ec7c814 100644 --- a/src/sst/core/event.cc +++ b/src/sst/core/event.cc @@ -29,14 +29,15 @@ Event::execute() (*reinterpret_cast(delivery_info))(this); } +DISABLE_WARN_MISSING_NORETURN Event* Event::clone() { Simulation_impl::getSimulation()->getSimulationOutput().fatal(CALL_INFO, 1, "Called clone() on an Event that doesn't" " implement it."); - return nullptr; // Never reached, but gets rid of compiler warning } +REENABLE_WARNING Event::id_type Event::generateUniqueId() diff --git a/src/sst/core/factory.cc b/src/sst/core/factory.cc index 058b9bf17..eb803ec46 100644 --- a/src/sst/core/factory.cc +++ b/src/sst/core/factory.cc @@ -313,8 +313,6 @@ Factory::GetValidStatistics(const std::string& compType) // If we get to here, element doesn't exist out.fatal(CALL_INFO, 1, "can't find requested component/subcomponent '%s'\n%s\n", compType.c_str(), error_os.str().c_str()); - static std::vector null_return; - return null_return; // to avoid compiler warnings } bool diff --git a/src/sst/core/output.h b/src/sst/core/output.h index 807af4164..6c88033d6 100644 --- a/src/sst/core/output.h +++ b/src/sst/core/output.h @@ -13,6 +13,7 @@ #define SST_CORE_OUTPUT_H #include "sst/core/serialization/serializer_fwd.h" +#include "sst/core/warnmacros.h" #include #include @@ -299,8 +300,9 @@ class Output @param format Format string. All valid formats for printf are available. @param ... Arguments for format. */ - void debugPrefix(const char* tempPrefix, uint32_t line, const char* file, const char* func, uint32_t output_level, - uint32_t output_bits, const char* format, ...) __attribute__((format(printf, 8, 9))) + void debugPrefix(const char* UNUSED(tempPrefix), uint32_t UNUSED(line), const char* UNUSED(file), + const char* UNUSED(func), uint32_t UNUSED(output_level), uint32_t UNUSED(output_bits), + const char* UNUSED(format), ...) __attribute__((format(printf, 8, 9))) { #ifdef __SST_DEBUG_OUTPUT__ @@ -321,15 +323,6 @@ class Output m_outputPrefix = normalPrefix; } -#else - /* When debug is disabled, silence warnings of unused parameters */ - (void)tempPrefix; - (void)line; - (void)file; - (void)func; - (void)output_level; - (void)output_bits; - (void)format; #endif } @@ -352,8 +345,8 @@ class Output @param format Format string. All valid formats for printf are available. @param ... Arguments for format. */ - void debug(uint32_t line, const char* file, const char* func, uint32_t output_level, uint32_t output_bits, - const char* format, ...) const __attribute__((format(printf, 7, 8))) + void debug(uint32_t UNUSED(line), const char* UNUSED(file), const char* UNUSED(func), uint32_t UNUSED(output_level), + uint32_t UNUSED(output_bits), const char* UNUSED(format), ...) const __attribute__((format(printf, 7, 8))) { #ifdef __SST_DEBUG_OUTPUT__ va_list arg; @@ -367,14 +360,6 @@ class Output va_end(arg); } } -#else - /* When debug is disabled, silence warnings of unused parameters */ - (void)line; - (void)file; - (void)func; - (void)output_level; - (void)output_bits; - (void)format; #endif } diff --git a/src/sst/core/simulation.cc b/src/sst/core/simulation.cc index 3ab1c60ac..e1d13256a 100644 --- a/src/sst/core/simulation.cc +++ b/src/sst/core/simulation.cc @@ -2159,14 +2159,11 @@ SST_Exit(int exit_code) #ifdef SST_CONFIG_HAVE_MPI // If MPI exists, abort - static int exit_once = (MPI_Abort(MPI_COMM_WORLD, exit_code), 0); + static int UNUSED(exit_once) = (MPI_Abort(MPI_COMM_WORLD, exit_code), 0); #else - static int exit_once = (exit(exit_code), 0); + static int UNUSED(exit_once) = (exit(exit_code), 0); #endif - // Should never get here, but need to use exit_once to avoid - // compiler warning - printf("exit_once = %d\n", exit_once); std::terminate(); } diff --git a/src/sst/core/sstpart.cc b/src/sst/core/sstpart.cc index 4ba68bff6..c6a83ec50 100644 --- a/src/sst/core/sstpart.cc +++ b/src/sst/core/sstpart.cc @@ -20,6 +20,7 @@ namespace SST::Partition { SST_ELI_DEFINE_INFO_EXTERN(SSTPartitioner) SST_ELI_DEFINE_CTOR_EXTERN(SSTPartitioner) +DISABLE_WARN_MISSING_NORETURN void SSTPartitioner::performPartition(PartitionGraph* UNUSED(graph)) { @@ -33,5 +34,6 @@ SSTPartitioner::performPartition(ConfigGraph* UNUSED(graph)) Output& output = Output::getDefaultObject(); output.fatal(CALL_INFO, 1, "ERROR: chosen partitioner does not support ConfigGraph"); } +REENABLE_WARNING } // namespace SST::Partition diff --git a/src/sst/core/statapi/statbase.cc b/src/sst/core/statapi/statbase.cc index 3191befb9..6115b53fe 100644 --- a/src/sst/core/statapi/statbase.cc +++ b/src/sst/core/statapi/statbase.cc @@ -114,6 +114,7 @@ StatisticBase::getCompName() const return component_->getName(); } +DISABLE_WARN_MISSING_NORETURN void Statistic::outputStatisticFields(StatisticFieldsOutput* UNUSED(stat_output), bool UNUSED(end_of_sim_flag)) { @@ -129,6 +130,7 @@ Statistic::registerOutputFields(StatisticFieldsOutput* UNUSED(stat_output) "void statistic %s, type %s for component %s does not support outputing fields", getStatTypeName().c_str(), getFullStatName().c_str(), getComponent()->getName().c_str()); } +REENABLE_WARNING void StatisticBase::incrementCollectionCount(uint64_t increment) diff --git a/src/sst/core/statapi/statoutput.cc b/src/sst/core/statapi/statoutput.cc index 21b8c14c0..bd0fe00de 100644 --- a/src/sst/core/statapi/statoutput.cc +++ b/src/sst/core/statapi/statoutput.cc @@ -146,6 +146,7 @@ StatisticFieldsOutput::getRegisteredField(fieldHandle_t fieldHandle) return nullptr; } +DISABLE_WARN_MISSING_NORETURN void StatisticFieldsOutput::outputField(fieldHandle_t UNUSED(fieldHandle), double UNUSED(data)) { @@ -187,6 +188,7 @@ StatisticFieldsOutput::outputField(fieldHandle_t UNUSED(fieldHandle), uint64_t U Simulation_impl::getSimulationOutput().fatal( CALL_INFO, 1, "StatisticOutput %s does not support uint64_t output", getStatisticOutputName().c_str()); } +REENABLE_WARNING void StatisticFieldsOutput::output(StatisticBase* statistic, bool endOfSimFlag) diff --git a/src/sst/core/uninitializedQueue.cc b/src/sst/core/uninitializedQueue.cc index 2f83bcbd0..c50be9d2d 100644 --- a/src/sst/core/uninitializedQueue.cc +++ b/src/sst/core/uninitializedQueue.cc @@ -24,6 +24,7 @@ UninitializedQueue::UninitializedQueue(const std::string& message) : message(message) {} +DISABLE_WARN_MISSING_NORETURN bool UninitializedQueue::empty() { @@ -58,5 +59,6 @@ UninitializedQueue::front() std::cout << message << std::endl; abort(); } +REENABLE_WARNING } // namespace SST diff --git a/src/sst/core/warnmacros.h b/src/sst/core/warnmacros.h index 39b7ac90d..221034f4e 100644 --- a/src/sst/core/warnmacros.h +++ b/src/sst/core/warnmacros.h @@ -50,6 +50,8 @@ #define DISABLE_WARN_DANGLING_POINTER DIAG_PRAGMA(DIAG_COMPILER, push) +#define DISABLE_WARN_MISSING_NORETURN DIAG_PRAGMA(DIAG_COMPILER, push) + #elif defined(__GNUC__) #define DIAG_COMPILER GCC @@ -62,6 +64,8 @@ #define DISABLE_WARN_STRICT_ALIASING DIAG_DISABLE(strict-aliasing) +#define DISABLE_WARN_MISSING_NORETURN DIAG_DISABLE(missing-noreturn) + #if ( __GNUC__ >= 5 ) #define DISABLE_WARN_MISSING_OVERRIDE DIAG_DISABLE(suggest-override) #else @@ -89,6 +93,7 @@ #define DISABLE_WARN_MISSING_OVERRIDE #define DISABLE_WARN_CAST_FUNCTION_TYPE #define DISABLE_WARN_DANGLING_POINTER +#define DISABLE_WARN_MISSING_NORETURN #endif