Bug 1508095 - Add clang-format off/on annotations for JSFunctionSpecWithHelp arrays. r=tcampbell
authorJan de Mooij <jdemooij@mozilla.com>
Wed, 28 Nov 2018 10:31:09 +0100
changeset 450559 8d17cb9df6f4ddfa5794072cdea7e6df68aa2185
parent 450558 44e354f14da5caaf80b9ad857f10801db04a2c6c
child 450560 9f2db2f1993c40857fb9fa9acde9f72c7142fe7f
push id272
push usereakhgari@mozilla.com
push dateThu, 13 Dec 2018 22:29:46 +0000
treeherdermozilla-esr60@ff97c7a84632 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1508095
milestone60.4.1
Bug 1508095 - Add clang-format off/on annotations for JSFunctionSpecWithHelp arrays. r=tcampbell Differential Revision: https://phabricator.services.mozilla.com/D13221
js/src/builtin/TestingFunctions.cpp
js/src/gdb/tests/test-unwind.cpp
js/src/shell/OSObject.cpp
js/src/shell/js.cpp
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -5126,16 +5126,17 @@ BaselineCompile(JSContext* cx, unsigned 
         return ReturnStringCopy(cx, args, "skipped");
       case jit::Method_Compiled:
         args.rval().setUndefined();
     }
 
     return true;
 }
 
+// clang-format off
 static const JSFunctionSpecWithHelp TestingFunctions[] = {
     JS_FN_HELP("gc", ::GC, 0, 0,
 "gc([obj] | 'zone' [, 'shrinking'])",
 "  Run the garbage collector. When obj is given, GC only its zone.\n"
 "  If 'zone' is given, GC any zones that were scheduled for\n"
 "  GC via schedulegc.\n"
 "  If 'shrinking' is passed as the optional second argument, perform a\n"
 "  shrinking GC rather than a normal GC."),
@@ -5782,17 +5783,19 @@ gc::ZealModeHelpText),
 "  Without arguments, baseline-compiles the caller's script; but note\n"
 "  that extra boilerplate is needed afterwards to cause the VM to start\n"
 "  running the jitcode rather than staying in the interpreter:\n"
 "    baselineCompile();  for (var i=0; i<1; i++) {} ...\n"
 "  The interpreter will enter the new jitcode at the loop header.\n"),
 
     JS_FS_HELP_END
 };
