Creates a NoNewThreadsChecker plugin that looks for the function and checks to see if it's allowed. -Creates two allowlists - `ThreadAllows.txt` is for thread names, while `ThreadFileAllows.txt` checks for entire files where instances of `NS_NewNamedThread` should be ignored. -If an instance of `NS_NewNamedThread` is not listed in either list, then the checker throws an error with an additional note containing a more descriptive explanation of the failure. Differential Revision: https://phabricator.services.mozilla.com/D62635
10 lines
620 B
C++
10 lines
620 B
C++
// Dummy NS_NewNamedThread.
|
|
void NS_NewNamedThread(const char *aName) {}
|
|
|
|
void func_threads() {
|
|
// Test to see if the checker recognizes a bad name, and if it recognizes a
|
|
// name from the ThreadAllows.txt.
|
|
NS_NewNamedThread("A bad name"); // expected-error {{Thread name not recognized. Please use the background thread pool.}} expected-note {{NS_NewNamedThread has been deprecated in favor of background task dispatch via NS_DispatchBackgroundTask and NS_CreateBackgroundTaskQueue. If you must create a new ad-hoc thread, have your thread name added to ThreadAllows.txt.}}
|
|
NS_NewNamedThread("Checker Test");
|
|
}
|