$OpenBSD: patch-plv8_cc,v 1.2 2017/05/29 15:38:20 espie Exp $

https://code.google.com/p/plv8js/source/detail?r=094df45dce2a879d1814b792aeb46b38f0f0ef87&name=r1.4

Index: plv8.cc
--- plv8.cc.orig
+++ plv8.cc
@@ -8,6 +8,13 @@
 #include "plv8.h"
 #include <new>
 
+// XXX this is a horrible hack!!!!
+// plv8 tries to preserve itself from C++ constructs, BUT it includes
+// some postgresql includes that *will* include math.h, and with libc++
+// THAT one contains C++ constructs in C++ mode, so include it *FIRST*
+// (barf, blech, yuck)
+#include <math.h>
+
 extern "C" {
 #define delete		delete_
 #define namespace	namespace_
@@ -47,22 +54,12 @@ PG_FUNCTION_INFO_V1(plcoffee_call_validator);
 PG_FUNCTION_INFO_V1(plls_call_handler);
 PG_FUNCTION_INFO_V1(plls_call_validator);
 
-Datum	plv8_call_handler(PG_FUNCTION_ARGS) throw();
-Datum	plv8_call_validator(PG_FUNCTION_ARGS) throw();
-Datum	plcoffee_call_handler(PG_FUNCTION_ARGS) throw();
-Datum	plcoffee_call_validator(PG_FUNCTION_ARGS) throw();
-Datum	plls_call_handler(PG_FUNCTION_ARGS) throw();
-Datum	plls_call_validator(PG_FUNCTION_ARGS) throw();
-
 void _PG_init(void);
 
 #if PG_VERSION_NUM >= 90000
 PG_FUNCTION_INFO_V1(plv8_inline_handler);
 PG_FUNCTION_INFO_V1(plcoffee_inline_handler);
 PG_FUNCTION_INFO_V1(plls_inline_handler);
-Datum	plv8_inline_handler(PG_FUNCTION_ARGS) throw();
-Datum	plcoffee_inline_handler(PG_FUNCTION_ARGS) throw();
-Datum	plls_inline_handler(PG_FUNCTION_ARGS) throw();
 #endif
 } // extern "C"
 
@@ -307,26 +304,26 @@ common_pl_call_handler(PG_FUNCTION_ARGS, Dialect diale
 }
 
 Datum
-plv8_call_handler(PG_FUNCTION_ARGS) throw()
+plv8_call_handler(PG_FUNCTION_ARGS)
 {
 	return common_pl_call_handler(fcinfo, PLV8_DIALECT_NONE);
 }
 
 Datum
-plcoffee_call_handler(PG_FUNCTION_ARGS) throw()
+plcoffee_call_handler(PG_FUNCTION_ARGS)
 {
 	return common_pl_call_handler(fcinfo, PLV8_DIALECT_COFFEE);
 }
 
 Datum
-plls_call_handler(PG_FUNCTION_ARGS) throw()
+plls_call_handler(PG_FUNCTION_ARGS)
 {
 	return common_pl_call_handler(fcinfo, PLV8_DIALECT_LIVESCRIPT);
 }
 
 #if PG_VERSION_NUM >= 90000
 static Datum
-common_pl_inline_handler(PG_FUNCTION_ARGS, Dialect dialect) throw()
+common_pl_inline_handler(PG_FUNCTION_ARGS, Dialect dialect)
 {
 	InlineCodeBlock *codeblock = (InlineCodeBlock *) DatumGetPointer(PG_GETARG_DATUM(0));
 
@@ -354,19 +351,19 @@ common_pl_inline_handler(PG_FUNCTION_ARGS, Dialect dia
 }
 
 Datum
-plv8_inline_handler(PG_FUNCTION_ARGS) throw()
+plv8_inline_handler(PG_FUNCTION_ARGS)
 {
 	return common_pl_inline_handler(fcinfo, PLV8_DIALECT_NONE);
 }
 
 Datum
-plcoffee_inline_handler(PG_FUNCTION_ARGS) throw()
+plcoffee_inline_handler(PG_FUNCTION_ARGS)
 {
 	return common_pl_inline_handler(fcinfo, PLV8_DIALECT_COFFEE);
 }
 
 Datum
-plls_inline_handler(PG_FUNCTION_ARGS) throw()
+plls_inline_handler(PG_FUNCTION_ARGS)
 {
 	return common_pl_inline_handler(fcinfo, PLV8_DIALECT_LIVESCRIPT);
 }
@@ -688,7 +685,7 @@ CallTrigger(PG_FUNCTION_ARGS, plv8_exec_env *xenv)
 }
 
 static Datum
-common_pl_call_validator(PG_FUNCTION_ARGS, Dialect dialect) throw()
+common_pl_call_validator(PG_FUNCTION_ARGS, Dialect dialect)
 {
 	Oid				fn_oid = PG_GETARG_OID(0);
 	HeapTuple		tuple;
@@ -746,19 +743,19 @@ common_pl_call_validator(PG_FUNCTION_ARGS, Dialect dia
 }
 
 Datum
-plv8_call_validator(PG_FUNCTION_ARGS) throw()
+plv8_call_validator(PG_FUNCTION_ARGS)
 {
 	return common_pl_call_validator(fcinfo, PLV8_DIALECT_NONE);
 }
 
 Datum
-plcoffee_call_validator(PG_FUNCTION_ARGS) throw()
+plcoffee_call_validator(PG_FUNCTION_ARGS)
 {
 	return common_pl_call_validator(fcinfo, PLV8_DIALECT_COFFEE);
 }
 
 Datum
-plls_call_validator(PG_FUNCTION_ARGS) throw()
+plls_call_validator(PG_FUNCTION_ARGS)
 {
 	return common_pl_call_validator(fcinfo, PLV8_DIALECT_LIVESCRIPT);
 }
