diff --git a/js/src/jsapi.h b/js/src/jsapi.h index ec80f790ca8b..b849a85b1452 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -233,14 +233,18 @@ JS_PopArguments(JSContext *cx, void *mark); * to the caller to keep the string alive until Remove is called. */ -/* XXX typedef'd here rather than in jspubtd.h #ifdef va_start, to avoid bad - * XXX includers who grab jspubtd.h, then , then jsapi.h and unhide - * XXX the typedef uses below in JS_AddArgumentFormatter without exposing the - * XXX definition in jspubtd.h, which is of course include-idempotent. +#ifndef JS_ARGUMENT_FORMATTER_DEFINED +#define JS_ARGUMENT_FORMATTER_DEFINED 1 +/* XXX typedef'd here and in jspubtd.h #ifdef va_start, even though we include + * XXX jspubtd.h up above, to avoid bad XXX includers who grab jspubtd.h, then + * XXX , then jsapi.h, thereby hiding the jspubtd def but unhiding + * XXX the typedef use below in JS_AddArgumentFormatter; we need jspubtd.h to + * XXX do the typedef for jsapi.h-independent files such as jscntxt.h. */ typedef JSBool (* CRT_CALL JSArgumentFormatter)(JSContext *cx, const char *format, JSBool fromJS, jsval **vpp, va_list *app); +#endif JS_PUBLIC_API(JSBool) JS_AddArgumentFormatter(JSContext *cx, const char *format, diff --git a/js/src/jspubtd.h b/js/src/jspubtd.h index 3f06c37f2806..5b1cc9ad3cf2 100644 --- a/js/src/jspubtd.h +++ b/js/src/jspubtd.h @@ -238,6 +238,16 @@ typedef const JSErrorFormatString * (* CRT_CALL JSErrorCallback)(void *userRef, const char *locale, const uintN errorNumber); +#ifdef va_start +#ifndef JS_ARGUMENT_FORMATTER_DEFINED +#define JS_ARGUMENT_FORMATTER_DEFINED 1 +/* XXX typedef'd here and in jsapi.h, see XXX comment there. */ +typedef JSBool +(* CRT_CALL JSArgumentFormatter)(JSContext *cx, const char *format, + JSBool fromJS, jsval **vpp, va_list *app); +#endif +#endif + JS_END_EXTERN_C #endif /* jspubtd_h___ */