Merge branch 'master' into PSI

This commit is contained in:
2023-12-01 16:32:56 +01:00
14 changed files with 26 additions and 23 deletions

2
.ci

Submodule .ci updated: 93062ba941...899b18336b

View File

@ -5,6 +5,8 @@
Release 8.0.6 (UNRELEASED)
========================
- Compatible changes
- Actually enable JSON-5 output in PVStructure::Formatter::JSON when available.
Release 8.0.5 (Sep 2022)
========================

View File

@ -27,7 +27,7 @@ using std::string;
namespace epics { namespace pvData {
static std::vector<string> split(string commaSeparatedList) {
static std::vector<string> split(const string& commaSeparatedList) {
string::size_type numValues = 1;
string::size_type index=0;
while(true) {

View File

@ -404,6 +404,9 @@ std::ostream& operator<<(std::ostream& strm, const PVStructure::Formatter& forma
if(format.xfmt==PVStructure::Formatter::JSON) {
JSONPrintOptions opts;
opts.multiLine = false;
#if EPICS_VERSION_INT>=VERSION_INT(7,0,6,1)
opts.json5 = true;
#endif
printJSON(strm, format.xtop, format.xshow ? *format.xshow : BitSet().set(0), opts);
strm<<'\n';
return strm;

View File

@ -7,4 +7,4 @@ INC += pv/json.h
LIBSRCS += parsehelper.cpp
LIBSRCS += parseany.cpp
LIBSRCS += parseinto.cpp
LIBSRCS += print.cpp
LIBSRCS += jprint.cpp

View File

@ -31,7 +31,7 @@ AnyScalar::AnyScalar(const AnyScalar& o)
}
#if __cplusplus>=201103L
AnyScalar::AnyScalar(AnyScalar&& o)
AnyScalar::AnyScalar(AnyScalar&& o) noexcept
:_stype(o._stype)
{
typedef std::string string;
@ -136,7 +136,7 @@ void AnyScalar::swap(AnyScalar& o) {
}
const void* AnyScalar::bufferUnsafe() const {
if(_stype==pvString) {
return as<std::string>().c_str();
return ref<std::string>().c_str();
} else {
return _wrap.blob;
}

View File

@ -35,7 +35,7 @@ void shared_ptr_base::track_new()
}
// create new tracker if ptr!=nullptr, otherwise clear
void shared_ptr_base::track_new(void* ptr)
void shared_ptr_base::track_new(const void* ptr)
{
track_clear();
if(ptr){

View File

@ -123,7 +123,7 @@ public:
AnyScalar(const AnyScalar& o);
#if __cplusplus>=201103L
AnyScalar(AnyScalar&& o);
AnyScalar(AnyScalar&& o) noexcept;
#endif
inline ~AnyScalar() {clear();}
@ -140,7 +140,7 @@ public:
}
#if __cplusplus>=201103L
inline AnyScalar& operator=(AnyScalar&& o) {
inline AnyScalar& operator=(AnyScalar&& o) noexcept {
clear();
swap(o);
return *this;

View File

@ -150,14 +150,17 @@ struct swap<8> {
#undef _PVA_swap64
/* PVD serialization doesn't pay attention to alignement,
* which some targets really care about and treat unaligned
* which some targets (ARM and powerpc) really care about and treat unaligned
* access as a fault, or with a heavy penalty (~= to a syscall).
*
* For those targets,, we will have to live with the increase
* in execution time and/or object code size of byte-wise copy.
*
* Treat x86 32/64 as an outlier, and assume all other targets
* need, or greatly benefit, from aligned access.
*/
#ifdef _ARCH_PPC
#if !(defined(__x86_64__) || defined(_M_AMD64) || defined(__i386__) || defined(_M_IX86))
template<typename T>
union alignu {

View File

@ -78,7 +78,7 @@ protected:
// add ourselves to tracker
void track_new();
// create new tracker if ptr!=nullptr, otherwise clear
void track_new(void* ptr);
void track_new(const void* ptr);
// copy tracker and add ourself
void track_assign(const shared_ptr_base& o);
void track_clear();
@ -286,6 +286,7 @@ public:
long use_count() const noexcept { return real.use_count(); }
bool unique() const noexcept { return real.unique(); }
bool expired() const noexcept { return real.expired(); }
};
template<class Base>
@ -316,13 +317,12 @@ do_enable_shared_from_this(const shared_ptr<Store>& dest,
self->xxInternalSelf = actual;
}
}} // namespace epics::debug
template<typename T>
inline std::ostream& operator<<(std::ostream& strm, const epics::debug::shared_ptr<T>& ptr)
inline std::ostream& operator<<(std::ostream& strm, const shared_ptr<T>& ptr)
{
strm<<ptr.get();
return strm;
}
}} // namespace epics::debug
#endif // DEBUGPTR_H

View File

@ -271,10 +271,10 @@ char* epicsRefSnapshotCurrent()
snap.update();
std::ostringstream strm;
strm<<snap;
const char *str = strm.str().c_str();
char *ret = (char*)malloc(strlen(str)+1);
std::string str = strm.str();
char *ret = (char*)malloc(str.length()+1);
if(ret)
strcpy(ret, str);
strcpy(ret, str.c_str());
return ret;
}catch(std::exception& e){
return epicsStrDup(e.what());

View File

@ -44,11 +44,6 @@ public:
//default constructors and destructor are OK
//returns (false,true) if pvField(is not, is) a valid alarm structure
//An automatic detach is issued if already attached.
/*
* Attach to a field of a PVData object.
* @param pvField The pvField.
* @return (false,true) if the pvField (is not, is) an alarm structure.
*/
/*
* Attach to a field of a PVData object.
* @param pvField The pvField.

View File

@ -33,7 +33,7 @@ MAIN(testOperators)
PVDoublePtr pvValue = pvStructure->getSubField<PVDouble>("value");
*pvValue <<= testDV;
double dv;
double dv = 0.;
*pvValue >>= dv;
testOk1(testDV == dv);