Skip to content

Commit 265cc4a

Browse files
DavidPoliakoffdaboehme
authored andcommitted
Fix for the BG/Q Clang compilers. Also, PGI's handling of Rapidjson (#157)
* Fix for the BG/Q Clang compilers * Fix for PGI
1 parent 33a8c24 commit 265cc4a

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

src/caliper/cali.cpp

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,39 @@ struct _cali_configset_t {
649649
std::map<std::string, std::string> cfgset;
650650
};
651651

652+
653+
/**
654+
*
655+
* When the BG/Q machines die at LLNL, we can delete these.
656+
* They exist because BG/Q had Clang compilers that *mostly*
657+
* supported C++11, except for features like std::vector<T>::emplace.
658+
*/
659+
660+
template<typename Container, typename = void>
661+
struct emplace_helper{
662+
template<typename Emplaced>
663+
static void emplace(Container& emplace_into, Emplaced object){
664+
emplace_into.insert(object);
665+
}
666+
};
667+
668+
template<typename Container>
669+
struct emplace_helper<
670+
Container,
671+
typename std::enable_if<
672+
std::is_same<
673+
decltype(std::declval<Container>().emplace(std::make_pair("",""))),
674+
decltype(std::declval<Container>().emplace(std::make_pair("","")))
675+
>::value
676+
, void
677+
>::type
678+
> {
679+
template<typename Emplaced>
680+
static void emplace(Container& emplace_into, Emplaced&& object){
681+
emplace_into.emplace(object);
682+
}
683+
};
684+
652685
cali_configset_t
653686
cali_create_configset(const char* keyvallist[][2])
654687
{
@@ -657,9 +690,10 @@ cali_create_configset(const char* keyvallist[][2])
657690
if (!keyvallist)
658691
return cfg;
659692

660-
for ( ; (*keyvallist)[0] && (*keyvallist)[1]; ++keyvallist)
661-
cfg->cfgset.emplace( std::make_pair(std::string((*keyvallist)[0]),
693+
for ( ; (*keyvallist)[0] && (*keyvallist)[1]; ++keyvallist){
694+
emplace_helper<decltype(cfg->cfgset)>::emplace( cfg->cfgset, std::make_pair(std::string((*keyvallist)[0]),
662695
std::string((*keyvallist)[1])) );
696+
}
663697

664698
return cfg;
665699
}

src/services/spot/Spot.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
#include "caliper/CaliperService.h"
3838

39+
#include "caliper/caliper-config.h"
3940
#include "caliper/Caliper.h"
4041
#include "caliper/SnapshotRecord.h"
4142

@@ -49,12 +50,17 @@
4950
#include "caliper/common/OutputStream.h"
5051
#include "caliper/common/RuntimeConfig.h"
5152
#include "caliper/common/util/split.hpp"
52-
53+
#ifdef CALIPER_REDUCED_CONSTEXPR_USAGE
54+
#define OLD_GNUC __GNUC__
55+
#undef __GNUC__
56+
#endif
5357
#include "rapidjson/rapidjson.h"
5458
#include "rapidjson/document.h"
5559
#include "rapidjson/ostreamwrapper.h"
5660
#include "rapidjson/writer.h"
57-
61+
#ifdef CALIPER_REDUCED_CONSTEXPR_USAGE
62+
#define __GNUC_ OLD_GNUC
63+
#endif
5864
#include <iostream>
5965
#include <sstream>
6066
#include <iterator>

0 commit comments

Comments
 (0)