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 507946 07b82a902b851e5161566c1b47c18eee772af2c7
parent 507945 2449004c31ffceacbcc306b813458dd31fd8505d
child 507947 2b3783d7fa5354130d452383dc9025d96326c97e
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1508095
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
@@ -5807,16 +5807,17 @@ PCCountProfiling_ScriptContents(JSContex
     if (!str) {
         return false;
     }
 
     args.rval().setString(str);
     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."),
@@ -6509,17 +6510,19 @@ gc::ZealModeHelpText),
 "  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 unless\n"
 "  baselineCompile returned a string or threw an error.\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]])",
@@ -6539,17 +6542,19 @@ static const JSFunctionSpecWithHelp Fuzz
 JS_FN_HELP("setDefaultLocale", SetDefaultLocale, 1, 0,
 "setDefaultLocale(locale)",
 "  Set the runtime default locale to the given value.\n"
 "  An empty string or undefined resets the runtime locale to its default value.\n"
 "  NOTE: The input string is not fully validated, it must be a valid BCP-47 language tag."),
 
     JS_FS_HELP_END
 };
-
+// clang-format on
+
+// clang-format off
 static const JSFunctionSpecWithHelp PCCountProfilingTestingFunctions[] = {
     JS_FN_HELP("start", PCCountProfiling_Start, 0, 0,
     "start()",
     "  Start PC count profiling."),
 
     JS_FN_HELP("stop", PCCountProfiling_Stop, 0, 0,
     "stop()",
     "  Stop PC count profiling."),
@@ -6569,16 +6574,17 @@ static const JSFunctionSpecWithHelp PCCo
 
     JS_FN_HELP("contents", PCCountProfiling_ScriptContents, 1, 0,
     "contents(index)",
     "  Return the complete profiling contents for the given script index.\n"
     "  The script index must be in the range [0, pc.count())."),
 
     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
@@ -15,22 +15,24 @@ static bool
 Something(JSContext* cx, unsigned argc, JS::Value* vp)
 {
     JS::CallArgs args = JS::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
@@ -620,31 +620,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"
@@ -656,16 +659,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,
@@ -725,27 +729,29 @@ ospath_join(JSContext* cx, unsigned argc
     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;
@@ -979,16 +985,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."),
@@ -1012,16 +1019,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
@@ -8376,16 +8376,17 @@ WasmLoop(JSContext* cx, unsigned argc, V
         }
     }
 
 #ifdef __AFL_HAVE_MANUAL_CONTROL  // to silence unreachable code warning
     return true;
 #endif
 }
 
+// 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."),
@@ -9015,17 +9016,19 @@ JS_FN_HELP("parseBin", BinParse, 1, 0,
     JS_FN_HELP("wasmCompileInSeparateProcess", WasmCompileInSeparateProcess, 1, 0,
 "wasmCompileInSeparateProcess(buffer)",
 "  Compile the given buffer in a separate process, serialize the resulting\n"
 "  wasm::Module into bytes, and deserialize those bytes in the current\n"
 "  process, returning the resulting WebAssembly.Module."),
 
     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)",
@@ -9099,32 +9102,37 @@ 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 performance_functions[] = {
     JS_FN_HELP("now", Now, 0, 0,
 "now()",
 "  Return the current time with sub-ms precision.\n"
 "  This function is an alias of the dateNow() function."),
     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);