During compilation, there's like a zillion warnings about missing
prototype of ExceptionalCondition. Of course, in regular postgres
this is defined in postgres.h like this:
void ExceptionalCondition(...)
but in XL apparently some places use Assert it without willing to
include the whole postgres.h (not sure why). So there's a copy of
the function in src/gtm/common/assert.c, but there's no prototype
in src/include/gtm/assert.h, thus the complaints.
Adding the prototype to the header file however reveals another
problem, as the function in src/gtm/common/assert.c is defined
like this
int ExceptionalCondition(...)
with a rather wonky explanation about TrapMacro(). So this would
fail to compile when a file ends up g both header files, like for
example src/gtm/client/gtm_client.c. (Fun fact: gtm_client.c does
not really need the include at all.)
Therefore the best solution at this point seems to be to simply
change the return type in assert.c to void (and get rid of the
rather suspicious explanation above the function), and add the
prototype into src/include/gtm/assert.c. This way the prototype
matches the one from postgres.h, there's no conflict and the
warnings disappear.
In the long term however, the right solution seems to be simply
removing the redundancy by dropping the gtm copy of the function.
/*
* ExceptionalCondition - Handles the failure of an Assert()
- *
- * Note: this can't actually return, but we declare it as returning int
- * because the TrapMacro() macro might get wonky otherwise.
*/
-int
+void
ExceptionalCondition(const char *conditionName,
const char *errorType,
const char *fileName,
fflush(stderr);
abort();
- return 0;
}
extern bool assert_enabled;
+void ExceptionalCondition(const char *conditionName,
+ const char *errorType,
+ const char *fileName,
+ int lineNumber);
+
#endif