Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-31421 Rationalize UNIMPLEMENTED and add a class variety #18392

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions fs/dafsserver/dafsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1234,11 +1234,14 @@ class CRemoteDiskBaseActivity : public CSimpleInterfaceOf<IRemoteReadActivity>,
}
virtual void serializeCursor(MemoryBuffer &tgt) const override
{
throwUnexpected();
// we need to serialize something, because the lack of a cursor is used to signify end of stream
// NB: the cursor is opaque and only to be consumed by dafilesrv. When used it is simply passed back.
tgt.append("UNSUPPORTED");
}
virtual void restoreCursor(MemoryBuffer &src) override
{
throwUnexpected();
throw makeStringExceptionV(0, "restoreCursor not supported in: %s", typeid(*this).name());
throwUnimplemented();
}
virtual void flushStatistics(CClientStats &stats) override
{
Expand Down Expand Up @@ -2389,11 +2392,13 @@ class CRemoteWriteBaseActivity : public CSimpleInterfaceOf<IRemoteWriteActivity>
}
virtual void serializeCursor(MemoryBuffer &tgt) const override
{
throwUnexpected();
// we need to serialize something, because the lack of a cursor is used to signify end of stream
// NB: the cursor is opaque and only to be consumed by dafilesrv. When used it is simply passed back.
tgt.append("UNSUPPORTED");
}
virtual void restoreCursor(MemoryBuffer &src) override
{
throwUnexpected();
throw makeStringExceptionV(0, "restoreCursor not supported in: %s", typeid(*this).name());
}
virtual StringBuffer &getInfoStr(StringBuffer &out) const override
{
Expand Down
18 changes: 18 additions & 0 deletions system/jlib/jexcept.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,24 @@ void throwUnexpectedException(const char * what, const char * function, const ch
throw makeStringExceptionV(9999, "Internal Error '%s' in %s() at %s(%d)", what, function, sanitizeSourceFile(file), line);
}

void jlib_decl throwUnimplementedException(const char * function, const char * file, unsigned line)
{
printStackReport();
throw makeStringExceptionV(9999, "UNIMPLEMENTED feature in function %s() at %s(%d)", function, sanitizeSourceFile(file), line);
}

void jlib_decl throwUnimplementedException(const char * what, const char * function, const char * file, unsigned line)
{
printStackReport();
throw makeStringExceptionV(-1, "UNIMPLEMENTED feature [%s] in function %s() at %s(%d)", what, function, sanitizeSourceFile(file), line);
}

void jlib_decl throwUnimplementedException(const char * what, const char *what2, const char * function, const char * file, unsigned line)
{
printStackReport();
throw makeStringExceptionV(-1, "UNIMPLEMENTED feature [%s %s] in function %s() at %s(%d)", what, what2, function, sanitizeSourceFile(file), line);
}

void raiseAssertException(const char *assertion, const char *file, unsigned line)
{
StringBuffer s;
Expand Down
15 changes: 11 additions & 4 deletions system/jlib/jexcept.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void jlib_decl setTerminateOnSEH(bool set=true);
void jlib_decl setProcessAborted(bool _abortVal);

__declspec(noreturn) void jlib_decl throwUnexpectedException(const char * function, const char * file, unsigned line) __attribute__((noreturn));
__declspec(noreturn) void jlib_decl throwUnexpectedException(const char * function, const char * where, const char * file, unsigned line) __attribute__((noreturn));
__declspec(noreturn) void jlib_decl throwUnexpectedException(const char * what, const char * function, const char * file, unsigned line) __attribute__((noreturn));

const char jlib_decl *sanitizeSourceFile(const char *file);

Expand All @@ -144,9 +144,16 @@ const char jlib_decl *sanitizeSourceFile(const char *file);
#define throwUnexpectedX(x) throwUnexpectedException(x, __func__, sanitizeSourceFile(__FILE__), __LINE__)
#define assertThrow(x) assertex(x)

#define UNIMPLEMENTED throw makeStringExceptionV(-1, "UNIMPLEMENTED feature at %s(%d)", sanitizeSourceFile(__FILE__), __LINE__)
#define UNIMPLEMENTED_X(reason) throw makeStringExceptionV(-1, "UNIMPLEMENTED '" reason "' at %s(%d)", sanitizeSourceFile(__FILE__), __LINE__)
#define UNIMPLEMENTED_XY(a,b) throw makeStringExceptionV(-1, "UNIMPLEMENTED " a " %s at %s(%d)", b, sanitizeSourceFile(__FILE__), __LINE__)
__declspec(noreturn) void jlib_decl throwUnimplementedException(const char * function, const char * file, unsigned line) __attribute__((noreturn));
__declspec(noreturn) void jlib_decl throwUnimplementedException(const char * what, const char * function, const char * file, unsigned line) __attribute__((noreturn));
__declspec(noreturn) void jlib_decl throwUnimplementedException(const char * what, const char *what2, const char * function, const char * file, unsigned line) __attribute__((noreturn));
#define throwUnimplemented() throwUnimplementedException(__func__, sanitizeSourceFile(__FILE__), __LINE__)
#define throwUnimplementedX(x) throwUnimplementedException(x, __func__, sanitizeSourceFile(__FILE__), __LINE__)

#define UNIMPLEMENTED throwUnimplementedException(__func__, sanitizeSourceFile(__FILE__), __LINE__)
#define UNIMPLEMENTED_C throwUnimplementedException("CLASSTYPE:", typeid(*this).name(), __func__, sanitizeSourceFile(__FILE__), __LINE__)
#define UNIMPLEMENTED_X(reason) throwUnimplementedException(reason, __func__, sanitizeSourceFile(__FILE__), __LINE__)
#define UNIMPLEMENTED_XY(a,b) throwUnimplementedException(a, b, __func__, sanitizeSourceFile(__FILE__), __LINE__)

IException jlib_decl * deserializeException(MemoryBuffer & in);
void jlib_decl serializeException(IException * e, MemoryBuffer & out);
Expand Down
11 changes: 6 additions & 5 deletions system/jlib/jptree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@
#define WARNLEGACYCOMPARE
#define XMLTAG_CONTENT "<>"

#undef UNIMPLEMENTED
#define UNIMPLEMENTED throw MakeIPTException(-1, "UNIMPLEMENTED")
#define UNIMPLEMENTED_IPT throw MakeIPTException(-1, "UNIMPLEMENTED feature in function %s() at %s(%d)", __func__, sanitizeSourceFile(__FILE__), __LINE__)


#define CHECK_ATTRIBUTE(X) if (X && isAttribute(X)) throw MakeIPTException(PTreeExcpt_XPath_Unsupported, "Attribute usage invalid here");
#define AMBIGUOUS_PATH(X,P) { StringBuffer buf; buf.append(X": ambiguous xpath \"").append(P).append("\""); throw MakeIPTException(PTreeExcpt_XPath_Ambiguity,"%s",buf.str()); }

Expand Down Expand Up @@ -1914,7 +1915,7 @@ bool PTree::renameProp(const char *xpath, const char *newName)
if (strcmp(xpath,"/")==0) // rename of self allowed assuming no parent
setName(newName);
else if ('[' == *xpath)
UNIMPLEMENTED;
UNIMPLEMENTED_IPT;
else if (isAttribute(xpath))
{
StringBuffer val;
Expand Down Expand Up @@ -3506,7 +3507,7 @@ bool PTree::checkPattern(const char *&xxpath) const
for (;;)
{
if (matchElem->isBinary(tProp))
UNIMPLEMENTED;
UNIMPLEMENTED_IPT;
const char *rhs;
unsigned rhslength;
if (quoteEnd)
Expand Down Expand Up @@ -6290,7 +6291,7 @@ class CStringBufferMarkupIOAdapter : public CInterfaceOf<IIOStream>
public:
CStringBufferMarkupIOAdapter(StringBuffer &_out) : out(_out) { }
virtual void flush() override { }
virtual size32_t read(size32_t len, void * data) override { UNIMPLEMENTED; return 0; }
virtual size32_t read(size32_t len, void * data) override { UNIMPLEMENTED_IPT; }
virtual size32_t write(size32_t len, const void * data) override { out.append(len, (const char *)data); return len; }
};

Expand Down
10 changes: 5 additions & 5 deletions system/jlib/jtrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,10 @@
#include "opentelemetry/sdk/trace/batch_span_processor_factory.h"
#include "opentelemetry/exporters/ostream/span_exporter_factory.h"// auto exporter = opentelemetry::exporter::trace::OStreamSpanExporterFactory::Create();
#include "opentelemetry/exporters/ostream/common_utils.h"
//#define oldForEach ForEach // error: ‘ForEach’ was not declared in this scope
#undef ForEach //opentelemetry defines ForEach
#include "opentelemetry/exporters/memory/in_memory_span_exporter_factory.h"
#include "opentelemetry/trace/propagation/http_trace_context.h" //opentel_trace::propagation::kTraceParent
#undef UNIMPLEMENTED //opentelemetry defines UNIMPLEMENTED
#include "opentelemetry/trace/provider.h" //StartSpanOptions
#include "opentelemetry/exporters/otlp/otlp_grpc_exporter.h"
#define UNIMPLEMENTED throw makeStringExceptionV(-1, "UNIMPLEMENTED feature at %s(%d)", sanitizeSourceFile(__FILE__), __LINE__)
#define ForEach(i) for((i).first();(i).isValid();(i).next())

#include "opentelemetry/exporters/otlp/otlp_grpc_exporter_factory.h"
#include "opentelemetry/exporters/otlp/otlp_http_exporter_factory.h"
Expand All @@ -41,6 +36,11 @@
#include "opentelemetry/sdk/trace/exporter.h"
#include "opentelemetry/sdk/trace/span_data.h"

// NB: undefine after opentelemetry includes, and before HPCC includes where we define.
#undef ForEach //opentelemetry defines ForEach
#undef UNIMPLEMENTED //opentelemetry defines UNIMPLEMENTED


#include "platform.h"
#include "jlib.hpp"
#include "jmisc.hpp"
Expand Down
Loading