-
+// clang-format on
+
+// clang-format off
 static const JSFunctionSpecWithHelp FuzzingUnsafeTestingFunctions[] = {
 #ifdef DEBUG
     JS_FN_HELP("parseRegExp", ParseRegExp, 3, 0,
 "parseRegExp(pattern[, flags[, match_only])",
 "  Parses a RegExp pattern and returns a tree, potentially throwing."),
 
     JS_FN_HELP("disRegExp", DisRegExp, 3, 0,
 "disRegExp(regexp[, match_only[, input]])",
@@ -5806,16 +5809,17 @@ static const JSFunctionSpecWithHelp Fuzz
     JS_FN_HELP("setTimeZone", SetTimeZone, 1, 0,
 "setTimeZone(tzname)",
 "  Set the 'TZ' environment variable to the given time zone and applies the new time zone.\n"
 "  An empty string or undefined resets the time zone to its default value.\n"
 "  NOTE: The input string is not validated and will be passed verbatim to setenv()."),
 
     JS_FS_HELP_END
 };
+// clang-format on
 
 bool
 js::DefineTestingFunctions(JSContext* cx, HandleObject obj, bool fuzzingSafe_,
                            bool disableOOMFunctions_)
 {
     fuzzingSafe = fuzzingSafe_;
     if (EnvVarIsDefined("MOZ_FUZZING_SAFE"))
         fuzzingSafe = true;
--- a/js/src/gdb/tests/test-unwind.cpp
+++ b/js/src/gdb/tests/test-unwind.cpp
@@ -8,22 +8,24 @@ static bool
 Something(JSContext* cx, unsigned argc, JS::Value* vp)
 {
     JS::CallArgs args = CallArgsFromVp(argc, vp);
     args.rval().setInt32(23);
     breakpoint();
     return true;
 }
 
+// clang-format off
 static const JSFunctionSpecWithHelp unwind_functions[] = {
     JS_FN_HELP("something", Something, 0, 0,
 "something()",
 "  Test function for test-unwind."),
     JS_FS_HELP_END
 };
+// clang-format on
 
 FRAGMENT(unwind, simple) {
     using namespace JS;
 
     JS::Rooted<JSObject*> global(cx, JS::CurrentGlobalOrNull(cx));
     if (!JS_DefineFunctionsWithHelp(cx, global, unwind_functions))
         return;
 
--- a/js/src/shell/OSObject.cpp
+++ b/js/src/shell/OSObject.cpp
@@ -583,31 +583,34 @@ osfile_close(JSContext* cx, unsigned arg
     }
 
     fileObj->close();
 
     args.rval().setUndefined();
     return true;
 }
 
+// clang-format off
 static const JSFunctionSpecWithHelp osfile_functions[] = {
     JS_FN_HELP("readFile", osfile_readFile, 1, 0,
 "readFile(filename, [\"binary\"])",
 "  Read entire contents of filename. Returns a string, unless \"binary\" is passed\n"
 "  as the second argument, in which case it returns a Uint8Array. Filename is\n"
 "  relative to the current working directory."),
 
     JS_FN_HELP("readRelativeToScript", osfile_readRelativeToScript, 1, 0,
 "readRelativeToScript(filename, [\"binary\"])",
 "  Read filename into returned string. Filename is relative to the directory\n"
 "  containing the current script."),
 
     JS_FS_HELP_END
 };
+// clang-format on
 
+// clang-format off
 static const JSFunctionSpecWithHelp osfile_unsafe_functions[] = {
     JS_FN_HELP("writeTypedArrayToFile", osfile_writeTypedArrayToFile, 2, 0,
 "writeTypedArrayToFile(filename, data)",
 "  Write the contents of a typed array to the named file."),
 
     JS_FN_HELP("redirect", osfile_redirectOutput, 1, 0,
 "redirect([path-or-object])",
 "  Redirect print() output to the named file.\n"
@@ -619,16 +622,17 @@ static const JSFunctionSpecWithHelp osfi
 "  Same as redirect(), but for printErr"),
 
     JS_FN_HELP("close", osfile_close, 1, 0,
 "close(object)",
 "  Close the file returned by an earlier redirect call."),
 
     JS_FS_HELP_END
 };
+// clang-format on
 
 static bool
 ospath_isAbsolute(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     if (args.length() != 1 || !args[0].isString()) {
         JS_ReportErrorNumberASCII(cx, my_GetErrorMessage, nullptr, JSSMSG_INVALID_ARGS,
@@ -683,27 +687,29 @@ ospath_join(JSContext* cx, unsigned argc
     JSString* result = buffer.finishString();
     if (!result)
         return false;
 
     args.rval().setString(result);
     return true;
 }
 
+// clang-format off
 static const JSFunctionSpecWithHelp ospath_functions[] = {
     JS_FN_HELP("isAbsolute", ospath_isAbsolute, 1, 0,
 "isAbsolute(path)",
 "  Return whether the given path is absolute."),
 
     JS_FN_HELP("join", ospath_join, 1, 0,
 "join(paths...)",
 "  Join one or more path components in a platform independent way."),
 
     JS_FS_HELP_END
 };
+// clang-format on
 
 static bool
 os_getenv(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     if (args.length() < 1) {
         JS_ReportErrorASCII(cx, "os.getenv requires 1 argument");
         return false;
@@ -931,16 +937,17 @@ os_waitpid(JSContext* cx, unsigned argc,
         }
     }
 
     args.rval().setObject(*info);
     return true;
 }
 #endif
 
+// clang-format off
 static const JSFunctionSpecWithHelp os_functions[] = {
     JS_FN_HELP("getenv", os_getenv, 1, 0,
 "getenv(variable)",
 "  Get the value of an environment variable."),
 
     JS_FN_HELP("getpid", os_getpid, 0, 0,
 "getpid()",
 "  Return the current process id."),
@@ -964,16 +971,17 @@ static const JSFunctionSpecWithHelp os_f
 "waitpid(pid[, nohang])",
 "  Calls waitpid(). 'nohang' is a boolean indicating whether to pass WNOHANG.\n"
 "  The return value is an object containing a 'pid' field, if a process was waitable\n"
 "  and an 'exitStatus' field if a pid exited."),
 #endif
 
     JS_FS_HELP_END
 };
+// clang-format on
 
 bool
 DefineOS(JSContext* cx, HandleObject global,
          bool fuzzingSafe,
          RCFile** shellOut, RCFile** shellErr)
 {
     RootedObject obj(cx, JS_NewPlainObject(cx));
     if (!obj || !JS_DefineProperty(cx, global, "os", obj, 0))
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -6800,16 +6800,17 @@ WasmLoop(JSContext* cx, unsigned argc, V
             // Clear any pending exceptions, we don't care about them
             cx->clearPendingException();
         }
     }
 
     return true;
 }
 
+// clang-format off
 static const JSFunctionSpecWithHelp shell_functions[] = {
     JS_FN_HELP("clone", Clone, 1, 0,
 "clone(fun[, scope])",
 "  Clone function object."),
 
     JS_FN_HELP("options", Options, 0, 0,
 "options([option ...])",
 "  Get or toggle JavaScript options."),
@@ -7340,17 +7341,19 @@ JS_FN_HELP("parseBin", BinParse, 1, 0,
 "provided object (this should generally be Intl itself).  The added\n"
 "functions and their behavior are experimental: don't depend upon them\n"
 "unless you're willing to update your code if these experimental APIs change\n"
 "underneath you."),
 #endif // ENABLE_INTL_API
 
     JS_FS_HELP_END
 };
-
+// clang-format on
+
+// clang-format off
 static const JSFunctionSpecWithHelp fuzzing_unsafe_functions[] = {
     JS_FN_HELP("getSelfHostedValue", GetSelfHostedValue, 1, 0,
 "getSelfHostedValue()",
 "  Get a self-hosted value by its name. Note that these values don't get \n"
 "  cached, so repeatedly getting the same value creates multiple distinct clones."),
 
     JS_FN_HELP("line2pc", LineToPC, 0, 0,
 "line2pc([fun,] line)",
@@ -7452,24 +7455,27 @@ TestAssertRecoveredOnBailout,
 
     JS_FN_HELP("setBufferStreamParams", SetBufferStreamParams, 2, 0,
 "setBufferStreamParams(delayMillis, chunkByteSize)",
 "  Set the delay time (between calls to StreamConsumer::consumeChunk) and chunk\n"
 "  size (in bytes)."),
 
     JS_FS_HELP_END
 };
-
+// clang-format on
+
+// clang-format off
 static const JSFunctionSpecWithHelp console_functions[] = {
     JS_FN_HELP("log", Print, 0, 0,
 "log([exp ...])",
 "  Evaluate and print expressions to stdout.\n"
 "  This function is an alias of the print() function."),
     JS_FS_HELP_END
 };
+// clang-format on
 
 bool
 DefineConsole(JSContext* cx, HandleObject global)
 {
     RootedObject obj(cx, JS_NewPlainObject(cx));
     return obj &&
            JS_DefineFunctionsWithHelp(cx, obj, console_functions) &&
            JS_DefineProperty(cx, global, "console", obj, 0);